The purpose of this document is to make sure that all the software you need in order to do the assignments for CS 11 is set up correctly.
We will be assuming henceforth that you have taken and passed CS 1 (or placed out of it). We will also assume that you have a rudimentary knowledge of Linux terminal commands (at roughly the level required for CS 1). If not, please read a Linux tutorial, because we will be using the Linux terminal a lot in CS 11.
The CMS lab computers (known as the "CMS cluster") are located in room 104 of the Annenberg building. This is the same room in which lab sections are held. In the past, many students have used the CMS cluster computers to write their assignments for CS classes. However, these computers tend to break down a lot and don't always have the right software installed, so we very strongly urge you not to use the CMS cluster computers for anything and to use your laptop instead when writing your code. This will be much less frustrating for you. The rest of this section will explain how to do this. Note that we still very strongly recommend that you come to the lab sections (bringing your laptop along!), since the teaching assistants will be there to help you with any (course-related) programming problems you may encounter.
Instead of providing detailed instructions on how to install the course software on every conceivable operating system and computer that you may have, we have chosen a simpler solution. This section will show you how to set up a virtual machine (VM) running Ubuntu Linux (technically, it's running the Ubuntu MATE flavor of Ubuntu, which is a lightweight distribution). This VM has been pre-loaded with all the development tools that you will need. The hardest part of this will be downloading the VM image, which is quite large (around 4 gigabytes). Once this is done, setting it up should be straightforward.
One thing must be made crystal-clear at this point. These instructions assume that you will be installing a VM on your own computer. Do not, under any circumstances, attempt to install a VM on one of the CMS cluster computers! This is not supported and will probably make the system administrators very angry, because it will waste a lot of disk space.
In order for this to work, you should have a laptop (or desktop) computer running either Microsoft Windows, Mac OS X, or some version of the Linux operating system. Ideally your computer and its operating system are not too old (say, not more than 2 years old) and the computer has at least 4 gigabytes of RAM (random access memory). You should also have at least 20 gigabytes of free space on your computer's hard disk. Note that Chromebooks (at least, most Chromebooks) are not viable for installing virtual machines. If you don't know whether your laptop's specs are good enough, you need to find out – all programmers should know what operating system they are running and how much RAM and disk space they have on their computers. If your computer's specs aren't good enough to install the VM, you need to get a better laptop!
You will be setting up a virtual machine (VM), and in order to do this you will need software that manages and runs virtual machines. A virtual machine (at least in this context) is an operating system that runs in software (hence "virtual") inside another operating system. The outer ("host") operating system (which is the operating system of your computer, running directly on the computer's hardware) effectively simulates the hardware that the inner ("guest") operating system (running in software) sees. In fact, the guest operating system is not aware that it is being run as a virtual machine, though it will probably run a bit more slowly than it would if it were running on bare hardware.
The software we will use to run our VM is called VirtualBox. You should go to this page and download and install whichever version of VirtualBox runs on your operating system (just the "platform packages" download). For instance, if your laptop runs Microsoft Windows, you should download the version for Windows hosts. If your laptop runs Mac OS X, download the version for OS X hosts. If your laptop runs Linux, you should install VirtualBox using the package manager of your distribution; install the "virtualbox" packages but not the "virtualbox-guest" packages. Ask the TAs if you're not sure how to do this, but if you're already a Linux user, you probably already know how to do this.
Once you've downloaded the installer for your operating system, just click on it to install VirtualBox (unless your host operating system is Linux; see above). Both Windows and OS X will generally give you some grief about installing software from an untrusted source, and you may need to change some settings to allow this. Ask the TAs if you need help doing this. Other than that, the installation should go smoothly.
Download the course VM from this link. This will place a file called "CS_VM_W19.ova" in your downloads directory. This is a large file! Therefore, we very strongly recommend that
you plug your laptop into an AC power supply while downloading, and
you use a wired Ethernet connection to do the download, or (if this isn't possible) use the fastest wifi connection you have access to. Note that downloading late at night or early in the morning may give you better results due to less traffic.
Note that if you don't download the entire file, you won't be able to proceed, so make sure the download continues until completion. If after several tries you still can't get it to work, ask your TA for help. If necessary, we can copy the VM file onto a flash drive if you give us the flash drive.
Once this is completed, pat yourself on the back. You have finished the hardest part of the assignment!
First, start up VirtualBox. (You should be able to find it in the program
menus, or you can use the terminal command line if you're using Linux (the
program name is
virtualbox.) A smallish window should pop up.
Go into the File menu and select "Import Appliance". (The file you downloaded is called an "appliance" for some reason.) You will get a dialog box titled "Appliance to import". To the right of the text entry field there is an icon which you should click; it will allow you to navigate through your file system to find the VM file you downloaded. Do so. (The file will probably be in a directory called "Downloads" under your home directory.) Once you've found and selected the VM file, click "Continue".
Another dialog box will come up called "Appliance settings". Don't worry about this; just click "Import" at the bottom.
Wait. This will probably take a few minutes.
If you've done this correctly, VirtualBox will return to its home window and you will see a new VM listed on the left side called "CS_VM_W19". You're ready to go!
Select "CS_VM_W19" in the VirtualBox window and double-click on it (or hit the "Start" arrow at the top part of the window). The VM should start up.
After a while, you will see a login window, which may be smaller than the entire screen or not. The login name is preselected to be "student". That's you! The login password is "winter2019". Type that in, hit return, and you will log in. (Feel free to change the password if you prefer something else.)
Now would be a good time to mention one annoying thing about VirtualBox. It has a tendency to "capture" the mouse, which means that when you click on the mouse inside a VM window, the mouse pointer won't exit it (or it will but you'll still see a duplicate pointer inside the window). There is a key you can press that will "release" the mouse and let you use applications outside of the VM. This is called the "Host key". On the Mac the Host key is the left Command key, and on Windows and Linux it's the right Control key (you can change the key binding if you really hate it). It's also listed in the lower-right corner of the window the VM is in (if the window isn't maximized). You should practice tapping the Host key in order to get out of the VM (ask a TA if you are having problems with this). Note that you may not need to do this on some systems; clicking outside the window may be sufficient. Clicking inside the VM window will put you in the VM again.
Once you have logged in, the VM should take up the entire window and you will see a gray background and a toolbar at the bottom. If it isn't maximized, hit Control-f (Command-f on a Mac) and it should maximize to take up the entire window. If that doesn't happen, something has gone wrong and you should see a TA.
Look at the toolbar. Note the menu button at the extreme left, which brings up a menu from which you can launch any program you like, shut down the system, etc..
We will mostly be working in the terminal, so there is a keyboard shortcut
for bringing up a terminal window: Control-Alt-t. Hold down the control and alt
keys and hit the "t" key and a terminal window should come up. Double-click on
the terminal window's title bar to maximize it if you like. You can exit from
the terminal by entering
exit at the prompt or hitting Control-d.
Note that if the Control-Alt-t key combination doesn't work, you can still launch a terminal from the menu by clicking the menu button, but it should work.
At this point, you might think you're done, but there are still a few steps
to go. First, you need to learn how to update your system. Most Linux
distributions, including Ubuntu, are continually being updated, and it's
important to make sure your system is up-to-date, because updates contain bug
fixes and fix security holes. There are actually a few different ways to update
your system. When you log in, if you need updates, a graphical program called
Software Updater may already be running and will tell you that you need to
update your system. (The window may be minimized; if so, click on the entry in
the task bar at the bottom to bring it up.) Click on
Install now to update
the system. A window will pop up asking you for your password. You should
enter this and then hit the
Authenticate button, and then the system will
start updating. If there are a lot of updates, this may take a while.
Once you're done, you need to restart the VM. A window will come up asking
if you want to restart now or later; press
Restart now and the system will
restart. After the system restarts, enter your password to log back in.
The graphical installer doesn't always update everything, so you should also
learn how to update the system from the terminal command line. This is actually
just as easy and very powerful once you know what you're doing. To do this,
first start up a terminal as described above. Then enter the following commands
$ is the terminal prompt; don't enter that):
$ sudo apt update [enter your password] $ sudo apt upgrade
You should only have to enter your password once. After
sudo apt update,
a bunch of stuff will be printed in the terminal, none of which you need to pay
attention to. After
sudo apt upgrade, the system will list all the packages
that can be upgraded and offer you a yes/no choice as to whether to proceed or
not. Hit the return key (which selects yes) to start updating. Also note that
the terminal prompt is more complicated than just
$; by default it also
contains your username, the computer's name and the current directory. We will
$ in our examples, but never type the
$ into the terminal!
It's possible to change the prompt to whatever you like; see any Linux tutorial
for more on this.
Note that you shouldn't try to simultaneously update using the graphical updater and the terminal updater, as whichever one is invoked first will prevent the other one from running. Once you're comfortable with updating via the terminal, there's really no need to use the graphical updater anyway. Ideally you should update your computer about once a week to make sure everything is current.
Now you have a fully-functional and up-to-date Linux system installed as a virtual machine. You will see toolbars on the top and bottom of the screen with a few panel "applets" on them to control things like volume, to show the time, to allow you to go to a different virtual desktop (called a "pager") etc.; these are on the right-hand sides.
Click on the menu button and then select "Control Center". This will bring up a sub-menu where you can configure the system as you like. For instance, if you hate the plain gray background, select "Appearance"; a new window will open. Select "Background" in that window and pick a different color or some wallpaper image. You can configure other things too; bring up the different menu items and look around.
You will be working mainly in the terminal, so you need to be able to launch terminals quickly. In addition to clicking on the icon launcher in the toolbar, you can also just hit the key combination Control-Alt-t to bring up a terminal.
Since you'll be working in the terminal so much, it is worth spending a
couple of minutes configuring the terminal to be as comfortable as possible.
You may want to change the terminal's background color, the text color, or the
font used for the text to suit your preferences. To do this, launch a terminal,
click on the
Edit menu and then select the
Profile Preferences option.
This will bring up a window in which you can select a number of preferences (the
foreground and background colors, the font, etc.).
Also, note that the terminal program can create multiple terminals or
multiple tabs in a single terminal. Tabs are very useful when doing multiple
distinct things. Create a new tab by typing Control+Shift+t. Create a new
terminal window by typing Control+Shift+n. (These actions can also be done from
the terminal's menu.) Type Control+d in a terminal window to close it, or just
There are other terminal configurations you can set, but this is enough for now.
All the course software comes pre-installed on the VM, including
some other compilers (some of which you won't need). Just open up a terminal and
You are free to use whatever text editor you like to edit your code as long
as it outputs plain text and not e.g. Rich Text Documents, PDFs or Word
documents. We've installed several text editors into the VM, including
geany (pronounced "genie"). Ubuntu MATE also comes with
a very simple editor called
pluma. Of these,
pluma are the
easiest to pick up, so if you don't already know
vim you should
choose one of these. All these editors feature syntax coloring for source code,
which is very helpful.
To start up e.g.
geany, type this in a terminal:
$ geany &
Then the editor window will pop up. (The
& is so you can continue to type
commands into the terminal while
geany is running.) If you have a file you
want to edit, you can do this from the terminal:
$ geany myfile.c &
And the file will be loaded into
geany when it starts. Alternatively, you
can load it from the commands in the
To get out of the VM, select "Quit" from the VM menu and click on "Shutdown". This will exit the VM.
OK! Now you are all set up. If things didn't work out as described above, see a TA.