Preparing VirtualBox images: Difference between revisions

From genomewiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
Start with a fresh Ubuntu 13.04 image, call the main user "browser".
Start with a fresh Ubuntu 14.04 image, call the main user "browser".


   apt-get install localepurge zerofree
   apt-get install localepurge zerofree
Line 7: Line 7:
   # which package contains the psxy tool?
   # which package contains the psxy tool?
    
    
   apt-get remove python3* linux-headers* aptitude man-db perl perl-modules geoip-database language-pack-gnome-en-base manpages ppp acpi iso-codes console-setup dmidecode eject ethtool initramfs-tools pciutils usbutils command-not-found alpine-doc python3.3-minimal apparmor  
   apt-get remove python3* linux-headers* aptitude man-db perl perl-modules geoip-database language-pack-gnome-en-base manpages ppp acpi iso-codes console-setup dmidecode eject ethtool initramfs-tools pciutils usbutils command-not-found alpine-doc python3.3-minimal apparmor linux-firmware
   # wanna remove more? show packages by size: dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n
   # wanna remove more? show packages by size: dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n
   apt-get install apache2 mysql-server mysql-client
   apt-get install apache2 mysql-server mysql-client
Line 15: Line 15:
Now install the genome browser:
Now install the genome browser:


   wget http://hgwdev.soe.ucsc.edu/~max/gbInstall/ubuntu.sh
   wget http://hgwdev.soe.ucsc.edu/~max/gbInstall/installBrowser.sh
   sudo bash
   sudo bash
   source ubuntu.sh
   source installBrowser.sh


We need the guest extensions for shared folders:
We need the guest extensions for shared folders:


on the host:
on the virtualbox host attach the guest extension ISO from http://download.virtualbox.org/virtualbox/4.3.8/ (or rather try the most current version matching your Vbox):
   VBoxManage storageattach "browserbox" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "/cluster/home/qateam/VirtualBox VMs/VBoxGuestAdditions_4.3.8.iso"
   VBoxManage storageattach "browserbox" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "/cluster/home/qateam/VirtualBox VMs/VBoxGuestAdditions_4.3.8.iso"


Line 30: Line 30:
   ./VBoxLinuxAdditions.run
   ./VBoxLinuxAdditions.run
   modinfo vboxguest # check if they work
   modinfo vboxguest # check if they work
   # now save some space, remove the kernel module build system  
   # now to save some space, remove the kernel module build system  
   sudo apt-get remove build-essential linux-headers*
   sudo apt-get remove build-essential linux-headers*
   apt-get clean
   apt-get clean
Line 38: Line 38:
   sudo addgroup vboxsf
   sudo addgroup vboxsf
   sudo adduser browser vboxsf
   sudo adduser browser vboxsf
  sudo wget http://hgwdev.soe.ucsc.edu/~max/gbInstall/rc.local -O /etc/rc.local
Copy the various files from kent/src/browserbox to their respective locations. This is explained in kent/src/browserbox/README.txt. Some more details are in kent/src/browserbox/root/changes.txt
 
Ask Hiram to install the trash cleaner.


Once you're finished with everything ubuntu related, you can free 120 MB:
Once you're finished with everything ubuntu related, you can free 120 MB:
Line 46: Line 49:
   sudo cleanVm
   sudo cleanVm


Now zero the disk image:  
Zero the disk image:  
   sudo /root/zeroVm # this unfortunately does not work. You need to reboot in single-user mode and run it as root there
   sudo /root/zeroVm # this unfortunately does not work. You need to reboot in single-user mode and run it as root there
To show the IP address on startup, only necessary in bridged mode:
  sudo wget http://hgwdev.soe.ucsc.edu/~max/gbInstall/show-ip-address -O /etc/network/if-up.d/show-ip-address
  sudo chmod a+x /etc/network/if-up.d/show-ip-address


Leave VirtualBox, shutdown the VM, go to a command line on the host, find the .VDI or VMDK file(s) and compact it:
Leave VirtualBox, shutdown the VM, go to a command line on the host, find the .VDI or VMDK file(s) and compact it:
Line 63: Line 61:
Have a quick look into the .vbox file and make sure that it doesn't list any iso images or other disk images that you attached once to the disk but don't need anymore. They trigger error messages on new host machines.
Have a quick look into the .vbox file and make sure that it doesn't list any iso images or other disk images that you attached once to the disk but don't need anymore. They trigger error messages on new host machines.


If you see one, get its UUID first:
If you see a disk that is still attached (e.g the guest install iso), get its UUID first:
   VBoxManage list hdds
   VBoxManage list hdds
   VBoxManage list dvd
   VBoxManage list dvd
Line 72: Line 70:
   VBoxManage closemedium dvd <paste uuid here>
   VBoxManage closemedium dvd <paste uuid here>


Most of the UUID/zipping business is now automated with a script, in the qa user:
the box release business is now automated with a script, in the qa user:
   boxRelease.sh
   boxRelease.sh

Revision as of 10:41, 6 October 2014

Start with a fresh Ubuntu 14.04 image, call the main user "browser".

 apt-get install localepurge zerofree
 # I think we don't need these packages... saves around 300MB 
 apt-get install alpine acpi-tools gpm 
 apt-get install libgomp1 # for rnaplot
 # which package contains the psxy tool?
 
 apt-get remove python3* linux-headers* aptitude man-db perl perl-modules geoip-database language-pack-gnome-en-base manpages ppp acpi iso-codes console-setup dmidecode eject ethtool initramfs-tools pciutils usbutils command-not-found alpine-doc python3.3-minimal apparmor linux-firmware
 # wanna remove more? show packages by size: dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n
 apt-get install apache2 mysql-server mysql-client
 # consolkit keeps / open which is annoying for zerofill, acpi-tools doesn't really need I hope
 sudo dpkg -r --force-depends consolekit

Now install the genome browser:

 wget http://hgwdev.soe.ucsc.edu/~max/gbInstall/installBrowser.sh
 sudo bash
 source installBrowser.sh

We need the guest extensions for shared folders:

on the virtualbox host attach the guest extension ISO from http://download.virtualbox.org/virtualbox/4.3.8/ (or rather try the most current version matching your Vbox):

 VBoxManage storageattach "browserbox" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "/cluster/home/qateam/VirtualBox VMs/VBoxGuestAdditions_4.3.8.iso"

on the guest:

 apt-get install linux-headers-3.13.0-24-generic build-essentials dkms  # replace 3.13.0-generic with your kernel version, show with uname -a
 mount -t iso9660 -o ro /dev/cdrom /mnt
 cd /mnt   
 ./VBoxLinuxAdditions.run
 modinfo vboxguest # check if they work
 # now to save some space, remove the kernel module build system 
 sudo apt-get remove build-essential linux-headers*
 apt-get clean
 apt-get autoremove # this should get rid of gcc, etc
 

It's nice to have shared folders:

 sudo addgroup vboxsf
 sudo adduser browser vboxsf

Copy the various files from kent/src/browserbox to their respective locations. This is explained in kent/src/browserbox/README.txt. Some more details are in kent/src/browserbox/root/changes.txt

Ask Hiram to install the trash cleaner.

Once you're finished with everything ubuntu related, you can free 120 MB:

 sudo wget http://hgwdev.soe.ucsc.edu/~max/browserbox/cleanVm
 chmod a+x cleanVm
 sudo cleanVm

Zero the disk image:

 sudo /root/zeroVm # this unfortunately does not work. You need to reboot in single-user mode and run it as root there

Leave VirtualBox, shutdown the VM, go to a command line on the host, find the .VDI or VMDK file(s) and compact it:

 vboxmanage modifyhd –compact browserboxBoot.vdi
 vboxmanage modifyhd –compact browserboxData.vdi

Have a quick look into the .vbox file and make sure that it doesn't list any iso images or other disk images that you attached once to the disk but don't need anymore. They trigger error messages on new host machines.

If you see a disk that is still attached (e.g the guest install iso), get its UUID first:

 VBoxManage list hdds
 VBoxManage list dvd

The remove it:

 VBoxManage closemedium disk <paste uuid here>

or

 VBoxManage closemedium dvd <paste uuid here>

the box release business is now automated with a script, in the qa user:

 boxRelease.sh