Detailed Installation Example (CentOS 6.6)

OpenAnswer Suite Install Instructions

Last modified by Isaac Peek on 2015/04/28 17:54

Install CentOS 6.6

Note:

  • We've disabled SELinux
  • For testing we've set oa/oc/oq.mydomain.com in our host file => local ip (ie- 192.168.1.1 oc.mydomain.com oa.mydomain.com oq.mydomain.com)
  • You don't have to use the host file if you can set these up in your local DNS - It might be best practice to set at the very least oc.mydomain.com in the host file so it always has access to openconnector

 

Deploy LAMP stack, Redis and NodeJS(version 0.12.3)

yum update

yum install wget httpd  mysql mysql-server mysql-devel php epel-release git perl-libwww-perl -y

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

rpm -Uvh remi-release-6*.rpm

yum install php-mysql php-xmlrpc npm redis php-redis -y

NVM and node specific

Let's check and make sure the nvm curl above inserted a new line into bash for us:
cat /.bash_profile #You should see a line at the bottom that has to do with NVM

If not lets manually add it:
vi /.bash_profile

[ -s $HOME/.nvm/nvm.sh ] && . $HOME/.nvm/nvm.sh # This loads NVM

 

Make sure there is no space after the above line.

Go ahead and exit and re-log into the server so your bash profile updates and you can run the next command:
nvm install 0.12.3



Verify node is now installed
node -v

Make note of the install location of nvm. It should be /root/.nvm/versions/node/v0.12.3 You will need this for openConnector.

Install node-gyp
yum install node-gyp -y

 

Configure http,mysql,redis and iptables for boot

service iptables stop

service httpd start && service mysqld start

chkconfig iptables off && chkconfig httpd on && chkconfig mysqld on && chkconfig redis on

mysql_secure_installation
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

service mysqld restart
 
 

Setting up REDIS

Currently you must set a password for redis:

vi /etc/redis.conf

Under SECURITY add:">

requirepass password #Change password to your password

service redis restart

 
 
 

Setting up Apache Config

You might notice that apache throws a warning when trying to restart it. You can fix this by altering the ServerName and making it match your ip address (IE ServerName 192.168.1.1:80)

 

Enable .htaccess override for OA/OQ and enable the 'LoadModule rewrite_module' and 'mod_rewrite.so'

We need to verify that LoadModule rewrite_module modules/mod_rewrite.so is enabled(not commented out) as some installs disable it.

Make sure that an .htaccess override is allowed and that AllowOverride is set to All for the correct DocumentRoot. In /etc/httpd/conf/httpd.conf You should see something similar to:

<Directory />

    Options FollowSymLinks

    AllowOverride None

</Directory>

We need to add .htaccess to, at the very minimum OpenQview if you intend to use it. Here is what we add after the above <Directory />:

<Directory "/var/www/html/openAnswer/app/webroot">

    Options Indexes FollowSymLinks

    AllowOverride All

    Order allow,deny

    Allow from all

</Directory>



<Directory "/var/www/html/openQview/app/webroot">

    Options Indexes FollowSymLinks

    AllowOverride All

    Order allow,deny

    Allow from all

</Directory>
 

Setting up VirtualHosts

We're also going to create the VirtualHosts that we need. 

Make sure to uncomment the "NameVirtualHost *:80" and then add the following:

<VirtualHost *:80>

    Header set Access-Control-Allow-Origin "*"

    RewriteEngine On

    ServerAdmin you@yourdomain.com

    DocumentRoot /var/www/html/openQview/app/webroot

    ServerName oq.mydomain.com

    ErrorLog logs/oq.mydomain.com-error_log

    CustomLog logs/oq.mydomain.com-access_log common

</VirtualHost>



<VirtualHost *:80>

    Header set Access-Control-Allow-Origin "*"

    RewriteEngine On

    ServerAdmin you@yourdomain.com

    DocumentRoot /var/www/html/openAnswer/app/webroot

    ServerName oa.mydomain.com

    ErrorLog logs/oa.mydomain.com-error_log

    CustomLog logs/oa.mydomain.com-access_log common

</VirtualHost>

And let's restart apache to update the config:

service httpd restart
 

Install OpenAnswer

Getting MySQL ready for OpenAnswer

mysql -uroot -p

create user oauser@'%' identified by 'PASSWORD';

GRANT USAGE ON *.* TO 'oauser'@'%' IDENTIFIED BY 'PASSWORD';

create database openanswer;

grant all privileges on openanswer.* to oauser@'%';

exit
 

Installing and Configuring OpenAnswer

Let's get the source from code.voicenation.com. We also rename the OA dir to match out VirtualHosts config.

cd /var/www/html

git clone http://code.voicenation.com/voicenation/openanswer.git

mv /var/www/html/openanswer /var/www/html/openAnswer

cd /var/www/html/openAnswer

mysql -uroot -p openanswer < openanswer.sql
 

Configs

Now we're going to set the config for connecting to the database.
Here we need to edit the lines for host,login,password and database for each entry.

cp app/Config/database.php.default app/Config/database.php

vi app/Config/database.php
 

Now we need to configure the main OpenAnswer config file to match our domain and server settings.

Here you can setup the admin email and your redis server information(IE password). CHANGE the "mydomain.com" to your specified domain!:

cp app/Config/core.php.default app/Config/core.php

vi app/Config/core.php
 

Note if you change the openConnectorServer port you will need to make it reflect in the OC settings.js file.

Next is the bootstrap config.
Go ahead and make the necessary changes here.(IE update the password and location for redis server.)

cp app/Config/bootstrap.php.default app/Config/bootstrap.php

vi app/Config/bootstrap.php
 

Now we need to setup the email config.
Go ahead and setup you STMP credentials.

cp app/Config/email.php.default app/Config/email.php

vi app/Config/email.php
 

Lastly we need to make sure that the app/tmp and it subdir are all owned and writable by the webserver:

chown -R apache.apache /var/www/html/openAnswer/app/tmp

At this point you should be able to login to OA via oa.mydomain.com

Install OpenConnector

We're going to use /home to house openconnector. You can store it anywhere you want.

Lets pull OpenConnector form Source. We also rename the OC to keep things similar

cd /home

git clone http://code.voicenation.com/voicenation/openconnector.git

mv openconnector openConnector

Next we need to make a copy of the settings.default.js for us to use:

cd openConnector

cp settings.default.js settings.js

Let's go ahead and setup the connection information needed in settings.js - You will need asteriskdb server user/pass, aserisk-ami server user/pass, oadb server user/pass, oqdb user/pass, smtp user/pass, REDIS server/pass

vi settings.js

Now we're going to run 'npm install' to install all the module dependencies for the NodeJs application.

npm install
 

Now we move the startup script

cp /home/openConnector/misc/openconnector.conf /etc/init

 

You need to edit the startup script to reflect the nvm location:

vi /etc/init/openconnector.conf

edit the following line:

exec /root/.nvm/v0.10.33/bin/node /home/openConnector/app.js >> /var/log/openconnjs.log 2>&1

and change it to

exec /root/.nvm/versions/node/v0.12.3/bin/node /home/openConnector/app.js >> /var/log/openconnjs.log 2>&1

We need to make a directory for the openConnector logs to go:

mkdir /var/log/openconnector

You should be able to start and stop openconnector via:

start openconnector

stop openconnector

Please check /var/log/openconn.js for errors.

OpenConnector will also generate errors if the asterisk box does not have at least 1 queue, or if you have not set the user in /etc/asterisk/manager.conf and allowed the ip of this machine.

Install OpenQview - Optional

Getting MySQL ready for OpenQview

mysql -uroot -p

create database openqview;

grant all privileges on openqview.* to oauser@'%';

exit
 

Installing and Configuring OpenQview

cd /var/www/html

git clone http://code.voicenation.com/voicenation/openqview.git

mv openqview openQview
 

Let's push the database

cd /var/www/html/openQview

mysql -uroot -p openqview < openqview.sql

Configs

Now we're going to set the config for connecting to the database.
Here we need to edit the lines for host,login,password and database for each entry.

cp app/Config/database.php.default app/Config/database.php

vi app/Config/database.php

Now we need to configure the main OpenQview config file to match our domain and server settings.
Here you can setup the admin email and your redis server information(IE password). CHANGE the "mydomain.com" to your specified domain!:

Note the lines you're looking for are 35-39 and 184-195

cp app/Config/core.default.php app/Config/core.php

vi app/Config/core.php

Lastly we need to make sure that the app/tmp and it subdir are all owned and writable by the webserver:

chown -R apache.apache /var/www/html/openQview/app/tmp

You should be able to view OpenQview at oq.mydomin.com now. Make sure OC is running or you won't see much going on.

IPTables and SELinux

If you want to keep IPTables and SELinux running you can do so with the following:

iptables

For iptables all you should need is to allow port 80 and 443:

iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 8081 -j ACCEPT
service iptables save
service iptables restart

SELinux

For SELinux we have to allow the REDIS port and MySQL:

yum install policycoreutils-python
semanage port -a -t http_port_t -p tcp 6379
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1

 

 

You can verify that 6379 is now allowed by:

[root@oaSELinux html]# semanage port -l | egrep '(^http_port_t|6379)'
http_port_t                    tcp      6379, 80, 81, 443, 488, 8008, 8009, 8443, 9000
mysqld_port_t                  tcp      1186, 3306, 63132-63164