How To Install OpenQRM 4.7 With LXC Containers In Debian Squeeze/Lenny: Step By Step

This is a tutorial for installing OpenQRM 4.7 with LXC containers in Debian Lenny which can further be used for installing ISPConfig3 at the container level. OpenQRM 4.7 (http://www.openqrm.com) was released on September 30, 2010 with LXC support. Wonderful product. Videos of this enterprise grade datacenter management framework are available at http://openqrm.com/?q=node/183. I hope that this information is useful to those who are interested. And thanks to Matt and OpenQRM developers for the hard work!

DISCLAIMER: This is something that worked for me. I do not bear responsibility if something breaks down. You need at least a 100GB for this for basic setup.

 

A) INSTALL DEBIAN SQUEEZE (ALSO APPLIES TO LENNY WITH BACKPORT KERNEL)

A1) Download Debian Squeeze netboot CD from http://debian.org
A2) It will first ask to set up root user password and ask to create a new user. Give the root password twice and create a new user. It will also ask to give the machine's domain and give whatever you like or your tld name.
A3) Create 3 partitions. 512MB (1/2GB) for /boot, 2GB for Swap and rest for /. Format /boot as ext4 and / as LVM. (you can find more info on how to create LVM2 volume online or can just follow the installer guideline).
A4) When it asks what to install, deselect everything including 'Standard Adminstration Utilities'. And also uncheck 'Graphical Desktop Environment'.
A5) Once the setup is complete, just reboot.

 

B) CREATE A BRIDGE FOR LXC HOST

B1) First install bridge utilities.

aptitude install bridge-utils

B2) Make changes to the /etc/network/interfaces from:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

to (for static IP):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp

#Bridge setup
auto br0
iface br0 inet static
      bridge_ports eth0
      bridge_fd 0
      address 192.168.10.251
      netmask 255.255.255.0
      gateway 192.168.10.254
      dns-nameservers 192.168.10.254

Change the address, netmask, gateway (find from 'route' command) and dns-nameservers as appropriate.

Then restart the network:

/etc/init.d/networking restart

 

C) INSTALL LXC

C1)

aptitude install lxc

C2)

mkdir /cgroup

C3) Add the following line in /etc/fstab using a text editor:

cgroup /cgroup cgroup defaults 0 0

C4)

mount -a

C5)

lxc-checkconfig

You will see something like below:

$ lxc-checkconfig
Kernel config /proc/config.gz not found, looking in other places...
Found kernel config file /boot/config-2.6.32-5-686
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
Multiple /dev/pts instances: enabled

--- Control groups ---
Cgroup: enabled
Cgroup namespace: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: missing
Cgroup cpuset: enabled

--- Misc ---
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabled

Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig

The only thing that you cannot do with the vanilla debian squeeze kernel reporting 'Cgroup memory controller: missing' parameter is to allocate memory. One can recompile the kernel with memory controller enabled in a debian way (shall explain in another tutorial if needed), but it hogs 2-3% of CPU resources.

 

D) INSTALL DEBOOTSTRAP TO TEST FIRST CONTAINER

D1) You need to install debootstrap for creating templates for the containers, so install it by executing:

aptitude install debootstrap

D2) Create a workspace for vm0 container:

mkdir -p /var/lib/lxc/vm0

D3) Now debootstrap the debian image for the vm0 container:

/usr/lib/lxc/templates/lxc-debian -p /var/lib/lxc/vm0/

It will take a while to complete, and creates a vm0 with a root password 'root' which we will change in D8 below.

D4) Open /var/lib/lxc/vm0/config file and add the following at the end of the file:

lxc.utsname = vm0
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.ipv4 = 192.168.7.110/24

Change the ipv4 address as per your network. You can add MAC of your network hardware also by adding a line 'lxc.network.hwaddr = 00:11:22:33:44:55'.

D5) Start vm0 by in daemon mode by executing:

lxc-start -n vm0 -d

D6) To check if it is running, execute:

lxc-info -n vm0
'vm0' is RUNNING

D7) To get into the vm0, execute:

lxc-console -n vm0

D8) change the root password of the vm0 container by executing:

passwd su

D9) Exit from the container by executing:

poweroff

Command which will bring to the host root console.

 

E) INSTALL OPENQRM 4.7

E1) Download the source of OpenQRM 4.7:

wget http://sourceforge.net/projects/open...7.tgz/download

E2) Uncompress the archive:

tar -zxvf openqrm-4.7.tgz

E3) Move to openqrm source directory:

cd openqrm-4.7

E4)

make

It will install all the necessary dependency if run as root. Else you have to install each dependency manually.

E5) Install:

make install

E6) Run:

make start

It will take some time as it installs and configures several stuffs.

E6.1) It will first ask to setup the root password for the mysql server. Set one of your liking, but not a dictionary word.

E6.2) Again it willl ask the nagios admin password. Supply one but different from the mysql root password.

E6.3) It will ask then to set up the workgroup for SAMBA. I just went with default 'WORKGROUP'.

E6.4) It will ask for postfix domain for SMTP, please specify the tld domain you want to use or else go with 'localhost.localdomain'.

E6.5) It will ask the location of root for tftp and just go with default /srv/tftp.

E7) After successful installation, it outputs like:

Initialization complete. Please configure your openQRM Server at: http://[server-ip-address]/openqrm/
-> User: openqrm -> Password: openqrm

 

F) CREATE MYSQL DATABASE FOR OPENQRM

F1) You need to create a database for OpenQRM before you log into the web interface of OpenQRM as reported in E7 above.

F2) So create a mysql database:

mysql -u root -p

Supply the password for the root set up in E6.2 above. And you will land at mysql prompt:

mysql> create database openqrm;

F3) Grant privileges.

mysql> grant all on openqrm.* identified by 'username@localhost' identified by 'secret';

Change the username and secret of your liking.

F4) Flush privileges:

mysql> flush privileges;
mysql> exit
Share this page:

0 Comment(s)