Setting up osgeo vm

From stgo
Revision as of 10:30, 2 December 2013 by Mentaer (Talk | contribs)

Jump to: navigation, search

>> return Cedeus IDE


Setting up a OSGeo VirtualBox-VM on Lautaro with SuseLinux - but using command line (because creating the VM via the graphical interface vboxgtk did not work properly). The general documentation was taken from here: http://stdioe.blogspot.com/2012/01/creating-virtual-machine-with.html

Steps:

  1. install virtualbox on server/computer (done by Daniel, needs admin rights of course)
  2. create a VM based on Ubuntu:
    VBoxManage createvm --name osgeo  --ostype Ubuntu --register
  3. check it is there:
    VBoxManage showvminfo osgeo
  4. set the memory/ram:
    VBoxManage modifyvm osgeo --memory 8192
    (which is 8GB)
  5. check the memory/ram:
    VBoxManage showvminfo osgeo | grep "Memory size"
  6. set the number of cpu's to use (here 4):
    VBoxManage modifyvm osgeo --cpus 4
  7. set the network connection/routing
    VBoxManage modifyvm osgeo --nic1 nat
    Here we use 'nat'-ing instead of a bridge
  8. create a harddisk of 100GB size:
    VBoxManage createhd --filename osgeo.vdi --size 100000
  9. define the VM's disk controller:
    VBoxManage storagectl osgeo --name "SATA Controller" --add sata --controller IntelAhci
  10. mount the disk:
    VBoxManage storageattach "osgeo" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium osgeo.vdi
  11. check if everything is there:
    VBoxManage showvminfo osgeo
  12. add DVD device:
    VBoxManage storagectl osgeo --name "IDE Controller" --add ide --controller PIIX4
  13. load the DVD device with the Ubuntu VM/osgeo iso file (check if the iso has proper rights, i.e. maybe do a chmod 775):
    VBoxManage storageattach osgeo --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium yyy/osgeolive7.iso 
  14. starting VM
    VBoxHeadless -s osgeo -n -m 7777 & 
    The -s is for start, 7777 defines the port for conecting with VNC, and the & is for keeping the VM running when I disconnect from the server. Headless actually means, that we have no monitor...
  15. don't forget to install VNC Viewer (e.g. RealVNC), and then connect via the defined port - to "146.155.xx.xxx:7777"
  16. ... do a real install of the osgeo VM, etc.
  17. install ssh server
    sudo apt-get install openssh-server
  18. how to do a mapping for ssh (& ftp), so that the guest VM can be reached from the host machine is described here: http://blogs.oracle.com/rmanus/entry/virtualbox_how_to_ftp_from
    In particular one has to do the following:
    /usr/bin/VBoxManage setextradata name_of_vm "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort” 2222 
    /usr/bin/VBoxManage setextradata name_of_vm "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort” 22
     /usr/bin/VBoxManage setextradata name_of_vm "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol” "TCP" 
    These entries are then added to osgeo.vbox xml file. For ftp the port would be 21 instead of 22. To enable Apache, do the same but use: config folder "apache", HostPort "8888", GuestPort "80", Protocol "TCP", e.g. (as one line):
     VBoxManage modifyvm osgeo --natpf1 "apache,tcp,,8888,,80"
    • Note, if a "Error: failed to start machine. Error message: Configuration error: Failed to get the "MAC" value (VERR_CFGM_VALUE_NOT_FOUND)" appears, then it may be necessary to change the network adapter to PCnet-FAST III (Am79C973), according to this Blog entry
  19. check here on how to detach the medium use:
    VBoxManage storageattach osgeo --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium none
  20. shutting down the vm per vboxmanage :
    VBoxManage controlvm <uuid>|<name> pause|resume|reset|poweroff|savestate|acpipowerbutton|acpisleepbutton
  21. tomcat 6 can be found in /usr/share/tomcat6/bin. However, the start/stop command is simply:
    sudo service tomcat6 start
    Check out: Blog: How to instal Tomcat 6 on Ubuntu 12.04. Also, don't forget to create uses for the manager interface (see here). Finally, the right amount of memory can be assigned in the file /etc/tomcat6/tomcat6.conf. However, I did not had this file. So I created a new file setenv.sh in /usr/share/tomcat6/bin via
    sudo touch setenv.sh
    and then edited it adding the following lines:
    #!/bin/sh <new line> JAVA_OPTS="-Xmx2096m -Xms512m -server -Djava.awt.headless=true -Djava.util.prefs.systemRoot=$CATALINA_HOME/content/thredds/javaUtilPrefs" <new line> export JAVA_OPTS
    Then I stopped and re-started tomcat.
  22. displaying catalina output:
    cd /var/lib/tomcat6
    tail -f logs/catalina.out
  23. activate remote desktop for VBox:
    VBoxManage modifyvm osgeo --vrde on
    VBoxManage modifyvm osgeo --vrdemulticon on
    and define the port number
    VBoxManage modifyvm osgeo --vrdeport XXXX