- You will need to be connected to the internet. Install VirtualBox 5.0 or later if you haven't already.
- Download the Ubuntu 16.04.1 LTS 64-bit server ISO file from http://releases.ubuntu.com/16.04.1/ubuntu-16.04.1-server-amd64.iso
- Open VirtualBox. Create a virtual machine.
- Call it "Hack Oregon Base v2".
- Set the operating system to Ubuntu 64.
- Set the memory to 1024 MiB.
- Create a 32 GB dynamically allocated VDI disk.
- Open the 'Settings' wizard.
- Under 'System', change the pointing device to 'PS/2 mouse'.
- Under 'Audio', uncheck 'Enable Audio'.
- Under 'USB', uncheck 'Enable USB Controller'.
- Go to the 'Storage' settings.
- Click on the empty CD drive and point it to the Ubuntu server ISO file you downloaded. "Live CD" should be cleared.
- Click on the SATA controller. Make sure "Use Host I/O Cache" is cleared. I had mysterious installation failures with this option set!
- Close the Settings wizard.
- Start the virtual machine. When it comes up you'll be in a text-based installer. In most cases, you'll be able to accept the defaults.
- Accept all the defaults till you get to the host name screen.
- Call the machine 'hackoregon-base-v2'.
- Set the user full name to 'Hack Oregon'.
- Set the username to 'vagrant'.
- Set the password to 'ORturkeyeggs'.
- Do not encrypt your home directory.
- Set the time zone.
- When you come to the 'Partition disks' step, select 'Guided - use entire disk'.
- There's only one disk to select, so select it.
- When it asks to write the changes to disk, say 'Yes'.
- The installer will start again. Accept the defaults until you come to 'Software selection'. Select both 'standard system utilities' and 'OpenSSH server'.
- The installer will start again. Accept the defaults until the install is complete. Then select 'Continue' to reboot the virtual machine.
- When the virtual machine comes up, log in on the console as 'vagrant'.
- Enter
sudo shutdown -h now
to power off the virtual machine. The virtual machine will shut down. - You now have a Ubuntu 16.04.1 LTS server virtual machine!
-
Start the virtual machine.
-
When the virtual machine console shows a login prompt, log in as 'vagrant'.
-
Enter
sudo visudo
. Enter the 'vagrant' password when 'sudo' asks for it. Then add the linevagrant ALL=(ALL:ALL) NOPASSWD: ALL
to the bottom of the file. Then press
Control-O
,Enter
andControl-X
to save the file. 'sudo' will no longer ask you for a password! -
Enter
git clone https://github.com/hackoregon/getting-started
. -
Enter
cd getting-started/datascience/linux-laptop-setup
. -
Enter
git checkout <working branch>
. -
Enter
./0update-upgrade
. This will upgrade all packages to the latest versions and will take some time. -
Reboot the virtual machine with
sudo reboot
. -
When the virtual machine is back up, log back in again.
-
Enter
cd getting-started/datascience/linux-laptop-setup
. -
Enter
./all-services
. This is a master script that will run./1core
. This will install the core packages for all users../database-gis-services
. This installs PostgreSQL and PostGIS for all users on the virtual machine. It will add 'vagrant' as a database super-user../data-science-services
. This will install Miniconda and the data science environment for the 'vagrant' user../install-guest-additions
. This will install the VirtualBox guest additions. Follow the on-screen instructions. You do not need to reboot../vagrantize
. This will prepare the virtual machine for use as a Vagrant box. Follow the on-screen instructions.
-
Shut the virtual machine down with
sudo shutdown -h now
.
This procedure is optional but highly recommended.
- Open the VirtualBox GUI, go into the "Storage" settings and connect the ISO file for an Ubuntu 16.04.1 LTS desktop. I use Linux Mint 18, but any desktop will work as long as it's based on Ubuntu 16.04.1 LTS.
- Start the virtual machine. It will come up in the live system's desktop, not in the server you just installed.
- Open a terminal. Enter
sudo apt install zerofree
. - Enter
sudo zerofree -v /dev/sda1
. This will fill all the unused blocks in the virtual disk with zeroes, resulting in a smaller image when compacted. It will take some time. - Shut the virtual machine down with
sudo shutdown -h now
and remove the virtual CD from the drive in the 'Storage' settings. - In the host command line, enter
VBoxManage list hdds
. You will see a hard disk with a random-looking "UUID" string. Copy this string into the clipboard. - Enter
VBoxManage modifyhd --compact <paste the UUID here>
. This will also take some time.
Reference: https://www.vagrantup.com/docs/virtualbox/boxes.html
- Open a host terminal and
cd
to the directory where you want to store the finished Vagrant 'box' file. Entervagrant package --base "Hack Oregon Base v2" --output hackoregon-base-v2.box
. This will take some time. - Enter
vagrant box add --name hackoregon-base-v2 hackoregon-base-v2.box
. - Enter
vagrant init hackoregon-base-v2
. This will create a Vagrantfile. - Edit the Vagrantfile and add the port forwarding: guest port 8888 to host localhost port 7777.
- Enter
vagrant up --provision
.
The final step is to export the virtual machine as an Open Virtualization Format (OVF) archive so you can share it with other people.
- Set up port forwarding. In the VirtualBox GUI, select the 'Hack Oregon Base v2' virtual machine and start the 'Settings' wizard. Select 'Network' and then 'Advanced'. Press the 'Port Forwarding' button.
- Add a rule for SSH: 'SSH' in the 'Name' field, '127.0.0.1' in the 'Host IP' field, '2222' in the 'Host Port' field. Leave the 'Guest IP' field empty and put '22' in the 'Guest Port' field.
- Add a rule for Jupyter: 'Jupyter' in the 'Name' field, '127.0.0.1' in the 'Host IP' field, '7777' in the 'Host Port' field. Leave the 'Guest IP' field empty and put '8888' in the 'Guest Port' field.
- Go into the VirtualBox 'File' menu and select 'Export Appliance'. You will see your Hack Oregon Base virtual machine listed. Select it; if you have any others make sure they are not selected. Then press 'Next'.
- Use OVF 2.0 and make sure the exported file extension is '.ova'. Check the 'Write Manifest File' box. Make a note of where VirtualBox is going to store the file! Then press 'Next'.
- Keep the defaults for the 'Appliance settings' screen and press the 'Export' button. The export will start. You'll get a progress window. It can take quite a while to complete the export!