2016-03-08

Created page with "* Install of Elastix from ISO file without loop on OpenVZ container * For purposes of this article, the '''VMID''' will be assumed to be '''102'''. Change as necessary in your..."

New page

* Install of Elastix from ISO file without loop on OpenVZ container

* For purposes of this article, the '''VMID''' will be assumed to be '''102'''. Change as necessary in your environment.

== Pre-Install ==

* Get the Elastix ISO

<source lang="bash">

wget --no-check-certificate \

https://sourceforge.net/projects/elastix/files/Elastix%20PBX%20Appliance%20Software/2.4.0/Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso \

-O /var/lib/vz/template/iso/Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso

</source>

* Get the template and rename it to conform to PVE naming convention

<source lang="bash">

wget --no-check-certificate \

https://download.openvz.org/template/precreated/centos-5-x86_64.tar.gz \

-O /var/lib/vz/template/cache/centos-5-standard_5.11-1_amd64.tar.gz

</source>

* Create an OpenVZ container

** '''Template''': [https://download.openvz.org/template/precreated/centos-5-x86_64.tar.gz CentOS 5 Standard 64 bit Template] from [https://download.openvz.org/template/precreated/ OpenVZ.org's precreated templates page]

** '''Network''': veth (eth0)

** '''RAM/SWAP''': 1024 MB

** '''HDD''': atleast 8 GB (recommended 32 GB for sufficient Voicemails)

=== Enable [https://pve.proxmox.com/wiki/OpenVZ_Console#Centos_5_.2F_7 PVE Console Access] ===

* Enable PVE Console access in the VM for use in PVE > 2.x

** Access the private space of the container with

*** Either edit the VMID 102's file from the host using <tt>nano /var/lib/vz/private/102/etc/inittab</tt>

*** Or start and enter the container from the host using <tt>vzctl enter '''102'''</tt> and edit using <tt>nano /etc/inittab</tt>

** Append the following line to <tt>/etc/inittab</tt> in the VM:

1:2345:respawn:/sbin/agetty tty1 38400 linux

=== Start Container and Enable Networking ===

Since '''veth''' is used, we need to create the network access file in the container (accessed from the host using <tt>vzctl enter '''102'''</tt>) - we choose '''dhcp''' for this example by creating the file <tt>/etc/sysconfig/network-scripts/ifcfg-eth0</tt>

<source lang="bash">

cat <<EOT > /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=dhcp

EOT

# Restart the Network daemon and update the OS with

service network restart

yum update

</source>

The above requires that a DHCP server is available in the network and preferably a Static DHCP has been assigned to the VM's '''veth''' device (eth0).

=== Install pre-requiites ===

==== Current OS and Kernel Version ====

<pre>

# cat /etc/redhat-release

CentOS release 5.11 (Final)

# uname -a

Linux elastixpbx.example.com 2.6.32-44-pve #1 SMP Fri Feb 26 09:28:08 CET 2016 x86_64 x86_64 x86_64 GNU/Linux

</pre>

==== Install OS utility packages ====

<source lang="bash">

# yum install zip unzip bzip2

yum install zip

# Enable epel repo

rpm -ivh http://mirror.cs.princeton.edu/pub/mirrors/fedora-epel/5/x86_64/epel-release-5-4.noarch.rpm

yum update

yum install p7zip p7zip-plugins

# yum install wget httpd make sendmail sendmail-cf caching-nameserver

yum install gcc gcc-c++ bison mysql-devel mysql-server php php-mysql \

php-pear php-pear-DB php-mbstring tftp-server ncurses-devel libtermcap-devel \

sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel \

subversion sysstat fail2ban system-config-securitylevel-tui python-setuptools nano

# bwm-ng is in DAG repo

rpm -ivh ftp://195.220.108.108/linux/dag/redhat/el5/en/x86_64/dag/RPMS/bwm-ng-0.5-2.el5.rf.x86_64.rpm

# These are not in the template itself

# 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 append to /etc/rc.local

cat <<EOT >> /etc/rc.local

/bin/rm -rf /dev/tty*

/bin/rm -rf /dev/pty*

/bin/rm -rf /dev/null

/bin/rm -rf /dev/random

/bin/mknod -m 0666 /dev/null c 1 3

/bin/mknod -m 0644 /dev/random c 1 8

/sbin/MAKEDEV tty

/sbin/MAKEDEV pty

EOT

# Turn off selinux

setenforce 0

</source>

=== Elastix components ===

Either the Elastix ISO can be downloaded into the VM 102 or copied/temporarily moved from the host to the VM filesystem.

==== In the VM ====

<source lang="bash">

mkdir -p /mnt/iso

wget --no-check-certificate \

https://sourceforge.net/projects/elastix/files/Elastix%20PBX%20Appliance%20Software/2.4.0/Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso \

-O /mnt/iso/Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso

7z x -r Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso -o/mnt/iso

rm -f /mnt/iso/Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso

</source>

==== Alternatively from the host ====

<source lang="bash">

mv /var/lib/vz/template/iso/Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso \

/var/lib/vz/private/102/mnt/iso/Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso

vzctl enter 102

mkdir -p /mnt/iso

7z x -r Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso -o/mnt/iso

exit

mv /var/lib/vz/private/102/mnt/iso/Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso \

/var/lib/vz/template/iso/Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso

</source>

=== Install Elastix ===

==== Create the Elastix-CD Repo ====

<source lang="bash">

cat <<EOT > /etc/yum.repos.d/elastix-cd.repo

[elastix-cd]

name=Elastix RPM Repo CD

baseurl=file:///mnt/iso/

gpgcheck=0

enabled=1

EOT

</source>

==== Elastix packages install ====

<source lang="bash">

yum -y update

# Installs autoconf, m4 from elastix-cd repo

# yum install mlocate gcc gcc-c++ wget sox

yum -y install asterisk* elastix-* freeze fxload libmfcr2 lzop \

perl-HTML-TokeParser-Simple perl-WWW-Mechanize mod_ssl system-config-network-tui

# package libmfcr2 (for x86_64 atleast) does not install and hence is not used and does not appear needed

# TTY Fix - comment out the line with "TTY=" in /usr/sbin/safe_asterisk

sed -e 's/^TTY/# TTY/' -i /usr/sbin/safe_asterisk

reboot

</source>

=== Elastix First Boot ===

<source lang="bash">

/etc/rc3.d/S66elastix-firstboot start

rm -f /etc/yum.repos.d/elastix-cd.repo

yum update

</source>

* MySQL and FreePBX passwords: MySecret

* These passwords are stored in the config files in <tt>/etc/asterisk</tt>

** cbmysql.conf

** cdr_mysql.conf

** extensions_additional.conf

** manager.conf

** res_config_mysql.conf

* Stands upgraded to Elastix 2.50

On rebooting, access the Elastix web UI at https://elastixpbx.example.com - admin / MySecret

=== Optional Webmin install ===

* Webmin provides a simple control panel to manage the Server.

* This is optional

* It is generally used among others, for:

** View the logs

** Configure services like Mail and FTP

** Manage config files for services like Apache, BIND DNS and MySQL

** Take dumps of MySQL

** View status of various services and effect control over them

<source lang="bash">

# yum -y install openssl perl perl-Net-SSLeay

yum install openssl-devel perl-Crypt-SSLeay

wget --no-check-certificate \

http://jaist.dl.sourceforge.net/project/webadmin/webmin/1.790/webmin-1.790-1.noarch.rpm

rpm -U webmin-1.790-1.noarch.rpm

rm -f webmin-1.790-1.noarch.rpm

# Start BIND DNS

service named start

# Avoid errors in new browsers that are security paranoid of user generated SSL certs

sed -e 's/no\_ssl3.*/no_ssl=0/' -i /etc/webmin/miniserv.conf

sed -e 's/no\_tls1.*/no_tlsl=0/' -i /etc/webmin/miniserv.conf

sed -e 's/no\_tls1\_1.*/no_tlsl_1=0/' -i /etc/webmin/miniserv.conf

cd /etc/webmin

./restart

service named status

reboot

</source>

* Access Webmin at https://elastixpbx.example.com:10000 - root / MySecret

=== jQuery code fix ===

A [http://stackoverflow.com/questions/23626504/blockui-requires-jquery-v1-2-3-or-later-you-are-using-v-1-11-1 bug in detecting the jQuery version] causes upto the first decimal of the version alone to be checked rendering later versions to appear as earlier ones. This results in <tt>Javascript Error: blockUI requires jQuery v1.2.3 or later!....</tt>

<pre>

File: /var/www/html/modules/registration/themes/default/js/jquery.blockUI.js

Replace all \r\n with \n

Replace line 17:

if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {

with

if ((/1\.(2\.([3-9]|[1-9][0-9])|[3-9]\.[0-9]*|[1-9][0-9]*\.[0-9]*)/.test($.fn.jquery)) === false ) {

</pre>

The patched file is available [[Media:jquery.blockUI.js_v2.33_fixed.zip|here]].

== Post-Install ==

=== Elastix Updates ===

In future, when doing an Elastix update, do take backups within Elastix since trying to revert to an earlier version will not be possible as the SQLite db files may possibly have different schemas and defaults. All versions are visible in the Elastix Web UI. As on date it is:

<pre>

Kernel

Linux(x86_64)-2.6.32-44

Elastix

elastix-2.5.0-1

elastix-a2billing-2.1.0-1.gita40e37fefef7ab85999d04298b6e582b41930e7e

elastix-a2billing-callback_daemon-2.1.0-1.gita40e37fefef7ab85999d04298b6e582b41930e7e

elastix-addons-2.5.0-4

elastix-agenda-2.5.0-1

elastix-asterisk-sounds-1.2.3-1

elastix-email_admin-2.5.0-4

elastix-endpointconfig2-2.5.0-1

elastix-extras-2.5.0-1

elastix-fax-2.5.0-3

elastix-firstboot-2.5.0-3

elastix-framework-2.5.0-11

elastix-im-2.5.0-1

elastix-my_extension-2.5.0-1

elastix-pbx-2.5.0-6

elastix-portknock-0.0.1-0

elastix-reports-2.5.0-5

elastix-security-2.5.0-3

elastix-system-2.5.0-3

elastix-vtigercrm-5.2.1-10

RoundCubeMail

RoundCubeMail-0.3.1-12

Mail

postfix-2.3.3-7.el5

cyrus-imapd-2.3.7-16.el5_11

IM

openfire-3.7.1-1

FreePBX

freePBX-2.11.0-23

Asterisk

asterisk-11.21.0-0

asterisk-perl-1.03-0

asterisk-addons-11.21.0-0

FAX

hylafax-4.3.11-1rhel5

iaxmodem-1.2.0-2

DRIVERS

dahdi-2.10.2-0

rhino-(not installed)-

wanpipe-util-7.0.14-0

</pre>

=== Customisation ===

* Custom Sound Recordings are at <tt>/var/lib/asterisk/sounds/custom</tt>

* Elastix logos are at <tt>/var/www/html/themes/</tt> under

** <tt>blackmin/images/elastix_logo_mini.png</tt>

** <tt>tenant/images/elastix_logo_mini.png</tt>

** <tt>tenant/images/elastix_logo_mini2.png</tt>

* These logos are referred to in the theme's '''<tt>_common</tt>''' folder's '''<tt>tpl</tt>''' files.

* Planettel's Elastix 2.5.0 [[Media:PT_Eastix250_var-www-html-themes_custom.zip|customisation files]].

== References ==

* [http://asteriskonvps.com/elastix/how-to-install-elastix-on-a-vps-without-loop-devices-openvz/ Asterisk on VPS Article]

* [http://ask.xmodulo.com/install-7zip-linux.html 7-Zip Linux Install]

* [http://www.makeuseof.com/tag/extract-iso-files-linux/ Extract files from ISO using 7-Zip in Linux]

* [https://www.powerpbx.org/content/Asterisk-FreePBX-on-an-OpenVZ-Virtuozzo-Virtual-Private-Server-v1 PowerPBX]

[[Category: HOWTO]] [[Category: Virtual Appliances]]

Show more