Installation Instructions: Go Virtual Machine
Programming Language Paradigms
Requirements
To install and configure the Go virtual machine for PLP, you will need:
-
2GB of RAM
-
8GB of free disk space
Installing VirtualBox
-
Go to the downloads page for VirtualBox.
-
Select and save the binary installer for your platform (direct links for Windows, Mac). Note: The installer should be around 75MB for most platforms. These files are hosted off campus. We are not using VirtualBox Open Source Edition.
-
Run the installer, accepting all default installation options.
-
If you are on Windows, there will be a warning about installing network interfaces; you must accept this warning to install, and you will be temporarily disconnected from the network during the process.
-
If you are on Windows Vista or Seven, you will likely also encounter popups from UAC about virtual device drivers; accept them all. (I got four warnings on a vanilla Seven host.)
Installing the Ubuntu appliance
-
Download the two files that are necessary to build the Go virtual machine (both hosted on campus):
-
The virtual appliance file, which contains VirtualBox settings and information necessary to create the VM (about 13K)
-
The virtual disk file, which acts as the hard drive for the virtual machine (about 1.2G)
Be sure to download these two files to the same directory, and do not change the file names.
-
Open VirtualBox
-
Click File → Import Appliance... to open the Appliance Import Wizard
-
On the first page, click Choose..., select the PLP-Ubuntu-Go.ovf file downloaded above, and click Next
-
On the next page, simply click Finish
-
VirtualBox will import the plp-ubuntu-go.vmdk disk file into its installation directory. Just wait for this process to finish.
-
The virtual machine should now be ready to run. As downloaded, the VM contains:
-
A 32-bit install of Ubuntu 10.10 Maverick Meerkat (Note: very few settings have been changed, so performing updates will count against your bandwidth)
-
VirtualBox Guest Additions for Ubuntu
-
The build-essential package and all its dependencies, for a complete C environment
-
Subversion and the Linux GUI client RapidSVN
-
Mercurial, a distributed source control system
-
gVim and emacs, a pair of graphical text editors
-
And of course Go itself, in the ~/go directory
Your shortname for the installation is gouser and the password (for sudo purposes) is gopass.
-
Once the appliance is fully imported, launch the virtual machine by clicking Start
Hello, Go
A basic "Hello, World" program has been provided inside the Documents folder in your home directory. This section walks you through compiling and running that file.
-
Open a Terminal window from the console icon in the taskbar.
-
Navigate to your Documents folder: cd Documents
-
Compile, link, and run the Go source file (yes, compile and link are two separate steps):
$ 8g hello.go
$ 8l hello.8
$ ./8.out hello, world
Machine Configuration
At this point, your VM should be ready to Go. However, it will be more convenient if you have network access from your VM. Follow these steps to set that up:
-
Every user who installs the appliance has the exact same configuration off the bat; you should change the password for gouser. To do that, click System → Administration → Users and Groups. Then next to Password, click Change…. Remember, the current password is gopass.
-
On my Mac, I added VirtualBox to the list of applications that can receive incoming connections. To do that, go to System Preferences → Security → Firewall → Advanced…. From there, click the [+] button and add VirtualBox to the list.
-
I had to tweak a couple of settings to get DNS to work. (DNS is the protocol that converts domain names to IP address.) Not being on the Rose network currently, I can't say for sure whether these changes are necessary.
Check to see if DNS works on your VM as follows:
-
Open a Terminal window.
-
Run the command nslookup google.com
-
If you get back an IP address, great! Your DNS is working. If not, try this command: nslookup google.com 8.8.8.8. That tells nslookup to use a specific nameserver, in this case one of Google's own.
-
If using Google's name server worked, then you can tweak your VM configuration to always use it like so:
-
Click System → Administration → Network Tools
-
Choose Network Device: Ethernet Interface and click the Configure… button
-
Click Auto eth0 and then click Edit…
-
Go to to IPv4 Settings tab, change the Method to Automatic (DHCP) addresses only, and the DNS Servers to 8.8.8.8, 8.8.4.4.
-
Click Apply… and enter your VM password to apply the changes.
-
You may need to restart the VM to get the changes to take effect. (Linux gurus would use other tricks here, but a restart will work.)
-
Try nslookup google.com again. It should work now, as should Firefox and the SVN client (Applications → Programming → RapidSVN).
-
If using Google's name server did not work, then please seek help from classmates. You should still be able to work on Go without network access from your VM, but it will be much more convenient if you can get it working.
-
Warning for gurus: The VM defaults to attaching to the network via NAT, which is suboptimal for some things. However, if you want to change the adapter settings to use bridging or another connection method, you must change the hostname of the machine first; otherwise you may encounter hostname conflicts with other VM users.