Computational Setup

SoftSys Computational Setup #

For this course, you’ll need a UNIX environment with the ability to compile and run code in C. There are two supported methods for doing so in this course:

Method 1: run a Linux virtual machine. You can download and run a virtual machine (VM) running Ubuntu 20.04, a common Linux-based operating system (OS). A VM is essentially a program running on your computer (whether Windows, macOS, or Linux) that emulates the components of a computer, allowing you to run a full OS within your existing machine. This is probably the easier method to set up, but performance can be a bit slower.

Method 2: set up a dual-boot system. You can set up a dual-boot system, which allows you to have two OSes side by side on your computer. Each time you start your computer, you’ll be able to choose which OS to boot into. Since your UNIX environment will be running on your computer’s actual hardware, performance will be close to what you have on your existing OS. However, you will need to pre-allocate some portion of your hard drive’s space for this OS, and you will need to restart your machine if you want to switch OSes.

You’re welcome to set up an environment using any other approach you wish. For example, if you’re running macOS, most of this course should run as is, but you might experience some minor differences in the way that certain parts of the OS behave in specific circumstances. On Windows, you could set up Cygwin or WSL to get a UNIX-like experience, but historically, these setups tend to break in odd ways, particularly if you want to do anything that actually interfaces with hardware (e.g., libraries that talk to sound/video cards). All of these methods are unsupported, meaning that if something goes wrong, we may not be able to find a solution for you.

Virtual Machine Setup #

If you have macOS Big Sur, VirtualBox will likely not work. Use VMWare Fusion instead of VirtualBox, which has been reported to work.

To get started with the course virtual machine, head to the VirtualBox downloads page and download the “VirtualBox 6.1.18 platform packages” for your OS. Download the version for the OS you are currently running (which is likely Windows or OS X for most of you). Run the downloaded file to install VirtualBox on your system.

You wiill also need the VM image for this course, which you can get here. You are strongly recommended to use a fast, stable Internet connection (preferably a wired connection), as the file is quite large (5.2 GB).

Once you have this file, you need to import it into VirtualBox. Open the VirtualBox VM Manager and select File -> Import Appliance. When prompted, select the softsys-ubuntu2004.ova file you downloaded.

Once imported, you can start the VM and log in. The password for login is Under the C (exactly as written, including spaces). Once you’ve done this, you need to configure Git with your name and email. Head to the “Configure Git” section at the bottom to set this up.

Dual-Boot Setup #

This method results in better performance on Ubuntu, but is more involved than above. For this method, you’ll need a spare USB drive with 4 GB or more of space that you don’t mind wiping and overwriting. You’ll also want enough spare hard disk space - for this course, 16 GB should be more than enough, but if you want to use Linux for anything else, you will likely want more free space.

Prepare an Ubuntu Installer USB #

Head to the Ubuntu download page and download the Ubuntu 20.04.1 LTS image. This is a reasonably large file, so a wired connection is recommended.

Once you have the image, you need to write it to the USB device. If you have a preferred way of doing this already, you can just use that. Otherwise, download balenaEtcher for your OS and install it.

After installation, start up balenaEtcher and choose “Flash from file”, selecting the image you downloaded (this should end in .iso). Then click on “Select target” and choose the USB drive you want to write to. Finally, click “Flash!” and wait for the application to write the image to the USB drive.

Allocate Space for Ubuntu #

You will need to make sure your hard drive has enough free space for the OS install. Again, for this course 16 GB should suffice, but if you want to use Linux for other things, you should consider allocating more space. You can resize your existing hard drive’s allocation of space to make sure that Ubuntu will have enough. In macOS, you can do this through Disk Utility by selecting Images -> Resize on your main image.

To do this in Windows, open the start menu and type diskmgmt.msc into the search box, then press Enter to start the Disk Management utility. Select the line with the largest amount of space (usually your C:\ drive), and select Action -> All Tasks -> Shrink Volume…, which will bring up a new window.

In this window, you can shrink your partition by some size, specified in MB. If allocating 16 GB, enter 16000 and proceed. Once the process is done, you should see the appropriate amount of “Unallocated Space.” It may be necessary to restart Windows to see this space.

Install Ubuntu #

Shut off your machine, and then insert the USB drive into a spare port. Start up your machine and press the appropriate key when you see your computer manufacturer’s logo (usually this key is Del or F12). This will bring up a “boot menu” from which you can select which device to boot your computer from. Select the USB drive you set up earlier.

This should bring up a graphical installer that you can go through to install Ubuntu on your machine. In this process, you should be able to see the partition of free space that you allocated earlier. Make sure you install Ubuntu there, or you risk overwriting existing data.

Once the installation process is complete, you can restart your machine, which should now give you the option of selecting which OS to boot into. To finish setting up your machine, select the Ubuntu 20.04 option using your arrow keys and Enter.

Set up Ubuntu #

While the VM we provide for the course has most things set up for you, the version of Ubuntu you installed here is a stock installation, and you need to install additional software yourself.

Open a Terminal from the start menu or by pressing Ctrl-Alt-T. Then type the following command and press Enter:

sudo apt install gcc make git

You will be prompted for your password, but when you type, no text will be shown. This is for security purposes, and is normal.

Once you have installed this software, you should install a text editor to write code in. The VMs for this course are preloaded with Atom, which you can download and install for free. If you are using Atom, run the following command in Terminal after installation:

git config --global core.editor "atom --wait"

This ensures that Git will use Atom as your editor for commit messages. You should also configure Git with your name and email as described below.

Configure Git #

If you have just set up the course VM or a dual-boot system, you need to set your name and email address so that GitHub can properly attribute your work to your account.

If you try to do other operations in Git without having set up your name and email, you will see a message that starts with something like *** Please tell me who you are. and whatever operation you were trying to do will fail.

To set your name in Git, run git config --global user.name "Alan Turing", substituting your name for Alan Turing (but leaving the quotes in place). This can be any name you want, though you should probably avoid using a name that may be seen an attempt to impersonate someone else (e.g., “Bill Gates”).

To set your email, run git config --global user.email "alan@turing.org", substituting your GitHub email address for alan@turing.org. It’s important that your email match the one that GitHub has, because a mismatch can make Git fail in unintuitive ways.

If you mistyped your name or email in the above steps, you can run the same command again with the correct name/email to fix the typo. If you mistyped user.name or user.email, you can use git config --unset user.naem (replacing user.naem with whatever you mistyped earlier) to remove that setting.

You can check that this process was successful by running git config --list. If you see lines starting with user.name, user.email with the values you expect, then the process was successful.