Elastix on OpenVZ installation.
Just recently I had to install Elastix on OpenVZ. This post on the Elastix forum will help you to install DAHDI. The idea is very simple, as every complex problem has simple and elegant solution, and I can confirm you that from my years of experience. I will give two words Physical to Virtual, and I hope this ring some bells :), here is what you have to do.
1.Install Elastix.
Any version will work, installed on stand-alone hardware, I would recommend to use VirtualBox (any full-virtualization software will do) as it will be faster and easier.
2.Preparing to take snapshot.
Stop all services such as APACHE,MYSQL,BIND and etc., which have real-time data flow to them on the Elastix node.This will help you not to lose if not all most of the real-time data flowing to this services while taking a snapshot of the node latter.
3.Create a container on the OpenVZ server for the snapshot.
Create a container directory:
mkdir /vz/root/{CTID} /vz/private/{CTID}
Copy a config file from ve-basic sample to container config:
cat /etc/vz/conf/ve-basic.conf-sample > /etc/vz/conf/{CTID}.conf
4.Take the snapshot.
You will need to exclude this directories from Elastix installation:
/tmp /boot /lib/modules /etc/blkid /etc/mtab /etc/lvm /etc/fstab /etc/udev
Create exclude.txt in /tmp containing the above directories on the OpenVZ server and execute this rsync from it:
rsync -avz -H -X --one-file-system --numeric-ids --exclude-from=/tmp/exclude.txt -e ssh root@X.X.X.X:/ /vz/private/{CTID}/
5.Make some adjustments on the container.
Set an OSTAMPLATE for the container:
vzctl set {CTID} --ostemplate centos-5-x86 --save
Set an IP address for the container:
vzctl set {CTID} --ipadd X.X.X.X --save
You can additionally also set disk space,hostname,cpu limits and etc.
Changes to /etc/inittab:
sed -i -e 's/^[0-9].*getty.*tty/#&/g' /vz/private/{CTID}/etc/inittab
Changes to /etc/mtab:
ln -sf /proc/mounts /vz/private/{CTID}/etc/mtab
Changes to /etc/fstab:
mv /vz/private/{CTID}/etc/fstab /vz/private/{CTID}/etc/fstab.old grep devpts /vz/private/{CTID}/etc/fstab.old > /vz/private/{CTID}/etc/fstab
Changes to /dev:
mkdir /vz/private/{CTID}/dev mknod --mode 666 /vz/private/{CTID}/dev/ptmx c 5 2 mkdir /vz/private/{CTID}/dev/pts cp -a /dev/ttyp* /dev/ptyp* /vz/private/{CTID}/dev/ rm -f /vz/private/{CTID}/dev/null mknod --mode 666 /vz/private/{CTID}/dev/null c 1 3 mknod --mode 444 /vz/private/{CTID}/dev/urandom c 1 vzctl exec 154 /sbin/MAKEDEV pty vzctl exec 154 /sbin/MAKEDEV tty
Disable old network interface:
rm /vz/private/{CTID}/etc/sysconfig/network-scripts/ifcfg-eth*
6.Start the container.
vzctl start {CTID}
7.Do some testing.
Check that everything is working like SSH,APACHE,MYSQL,ASTERISK are up and running!