User Tools

Site Tools


vm:headless

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
vm:headless [2019/01/09 10:51]
borja created
vm:headless [2020/04/25 20:16] (current)
borja
Line 1: Line 1:
 ====== Headless VM setup guide ====== ====== Headless VM setup guide ======
  
-1. Clone your class repository to somewhere on your local machineFrom now on in this guiderefer to this directory location ​as ''​REPO_ROOT''​.+1. Download the latest version of VirtualBox (https://​www.virtualbox.org/​wiki/​Downloads). **NOTE**: Even if you have VirtualBox already installed, it's important that you follow ​this step, as there was recently a major version release that changed the interface.
  
-2. Download ​the latest version of VirtualBox (https://​www.virtualbox.org/​wiki/​Downloads). **NOTE**: Even if you have VirtualBox already installedit's important that you follow this step, as there was recently a major version release that changed ​the interface.+2. From the same pagedownload ​the VirtualBox Extension Pack.
  
-3. From the same pagedownload ​the VirtualBox ​Extension Pack.+3. Install VirtualBoxthen double-click on the Extension Pack, and VirtualBox will prompt you to install it.
  
-4. Install ​VirtualBox, ​then double-click on the Extension Pack, and VirtualBox will prompt you to install it.+4. Open VirtualBox, click the menu across from "​Tools"​, and select "​Network"​.
  
-5. Open VirtualBox, click the menu across from "Tools", and select "​Network"​.+5. Click "Create" ​in the top left, and verify that the new network is called ''​vboxnet0'',​ and that the IP is ''​192.168.56.1/​24''​.
  
-6. Click "​Create"​ in the top left, and verify that the new network is called ''​vboxnet0'',​ and that the IP is ''​192.168.56.1/24''​.+6. Download ​the UChicago CS VM (https://​howto.cs.uchicago.edu/vm:index). This is a fairly large download - should take about 10 minutes on the UChicago network.
  
-7. Download ​the UChicago CS VM (https://​howto.cs.uchicago.edu/​vm:​index). This is a fairly large download - should take about 10 minutes on the UChicago network.+7. In VirtualBox, choose File -> Import Appliance, and then find and select ​the .ova file you downloaded in step 6You can leave all the options at their defaults.
  
-8. In VirtualBox, choose File -> Import Appliance, and then find and select the .ova file you downloaded in step 6You can leave all the options at their defaults.+8. Right click on the VM's entry in the VirtualBox ​sidebar, and click "​Settings..."
  
-9. Right click on the VM's entry in the VirtualBox sidebar, and click "Settings..."+9. Under "​Network"​ -> "​Adapter 2", select "​Enable Network Adapter"​. Then, select "​Host-only Adapter"​ for the "​Attached to" field, and make sure that "vboxnet0" ​is selected for the "​Name"​ field.
  
-10. Under "​Network"​ -> "​Adapter 2"select "​Enable Network Adapter"​Then, select "​Host-only Adapter" ​for the "​Attached ​to" field, and make sure that "​vboxnet0"​ is selected for the "​Name"​ field.+10. Since you will be running this VM in headless modewe will be setting up a *shared folder* on your computer that you will be able to access from inside the VMSelect a directory on your computer ​for this purpose; we will refer to it as ''​SHARED_DIR''​ from this point onwards.
  
-11. Under "​Shared Folders",​ click the blue folder icon with the green plus icon on the right hand side. Under "​Folder Path" select "​Other",​ navigate to ''​REPO_ROOT'',​ and click "​Open"​ in the bottom right. For "​Folder Name", enter the name of your class. From now on, this location will be referred to as ''​REPO_SHARED_NAME''​. Then, select "Auto-Mount" and click "​OK",​ and then "​OK"​ again.+In VM's setting, under "​Shared Folders",​ click the blue folder icon with the green plus icon on the right hand side. Under "​Folder Path" select "​Other",​ navigate to ''​SHARED_DIR'',​ and click "​Open"​ in the bottom right. For "​Folder Name", enter the name ''​vbox-shared''​. Then, select "Make Permanent" ​(if available - it sometimes doesn'​t show up, that's okay too) and click "​OK",​ and then "​OK"​ again.
  
-12. Start the VM and log in.+11. Start the VM and log in. The password is ''​uccs''​.
  
-13. In the VM, launch a terminal and run the following commands:+12. In the VM, launch a terminal and run the following commands:
  
   $ sudo adduser student vboxsf   $ sudo adduser student vboxsf
Line 38: Line 38:
  
   $ nmcli con mod "​INTERFACE_NAME_HERE"​ ipv4.method "​manual"​ ipv4.addresses "​192.168.56.101/​24"​   $ nmcli con mod "​INTERFACE_NAME_HERE"​ ipv4.method "​manual"​ ipv4.addresses "​192.168.56.101/​24"​
 +
 +13. Run the following command:
 +
 +  $ sudo nano /etc/fstab
 +
 +This will open up your system'​s volume mounting configuration. At the bottom of the file, add the following line:
 +
 +  vbox-shared /​media/​vbox-shared vboxsf gid=1000,​uid=1000
 +
 +Then, to quit nano, press ''​Ctrl+x'',​ then press ''​y'',​ then press ''​Enter''​.
  
 14. Shut down the VM (click the gear icon in the top right, and click "Shut Down"​). 14. Shut down the VM (click the gear icon in the top right, and click "Shut Down"​).
Line 54: Line 64:
 Then, to quit nano, press ''​Ctrl+x'',​ then press ''​y'',​ then press ''​Enter''​. Then, to quit nano, press ''​Ctrl+x'',​ then press ''​y'',​ then press ''​Enter''​.
  
-15. In VirtualBox, right click on the VM and choose "​Start"​ -> "​Headless Start"​.+16. In VirtualBox, right click on the VM and choose "​Start"​ -> "​Headless Start"​.
  
-16. Wait ~15s for the VM to start up fully. Then, in a terminal on your local machine, run:+17. Wait ~15s for the VM to start up fully. Then, in a terminal on your local machine, run:
  
   ​   ​
   $ ssh cs-vm   $ ssh cs-vm
  
-17. Once you're logged in, you'll see the prompt change to something like ''​student@cs-vm:​~$ ''​. Then, run the following commands:+18. Once you're logged in, you'll see the prompt change to something like ''​student@cs-vm:​~$ ''​. Then, run the following commands:
  
-  $ git config --global core.fileMode false 
-  $ ln -s /​media/​sf_REPO_SHARED_NAME ~/​REPO_SHARED_NAME 
-  $ cd REPO_SHARED_NAME 
-  $ chisubmit init 
  
-Be sure to replace ''​REPO_SHARED_NAME''​ with the appropriate name. For example, if you named your shared ​folder ''​cs233'',​ you would run:+  $ ln -s /​media/​vbox-shared ~/vbox-shared
  
-  ​ln -s /​media/​sf_cs233 ~/cs233+ 
 +19. If you will be accessing a Git repository from inside the VM, you should also run the following commands: 
 + 
 +  ​git config ​--global core.fileMode false 
 +  $ git config --global push.default simple 
 +  $ git config --global credential.helper store 
 +  $ git config --global user.email "​YOUR_UCHICAGO_EMAIL_HERE"​ 
 +  $ git config --global user.name "​YOUR_FULL_NAME_HERE"​
  
  
Line 76: Line 89:
  
   * Edit code on your local machine in your preferred editor. For example, if you like using Sublime Text on your Mac, you can use that by opening ''​REPO_ROOT''​ in sublime text.   * Edit code on your local machine in your preferred editor. For example, if you like using Sublime Text on your Mac, you can use that by opening ''​REPO_ROOT''​ in sublime text.
-  * Test code inside the VM, without launching the full GUI and suffering through its slowness. You'll do this by launching the VM in headless mode as described earlier, and running ''​ssh cs-vm''​ from your local machine. The ''​~/​REPO_SHARED_NAME''​ folder on your VM will mirror the ''​REPO_ROOT''​ folder on your local machine, exactly and instantly.+  * Test code inside the VM, without launching the full GUI and suffering through its slowness. You'll do this by launching the VM in headless mode as described earlier, and running ''​ssh cs-vm''​ from your local machine. The ''​~/​vbox-shared''​ folder on your VM will mirror the ''​REPO_ROOT''​ folder on your local machine, exactly and instantly.
/var/lib/dokuwiki/data/attic/vm/headless.1547052662.txt.gz · Last modified: 2019/01/09 10:51 by borja