layout | title | nav |
---|---|---|
default |
Course-VM |
course-vm |
If you are having trouble installing the Virtual Machine you should scroll down to the Other Options section
While you are welcome to install a C++ compiler or integrated development environment natively on your system, or work remotely on aludra.usc.edu (which we consider rather inconvenient), we strongly encourage you to use the Ubuntu virtual machine (VM) specifically provided for this class. The VM that we use is a customized Ubuntu LTS installation that comes with the most recent C++ compiler, libraries, and debuggers. You can install it on your laptop regardless of your operating system, and use it for the entire semester for labs and homework assignments. We will grade everything on this VM's compiler version and environment so it is critical you check your code on this system before submitting. All C++ compilers are NOT the same. The code you write on Visual Studio or XCode (common Windows and Mac development environments) may not run the same way on another system.
- To run this virtual machine you will need to download Oracle VirtualBox. Download version 5.0
- After installing VirtualBox, download and install the extension pack, available on the same downloads page.
- Next download the virtual machine image. We recommend using 'curl' which is already installed on Mac and Linux machines. (A Windows version is available here.) 'curl' is a command line utility to download files from the Internet. Go to a folder where you want to download the file and start a command prompt (Windows) or Terminal there. Then run the command
curl http://bits.usc.edu/files/cs103/install/student-vm-2015.ova -o student-vm-2015.ova
- Alternatively, the actual link is available here. Using curl is recommended because browser downloads might disconnect unexpectedly.
- [Optional] You can also try using an FTP client, which will support resuming stopped downloads. For example you can download the FileZilla FTP client from https://filezilla-project.org/download.php?type=client Once installed, connect to host "bits.usc.edu" and inside the "cs103" folder, inside its "install" subfolder, download the ova file.
- Start Virtual Box and choose File...Import. Then select the Ubuntu Virtual Machine (student-vm-2015.ova) you downloaded. Use the default import options.
- Adjust the settings of your VM
- Adjust the appropriate amount of base memory. Everything has to be in the green zone:
- Make sure the VM has at least 2 CPU cores allocated. You can adjust this later to get the best results.
- Turn 3D Acceleration ON.
- Now lick on the Course VM option that now appears in VirtualBox's list and select Start/Run. This will start the VM and bring you to a logon message. (Answer yes or default answer to any dialog box that appears).
- If you encounter errors starting your VM go to the Troubleshooting Section and then resume these directions.
- Finishing the setup
- Login with the credentials: username: student password: developer
- Hit Ctrl-Alt-T to start a terminal window where you can type in commands
- Install the Virtual Box Guest Additions as detailed in the Do's and Dont's Section
- Pick and setup a method to backup your files as detailed in the Do's and Dont's Section
- If you haven't worked with Linux, check out a Linux tutorial such as this one (Tutorials 1-6) or possibly this one.
- For starters, work through this tutorial. Start from the beginning and continuing through pointers. Write down any questions or unclear statements. We can discuss them at the beginning of the semester. Also, I have made lecture videos on most of these topics available at this CS Modules Site. Please be sure you know the material covered in the first 3 modules (C++ Introduction and Control Structure and Functions) before coming to class. See the next section for details
- When you shutdown your VM NEVER "Save the State" of the machine but instead "Power off" the machine or send the "Shutdown Signal"
- In your Linux VM do NOT install any updates or upgrades to the OS or other source if it prompts you. Just use the VM as it is.
- DO install the “Guest Additions” to your Linux VM. This will allow you resize the resolution/window and also support shared folders between your Host and Guest OSs. To do this, start your VM and click the Devices Menu..Install Guest Additions. You may have to enter your password (“developer”) or hit ‘Enter’ once or twice, but other than that it will just run and take a few minutes. When complete it will say “Hit Enter to close the window”. At this point restart your VM and everything should be working.
- DO find a way to back up your code on the VM. This is not as important, because you will learn how to use git, a version control system, to maintain and save your code. That will automatically act as a reliable backup option, if used correctly. However, here are alternatives:
- Shared Folders. You can use the shared folders feature that is part of the VirtualBox service. Follow these steps to create a shared folder in VirtualBox. (note: “guest” or “VM” means the Linux box that you run your code on, while “host” means the system that you normally run.)
- Make sure that "Guest Additions" is installed.
- Make a folder called “cs104_files” somewhere on your host machine.
- Open VirtualBox and open the settings for the VM.
- Click on the “shared folders” button.
- Click the somewhat-obscure folder with a green + on it to add a shared folder to the list choosing . In the Folder Path box browse to the folder on the host that you want to share/make available (i.e. the “cs104_files” you just created). The Folder Name will automatically populate with the folder you just chose. Make sure “Auto-mount” is checked.
- Press OK.
- Open up the VM.
- Open a Terminal window.
- Type
sudo usermod -a -G vboxsf student
. This gives student the permission to access shared folders. - Type
ln -s /media/sf_cs104_files cs104_files
. This creates a new alias in the current folder to where the shared folder was mounted. - From here you can treat cs104_files just like any other folder on your linux guest.
- Shared Folders. You can use the shared folders feature that is part of the VirtualBox service. Follow these steps to create a shared folder in VirtualBox. (note: “guest” or “VM” means the Linux box that you run your code on, while “host” means the system that you normally run.)
- If you're VM can't connect to the Internet but your host PC can, just restart the VM. It is common for the VM to have trouble connecting if you leave it open when you put your laptop to sleep, etc. Simply rebooting the VM usually reconnects to the network.
- In the "Settings" menu, if there is a sign at the bottom of the window that reads "non-optimal", it means you have chosen a wrong setting. Hover your mouse over the warning message to get the details.
- The error “Failed to install NtCreateSection monitor” on Windows can be due to a known bug. Try downloading the test build here.
- Error “VT-x features locked or unavailable in MSR”: You need to enable Virtualization for your laptop. If you don’t do this, Ubuntu won’t be able to take advantage of all your CPU power. Usually virtualization is disabled by default on PC laptops and enabled by default on Mac laptops. Here is how to enable it on Windows:
- Enter the bios settings. This is different from laptop to laptop so you have to Google it and find the instruction for your make and model. For example something like this “Laptop HP dv6 bios virtualization”. Usually, you have to keep pressing F2, F10, or something similar at the very beginning of your laptop power on. This is before Windows starts.
- Find the “Virtualization” setting in the sub menus and set it to “ON” or “Enable”.
- Save and Exit.
- Older laptops might not have a virtualization option. In that case switch back to single-core VM.
- If problems still persist, try uninstalling VirtualBox 4.3.18 in favor of an older version 4.3.12 or 4.3.14 (start with 4.3.12) available at the Older Build Site. Once you've uninstalled 4.3.18 and reinstalled 4.3.12 or 14, then re-import the VM image (course-vm-2014.ova)
- If you can't connect to the Internet from your VM, simply try rebooting the VM (not your whole PC). When the wireless connection changes the VM seems to be unable to pick up the new connection w/o a reboot.
- Boot to Windows (not Mac)
- Find the VirtualBox icon on the desktop and start the application (not Mac)
- Many of these machines already have the student-vm imported and ready to run so that you can just start the VM and use it
- If the student-vm is not already imported you may do so by clicking File..Import Appliance. Then click the browse folder icon to go find the .ova file. Browse to
Computer\C:\CS VM\student-vm-2015.ova
Then click import. - Once the appliance is imported you can start it and use it
- You may need to create a .ssh key and register it on Github for that VM (similar to what you did in Lab 1). At that point you can
clone
your repository, edit and add files, commit your work and then push it back. Note that your files will not be saved from one session to the next on the VM...so please commit to github each session that you use the VM