Project

General

Profile

Ubuntu VM

Virtual Machines require system resources to run. If you are going to setup a vm on a server, make sure that the administrators of the machine support this use.

vagrant

configure vbox

  • vagrant creates VirtualBox instances
  • By default, any boxes you create are put into your home directory at $HOME/"VirtualBox VMs"
    • If you are working on your own machine (e.g., your laptop), this is fine.
    • However, if you are working on a server, this is not recommended.
  • use vboxmanage to check and define the vbox machinefolder.
    vboxmanage list systemproperties
    (see current settings)
    vboxmanage setproperty machinefolder /<some scratch directory>/VirtualBox
    vboxmanage list systemproperties
    (see the change)
    
    • If you have an existing vagrant box, you will need to destroy and recreate it.
    • These settings are defined on a per user basis.
  • alternatively, redefine VAGRANT_HOME in $HOME/.bashrc
    • This puts everything under the scratch directory
              # Configure vagrant directory outside backed-up space.
              if [[ -d "/scratch/$USER" ]]; then
                export VAGRANT_HOME="/scratch/$USER/.vagrant.d" 
              elif [[ -d "$HOME/scratch" ]]; then
                export VAGRANT_HOME="$HOME/scratch/.vagrant.d" 
              fi
      

setup vagrant

  • git clone http://cdcvs.fnal.gov/projects/ubuntu-vm (this project)
    • Ubunutu LTS 14 files are in the u14 subdirectory
    • Ubunutu LTS 16 files are in the u16 subdirectory
  • make a directory somewhere else for your new vagrant instance
  • copy the appropriate bootstrap.sh and Vagrantfile to your new directory
  • cd to this new directory
  • vagrant up
    • This is going to take a while the first time you do it.

using vagrant

  • vagrant ssh
    • this will put you inside your vagrant box
    • your username will be "vagrant"
  • logout or exit
    • to leave the vagrant box and return to your login shell
  • vagrant boxes are meant to be easily destroyed and rebuilt. If you need to keep copies of some files, please make sure they are stored outside the box.
  • Files in your vagrant directory (where you type "vagrant ssh") are visible inside the vagrant box at /vagrant.
  • Once you have typed "vagrant up", there is a vagrant process for each box running on your machine. "vagrant halt" will stop this process for your box.

Kerberos

  • Ubuntu has two kerberos packages. If you wish to interact with Fermi Kerberos, install krb5-user.
    vagrant ssh
    sudo apt-get install krb5-user
    (when asked, set the default realm to FNAL.GOV)
    
  • By default, credentials will not be forwarded when using ssh or scp. Add the following to the "Host *" block in /etc/ssh/ssh_config:
        Protocol 2
        GSSAPIAuthentication yes
        GSSAPIDelegateCredentials yes
        GSSAPIKeyExchange yes
    

Known Vagrant Problems

Ubuntu release versions

Ubuntu ups flavors

  • Ubuntu LTS 14
    • lts-vivid for the 3.19 kernel
    • ups flavor Linux64bit+3.19-2.19
  • Ubuntu LTS 16
    • lts-xenial for the 4.4 kernel
    • ups flavor Linux64bit+4.4-2.23
  • use ups override to set the flavor if necessary
    • set an environmental variable
      • export UPS_OVERRIDE="-H Linux64bit+3.19-2.19"
    • or make an override file
      • echo "-H Linux64bit+3.19-2.19" > <product_directory>/ups_OVERRIDE.`hostname`
      • You must source <product_directory>/setup if you choose this option.

The vagrant Ubuntu 14 kernel

  • The Ubuntu LTS 14 kernel is 3.13. All vagrant installs will be using 3.13.
    • However, other Ubuntu 14 installs may use 3.13, 3.16, or 3.19.
    • Software distributions for Ubuntu 14 from SciSoft are built with the 3.19 kernel.
  • To upgrade a vagrant box, first enable updates of the vagrant tools.
     vagrant plugin install vagrant-vbguest
    • This will install the plugins locally so they can be updated automatically.
    • If you do not do this step, you will have HGSF errors, and may not be able to recover.
  • Now upgrade the kernel
    vagrant ssh
    sudo apt-get install --install-recommends linux-generic-lts-vivid
      (vivid is 3.19)
      Answer y to the prompt.
      When the update is complete exit vagrant because you still need to "reboot".
    vagrant reload --provision
    

Ubuntu LTS 16

  • Ubuntu LTS 16 comes in cloud, server, and desktop distributions.
  • The "official" Ubuntu LTS 16 image is for the cloud and seems to have timeout issues.
  • Instead, use the boxcutter image
    • vagrant init boxcutter/ubuntu1604
    • edit Vagrantfile to use bootstrap.sh
    • vagrant up --provider virtualbox
  • Kerberos
    • sudo apt install krb5-user
    • domain: FNAL.GOV

VBox

  • download a desktop ubuntu image (iso file) from http://www.ubuntu.com/
  • Using the VirtualBox gui, select Linux and Ubuntu 64bit.
  • Select a reasonable disk size
  • Check the settings, paying attention to memory, video memory, and number of cpus
    • enable 3D video acceleration
  • start the box
    • select the iso install file
    • follow the on screen instructions
  • Unless care is taken, you may have the latest LTS kernel instead of the kernel supported for ups product builds.
  • Kerberos
    • sudo apt install krb5-user
    • domain: FNAL.GOV