CEDEUS Server Setup

From stgo
Revision as of 12:06, 17 December 2014 by StefanS (Talk | contribs)

Jump to: navigation, search

>> return to Cedeus Technical Architecture


general info

  • both machines have 12 cores and 32GB RAM
  • cedeusdb has 4 TB as Raid10 (4 HDs with 2TB)
  • cedeusgeonode has 2 TB as Raid 1 (2 HDs with 2TB)

install log

  1. network installation was done the following way
    • sudo vim /etc/network/interfaces
    • interfaces content:
      auto auth
      iface em1 inet static (used here em1 instead of eth0)
      address 146.155.x.x (replace x by appropriate numbers)
      gateway 146.155.x.1
      netmask 255.255.255.0
      network 146.155.x.0
      broadcast 146.155.x.255
      dns-nameservers 146.155.x.x
      dns-search ing.puc.cl
    • sudo /etc/hosts
    • hosts content:
      127.0.0.1 localhost
      146.155.x.x cedeusdb.ing.puc.cl cedeusddb
    • check (physical) connection using ip a aside from ifconfig -a
  2. installing Ubuntu 14.04 TLS (Trusty Tahr) on cedeusdb (.18) and cedeusgeonode (.19)
  3. installing Postgres 9.3 with PostGIS 2.1
    • adding postgresqls own repo to list of repos
    • sudo apt-get install postgresql-9.3-postgis-2.1 pgadmin3 postgresql-contrib
    • changing pg_hba.conf and postgresql.conf in /etc/postgresql/9.3/main/
    • user: geonode93
    • db: geonodegisdb93
    => psql -U geonode93 -d geonodegisdb93 -h localhost
  4. installation of VirtualBox on both machines as well, according to the description here:
    http://help.ubuntu.com/community/VirtualBox (including the procedure for USB + RDC). That is I simply used
    sudo apt-get install virtualbox
  5. htop and mc are installed as well

Setup of VMs

VMs should primary run on cedeusgeonode server (e.g. GeoNode, OTP, WYP, test stuff), except perhaps for the TileServer VM

  1. creation of VM basicubuntu1404 to be used later for tests
    • 4 CPUs, 8GB Ram, 100GB, nat-ing (behind firewall)
    • Ubuntu 14.04 with openssh, LAMPS, XFCE and XRDP is installed (admin ss...g, pw for mySQL is admin pw)
    • VM creation commands:
      VBoxManage createvm --name basicubuntu1404 --ostype Ubuntu_64 --register
      VBoxManage modifyvm basicubuntu1404 --memory 8192
      VBoxManage modifyvm basicubuntu1404 --cpus 4
      VBoxManage modifyvm basicubuntu1404 --nic1 nat
      VBoxManage createhd --filename basicubuntu1404.vdi --size 100000
      VBoxManage storagectl basicubuntu1404 --name "SATA Controller" --add sata --controller IntelAhci
      VBoxManage storageattach "basicubuntu1404" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium basicubuntu1404.vdi
      VBoxManage storagectl basicubuntu1404 --name "IDE Controller" --add ide --controller PIIX4
      VBoxManage storageattach basicubuntu1404 --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /home/ssteinig/ubuntu-14.04-server-amd64.iso
    • starting the VM with remote desktop connection to install ubuntu:
      VBoxHeadless -s basicubuntu1404 --vrde on &
      => Note: the option --vrdeproperty port=7777 does not seem to have an effect, but the console tells me the connection port for VNC (e.g. 3389). However, VBoxManage modifyvm wikicedeus --vrdeport 7777 can be used to set the VRDE port.
    • starting the VM and wanting to install Ubuntu I actually got the following message
      "This kernel requires an x86-64 CPU, but only detected an i686 CPU. Unable to boot – please use a kernel appropriate for your CPU"
      => Turns out that it should be resolved via enabling the virtualization option the computers boot menu, according to this blog post: http://hereirestinremorse.wordpress.com/virtualbox/this-kernel-requires-an-x86-64-cpu-but-only-detected-an-i686-cpu-unable-to-boot-please-use-a-kernel-appropriate-for-your-cpu/
      However, my virtualization option was switched on, but: I forgot to specify in createvm the ostype as "Ubuntu_64" (not just "Ubuntu"). So then I tried correcting this with modifyvm, but this did not work. Hence, I deleted the VM via "VBoxManage unregistervm basicubuntu1404 --delete" and then created a new one...
  2. after rebooting: modify the repository location for update (don't want to use cl) in /etc/apt/sources.list
  3. shut down the VM
  4. removed the disk image:
    "VBoxManage storageattach basicubuntu1404 --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium none"
  5. enable ssh connection to the VM:
    VBoxManage modifyvm basicubuntu1404 --natpf1 "ssh,tcp,,10022,,22"
    (and perhaps other connections, e.g. apache 80, tomcat 8080)
  6. restart the VM, do a software update and install XFCE. (I think XRDP does not need to be installed because the VirtualBox has is already included: default port as above: 3389)

To change the VMs-Machine name for 14.04 modify "/etc/hostname" and "/etc/hosts".

Automated Start-Up of VM on Server Start

Note, I have not installed the service script "vboxautostart-service" yet. Because when doing this on the CedeusDB the GRUB loader got destroyed on server restart. I am not sure what happened, but for now I am not going to touch the stuff anymore and the VMs still need to be started manually. ... Perhaps I shall give it a second try later on (Jose Thomas thinks this this shouldn't have happened - probably there was some collision with a security update?)

A guide for Ubuntu is here: http://askubuntu.com/questions/404665/how-to-start-virtual-box-machines-automatically-when-booting Important! see also the comment by ndasusers for Ubuntu 14.04 LTS.

However, in my case the file /etc/default/virtualbox did exist already.

Then I applied VBoxManage modifyvm <uuid|vmname> --autostart-enabled on to the following VMs:

  • geonode1204
  • wikicedeus
  • elgg
  • mediawiki
  • tilestream on CedeusDB - Note, the tilestream startup script (i.e. ./tilestream/index.js start --config config.json &) is, however, not run automatically

Enabling serial port access from VM (for APC UPS)

I needed access to the serial port of the server via the VM so I can control the UPS, which is connected via a serial cable.

Testing the serial connection on host computer

  • to check what serial ports are available use: dmesg | grep ttyS
    on CedeusGeoNode I got the following output:
[    0.924355] 00:04: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[    0.946110] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A

  • in earlier test we could also connect (unfortunately only once) to the UPS with minicom -s -c on . and then doing the appropriate settings (9600bps, 8N1, no flow control)
  • in theory (using a modem or so) on can also do echo "id" > /dev/ttyS0

Assigning VM parameters

  • official info can be found here: http://www.virtualbox.org/manual/ch03.html#serialports
  • having the VirtualBox GUI setting the serial port routing could be done as describe here: http://askubuntu.com/questions/16586/how-to-access-serial-ubuntu-host-serial-port-on-virtualbox-guest-os and here: http://techtooltip.wordpress.com/2008/09/12/using-host-serial-port-from-guest-in-virtual-box/
  • however, I am using command line, so I need to use:
    • VBoxManage modifyvm --uart< 1-N > off|< I/O base > < IRQ > : to set the serial parameters for the client system
    • VBoxManage modifyvm --uartmode< 1-N > < arg >  : to decide how the serial connection is used on the host system (e.g. disconnected, routing to physical serial device on the host, write to file, pipe...)
  • so I used then (taken from http://www.linuxquestions.org/questions/slackware-14/virtualbox-serial-port-setup-frustration-586971/):
    • VBoxManage modifyvm opensuse132 --uart1 0x3f8 4 to set up ttyS0/COM1
    • VBoxManage modifyvm opensuse132 --uartmode1 /dev/ttyS0 to link it to physical port ttyS0
  • when trying to startup the VM, I got this message:
    Error: failed to start machine. Error message: Cannot open host device '/dev/ttyS0' for read/write access. Check the permissions of that device ('/bin/ls -l /dev/ttyS0'): Most probably you need to be member of the device group. Make sure that you logout/login after changing the group settings of the current user (VERR_ACCESS_DENIED).
    • using /bin/ls -l /dev/ttyS0 I got this output:
    crw-rw---- 1 root dialout 4, 64 Dec 15 13:55 /dev/ttyS0
    Hence, I added myself to the group dialout with sudo usermod -a -G dialout ssteinig. Important: do a logout and then login again to activate the new settings.
  • So after my opensuse132 VM did start now, I did another dmesg | grep ttyS on the VM, an it did return the following info below - while previously it did not return anything:
    [    1.251960] 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
    Hence, it seems like serial port access is working now :)
  • Testing:
    On the host machine type sudo lsof /dev/ttyS0. Result should show something like this:
 COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME  
 VBoxHeadl 28951 ssteinig   19u   CHR   4,64      0t0 1114 /dev/ttyS0
  • this means that the VBox VM accesses the serial port.
    Note: if the VM is shutdown, then the command "sudo lsof /dev/ttyS0" will not show anything - as the VM does not access the serial port!