How to install Elastix on a VPS without loop devices (OpenVZ)

Written by admin on January 12, 2015. Posted in Elastix

This procedure is based on a OPENVZ VPS without  loop devices enabled, or any other vps without loop devices

What will be installed?

Elastix -2.5.0 with..

Freepbx 2.8

Asterisk 1.8

A2Billing 1.9.4

 

Login via ssh or console.

Create directory tmp

# mkdir tmp
# cd tmp

Download the asterisk cd for your system into tmp folder. I used centos 64 bit

Download the tar version from our servers (we only have this version, but you can use the method for any version. The secret is you download the iso and then use winrar or other programs to extract in. Next thing is you compress it to a .tar file using 7-zip utility and upload it to your server)

# wget  http://23.92.220.74/Elastix-2.5.0-STABLE-x86_64-bin-08may2015.zip
# yum -y update

# rpm -ivh ftp://mirror.cs.princeton.edu/pub/mirrors/fedora-epel/5/i386/epel-release-5-4.noarch.rpm

Add some packages
# yum install gcc gcc-c++ wget bison mysql-devel mysql-server php php-mysql php-pear php-pear-DB php-mbstring nano tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel subversion sysstat fail2ban bwm-ng system-config-securitylevel-tui python-setuptools nano unzip zip

Get rid of some unnecessary packages

# yum remove yum-updatesd cups cups-lpd redhat-lsb autofs pcsc-lite smartmontools cpuspeed

Shutdown unnecessary daemon brcm-iscsi which tends to do a lot of logging even when not used

# chkconfig iscsi off
chkconfig iscsid off
service iscsid stop
service iscsi stop

Replace syslog with the improved and backwards compatible rsyslog

# yum -y install rsyslog
chkconfig syslog off
chkconfig rsyslog on
service syslog stop
service rsyslog start

To prevent problems that can occur in an OpenVZ VPS if udev is ever updated do the following:

# nano /etc/rc.local

add the following lines:

/bin/rm -rf /dev/null
/bin/rm -rf /dev/random
/bin/rm -rf /dev/tty*
/bin/rm -rf /dev/pty*
/bin/mknod -m 0666 /dev/null c 1 3
/bin/mknod -m 0644 /dev/random c 1 8
/sbin/MAKEDEV tty
/sbin/MAKEDEV pty

(Ctrl-x> y >Enter)

Turn off selinux

setenforce 0

You can completeley disable it on OPENVZ

Extract CD iso

# mkdir /mnt/iso

unzip  Elastix-2.5.0-STABLE-x86_64-bin-08may2015.zip

rm Elastix-2.5.0-STABLE-x86_64-bin-08may2015.zip

Create yum repo for the CD
# nano /etc/yum.repos.d/elastix-cd.repo

Copy and paste the following into the file

[elastix-cd]
name=Elastix RPM Repo CD
baseurl=file:///mnt/iso/Elastix-2.5.0-STABLE-x86_64-bin-08may2015
gpgcheck=0
enabled=1

Press Ctrl X to save and answer Y to exit

# yum -y update

Install Elastix
#
yum -y install asterisk* elastix-* freeze fxload libmfcr2 lzop perl-HTML-TokeParser-Simple perl-WWW-Mechanize mod_ssl mlocate gcc gcc-c++ system-config-network-tui wget sox

# yum clean all

# sed -i 's/TTY=9/#TTY=9/g' /usr/sbin/safe_asterisk
sed -i 's/chown asterisk \/dev\/tty9/#chown asterisk \/dev\/tty9/g' /etc/init.d/asterisk
sed -i 's/\/sbin\/start_udev/#\/sbin\/start_udev/g' /etc/rc.d/rc.sysinit
sed -i 's/\/usr\/sbin\/fxotune -s/#\/usr\/sbin\/fxotune -s/g' /etc/rc.local
sed -i 's/chown $AMPASTERISKUSER \/dev\/tty9/#chown $AMPASTERISKUSER \/dev\/tty9/g'    /var/lib/asterisk/bin/freepbx_engine

 

# hkconfig haldaemon off
chkconfig asterisk off
chkconfig dahdi off
chkconfig wanrouter off

# rm -rf /etc/init.d/dahdi
rm -rf /etc/init.d/wanrouter
rm -rf /usr/src/Elastix

# echo 'DEVICE=eth0' > /etc/sysconfig/network-scripts/ifcfg-eth0
system-config-network

# service mysqld start

# reboot

 

First boot will not come up automatically since you do not have a mounted CD. So you need to run this command

# /etc/rc3.d/S66elastix-firstboot start

The system will prompt you for two important passwords with confirmation. Make sure your passwords are strong but remember-able. Make sure you reboot again before you can  login to your server but if you will need to use a domain instead of IP address then do the following

Remove Disk Repo otherwise Webmin will not install
# rm /etc/yum.repos.d/elastix-cd.repo
# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.610-1.noarch.rpm
# rpm -U webmin-1.610-1.noarch.rpm
Access webmin by going to  http://localhost:10000/. Or if accessing it remotely, replace localhost with your system’s IP address.
Set up your webmin and make sure Bind is running
You can put back your repo if you want it may help when you want to install further addons. Please do not put this back before you install bind otherwise bind installation will fail.

Create yum repo for the CD
# nano /etc/yum.repos.d/elastix-cd.repo

Copy and paste the following into the file
[elastix-cd]
name=Elastix RPM Repo CD
baseurl=file:///mnt/iso/Elastix-2.5.0-STABLE-x86_64-bin-08may2015
gpgcheck=0
enabled=1

Configure your Domain
Do not update via webmin.

Login to your elastix by visiting https://yourdomain.whatever
Username:  admin
Password  is the one you set it via console during installation.
You are done now you can configure your Elastix following Elastix without tears guide.