Difference between revisions of "CEDEUS Server Setup"
(→general info) |
|||
(41 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | + | >> return to [[Cedeus Technical Architecture]] | |
− | * both machines have 12 cores and 32GB RAM | + | |
+ | ---- | ||
+ | |||
+ | == general info == | ||
+ | * both machines have 12 cores (6 real ones) and 32GB RAM | ||
* cedeusdb has 4 TB as Raid10 (4 HDs with 2TB) | * cedeusdb has 4 TB as Raid10 (4 HDs with 2TB) | ||
* cedeusgeonode has 2 TB as Raid 1 (2 HDs with 2TB) | * cedeusgeonode has 2 TB as Raid 1 (2 HDs with 2TB) | ||
− | + | == install log == | |
# network installation was done the following way | # network installation was done the following way | ||
#* <code>sudo vim /etc/network/interfaces</code> | #* <code>sudo vim /etc/network/interfaces</code> | ||
Line 35: | Line 39: | ||
# htop and mc are installed as well | # 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 | VMs should primary run on cedeusgeonode server (e.g. GeoNode, OTP, WYP, test stuff), except perhaps for the TileServer VM | ||
Line 53: | Line 57: | ||
#* starting the VM with remote desktop connection to install ubuntu: | #* starting the VM with remote desktop connection to install ubuntu: | ||
#*:<code>VBoxHeadless -s basicubuntu1404 --vrde on &</code> | #*:<code>VBoxHeadless -s basicubuntu1404 --vrde on &</code> | ||
− | #*:=> Note: the option <code>--vrdeproperty port=7777</code> does not seem to have an effect, but the console tells me the connection port for VNC (e.g. 3389) | + | #*:=> Note: the option <code>--vrdeproperty port=7777</code> does not seem to have an effect, but the console tells me the connection port for VNC (e.g. 3389). However, <code>VBoxManage modifyvm wikicedeus --vrdeport 7777</code> can be used to set the VRDE port. |
#* starting the VM and wanting to install Ubuntu I actually got the following message | #* 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"'' | #*:''"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/ <br /> 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 | + | #*:=> 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/ <br /> 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 <code>"VBoxManage unregistervm basicubuntu1404 --delete"</code> and then created a new one... |
# after rebooting: modify the repository location for update (don't want to use cl) in ''/etc/apt/sources.list'' | # after rebooting: modify the repository location for update (don't want to use cl) in ''/etc/apt/sources.list'' | ||
# shut down the VM | # shut down the VM | ||
Line 62: | Line 66: | ||
#: <code>"VBoxManage storageattach basicubuntu1404 --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium none"</code> | #: <code>"VBoxManage storageattach basicubuntu1404 --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium none"</code> | ||
# enable ssh connection to the VM: | # enable ssh connection to the VM: | ||
− | #: <code>VBoxManage modifyvm basicubuntu1404 --natpf1 "ssh,tcp,,10022,,22"</code> (and perhaps other connections, e.g. apache 80, tomcat 8080) | + | #: <code>VBoxManage modifyvm basicubuntu1404 --natpf1 "ssh,tcp,,10022,,22"</code> |
+ | #: (and perhaps other connections, e.g. apache 80, tomcat 8080) | ||
# 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) | # 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 <code>VBoxManage modifyvm <uuid|vmname> --autostart-enabled on</code> to the following VMs: | ||
+ | * geonode1204 | ||
+ | * wikicedeus | ||
+ | * elgg | ||
+ | * mediawiki | ||
+ | * tilestream on CedeusDB - Note, the tilestream startup script (i.e. <code>./tilestream/index.js start --config config.json &</code>) 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: <code>dmesg | grep ttyS</code> | ||
+ | *: on CedeusGeoNode I got the following output: | ||
+ | *:<code> | ||
+ | [ 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 | ||
+ | </code> | ||
+ | |||
+ | * in earlier test we could also connect to the UPS with <code>minicom -s -c on</code> . and then doing the appropriate settings (9600bps, 8N1, no flow control) | ||
+ | * in theory (using a modem or so) on can also do <code>echo "id" > /dev/ttyS0</code> | ||
+ | |||
+ | === 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: | ||
+ | ** <code>VBoxManage modifyvm --uart< 1-N > off|< I/O base > < IRQ ></code> : to set the serial parameters for the client system | ||
+ | ** <code>VBoxManage modifyvm --uartmode< 1-N > < arg > </code> : 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...) | ||
+ | * As my APC UPS is connected to ttyS0 I used then (taken from http://www.linuxquestions.org/questions/slackware-14/virtualbox-serial-port-setup-frustration-586971/): | ||
+ | **<code>VBoxManage modifyvm opensuse132 --uart1 0x2f8 3</code> => to set up ttyS1/COM1 | ||
+ | **<code>VBoxManage modifyvm opensuse132 --uartmode1 /dev/ttyS1</code> => to link it to physical port ttyS1 | ||
+ | * 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 <code>/bin/ls -l /dev/ttyS1</code> I got this output: | ||
+ | *: <pre>crw-rw---- 1 root dialout 4, 64 Dec 15 13:55 /dev/ttyS1</pre> | ||
+ | *: Hence, I added myself to the group ''dialout'' with <code>sudo usermod -a -G dialout ssteinig</code>. Important: do a logout and then login again to activate the new settings. | ||
+ | * So after my opensuse132 VM did start now, I did another <code>dmesg | grep ttyS</code> on the ''opensuse132'' VM, an it did return the following info below - while previously it did not return anything: | ||
+ | *: <pre>[ 1.251960] 00:03: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A</pre> | ||
+ | *: Hence, it seems like serial port access is working now :) | ||
+ | * Testing: | ||
+ | *: On the host machine type <code>sudo lsof /dev/ttyS*</code>. Result should show something like this: | ||
+ | <pre> | ||
+ | COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME | ||
+ | VBoxHeadl 30378 ssteinig 19u CHR 4,65 0t0 1113 /dev/ttyS1 | ||
+ | </pre> | ||
+ | :=> this means that the VBox VM accesses the serial port. | ||
+ | :=> Note: if the VM is '''shutdown''', then the command <code>"sudo lsof /dev/ttyS*"</code> will not show anything - as the VM does '''not access the serial port!''' |
Latest revision as of 13:08, 28 December 2014
>> return to Cedeus Technical Architecture
Contents
general info
- both machines have 12 cores (6 real ones) 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
- 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
-
- installing Ubuntu 14.04 TLS (Trusty Tahr) on cedeusdb (.18) and cedeusgeonode (.19)
- 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
- 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
- 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
- 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...
- after rebooting: modify the repository location for update (don't want to use cl) in /etc/apt/sources.list
- shut down the VM
- removed the disk image:
-
"VBoxManage storageattach basicubuntu1404 --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium none"
-
- enable ssh connection to the VM:
-
VBoxManage modifyvm basicubuntu1404 --natpf1 "ssh,tcp,,10022,,22"
- (and perhaps other connections, e.g. apache 80, tomcat 8080)
-
- 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 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...)
-
- As my APC UPS is connected to ttyS0 I used then (taken from http://www.linuxquestions.org/questions/slackware-14/virtualbox-serial-port-setup-frustration-586971/):
VBoxManage modifyvm opensuse132 --uart1 0x2f8 3
=> to set up ttyS1/COM1VBoxManage modifyvm opensuse132 --uartmode1 /dev/ttyS1
=> to link it to physical port ttyS1
- 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/ttyS1
I got this output:
-
crw-rw---- 1 root dialout 4, 64 Dec 15 13:55 /dev/ttyS1
- 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 opensuse132 VM, an it did return the following info below - while previously it did not return anything:-
[ 1.251960] 00:03: ttyS1 at I/O 0x2f8 (irq = 3, 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/ttyS*
. Result should show something like this:
- On the host machine type
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME VBoxHeadl 30378 ssteinig 19u CHR 4,65 0t0 1113 /dev/ttyS1
- => this means that the VBox VM accesses the serial port.
- => Note: if the VM is shutdown, then the command
"sudo lsof /dev/ttyS*"
will not show anything - as the VM does not access the serial port!