Difference between revisions of "CentOS Install"

From FusionPBX
Jump to: navigation, search
(FreeSWITCH Install)
(Repositories)
 
(142 intermediate revisions by 11 users not shown)
Line 1: Line 1:
==Zaptel Install==
+
==Script Install==
 +
http://code.google.com/p/fusionpbx/source/browse/trunk/scripts/install/centos6/install_fusionpbx.sh
  
If this system is to use cards inside the phone server than Zaptel needs to be installed.
 
  
==Sangoma Wanpipe==
 
  
This is a Sangoma specific driver it can be used or Zaptel can be used. http://wiki.sangoma.com/wanpipe-freeswitch-install
+
== '''CentOS 6.4 Installation Steps''' ==
 +
  
Install dependency packages
+
http://wiki.fusionpbx.com/index.php?title=Installing_FusionPBX_3.2_on_CentOS_6.4_and_Mysql
  
sudo yum install -y kernel-devel.x86_64 zaptel-devel.x86_64
+
----
sudo yum install lksctp-tools-devel
 
sudo yum install flex libtermcap-devel bison
 
  
==Get zaptel source==
+
==Preface==
 +
The following instructions were written for CentOS 5.6. http://mirror.centos.org/centos/5/isos/ After installing CentOS follow the instructions below.
  
cd /usr/src
+
Instructions to install FusionPBX with CentOS 6.2 and PostgreSQL can be found at: http://wiki.fusionpbx.com/index.php/CentOS_6.2_with_PostgreSQL
svn checkout http://svn.digium.com/svn/zaptel/branches/1.4 zaptel
 
  
or
+
[[http://wiki.fusionpbx.com/index.php/CentOS_6.2_with_PostgreSQL]]
 
 
cd /usr/src/
 
wget http://downloads.asterisk.org/pub/telephony/zaptel/zaptel-1.4.12.1.tar.gz
 
 
 
Get wanpipe source
 
 
 
cd /usr/src/
 
wget ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-latest.tgz
 
tar xvfz wanpipe-latest.tgz
 
cd /usr/src/wanpipe-*
 
 
 
 
 
Install wanpipe
 
 
 
bash -p Setup install
 
  
 +
==Dependencies==
 +
Install the following dependencies
 +
yum -y install subversion autoconf automake libtool gcc-c++ git-core ncurses-devel make expat-devel bison zlib zlib-devel ghostscript gettext-devel
 +
yum -y install nano unixODBC-devel openssl-devel gnutls-devel libogg-devel libvorbis-devel curl-devel libtiff-devel libjpeg-devel python-devel expat-devel zlib zlib-devel bzip2
  
Would you like to install WANPIPE now? [y] (y/n) y Press [Enter] to continue... Please specify absolute path name of your linux headers/source directory
+
==Repositories==
  
Press Enter for Default: /lib/modules/2.6.18-164.el5/build /usr/src/kernels/2.6.18-164.11.1.el5-x86_64/
+
CentOS does not yet ship a recent enough version of PHP in order to use PHP FPM (fast cgi), so we suggest you use the RPMs provided in the Webtatic repository. Also, this allows GIT to be installed via YUM.
 +
To do so:
  
Install modules for current image: 2.6.18-164.el5 ? (y/n) y
 
 
Press [Enter] to continue...
 
 
Please Select Compilation Mode Please select (1-11) [Default: 1]:
 
 
10. TDM API
 
 
   
 
   
      Protocols: TDM API on AFT adapters:
+
Use this link for EPEL repository for 32 bit machines
      Default for: FreeSwitch, Yate, Sunrise
 
                    Custom voice development
 
  
  Please select (1-11) [Default: 1]: 10
+
  rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
 
Please select a protocol option in [<opt>]: ALL (for all)
 
 
Please select working zaptel directory [1-1][m]: m
 
 
Please enter zaptel dir: [Default: /usr/src/zaptel]
 
 
    1. > /usr/src/zaptel
 
  
Checking for UDEV Zaptel compatibility...
+
Use this link for EPEL repository for 64 bit machines
 
  Would you like to add UDEV rules for Zaptel devices ? (y/n) n
 
 
Press [Enter] to continue... Press [Enter] to continue...
 
 
[EXIT|Q|q]: Exit Protocol Selection
 
 
Please select a protocol option in [<opt>]: EXIT
 
 
Visually Confirm that driver compilation was successful! (y/n) y
 
 
 
    WANPIPE v3.5.10 Installation Script
 
    Copyright (c) 1995-2009, Sangoma Technologies Inc.
 
 
WANPIPE META CONFIGURATION
 
 
There are two configuration files associated with WANPIPE.
 
 
1) /usr/src/wanpipe-3.5.10/wanrouter.rc:
 
 
        - defines locations of important files such as lock
 
          and configuration files as well as start/stop
 
          order of multiple WANPIPE devices.
 
 
2) /usr/src/wanpipe-3.5.10/wanpipe1.conf:
 
 
        - main configuration file for each WANPIPE device.
 
        - defines interfaces, hardware and protocol information.
 
        - this file can be created using the 'wancfg' GUI
 
          utility or manually based on sample files located
 
          in /etc/wanpipe/samples.
 
  
  Please read the WanpipeInstallation.(pdf/txt) manual for further information.
+
  rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
+
--[[User:PoolPro|PoolPro]] 23:35, 26 February 2012 (UTC)
Press [Enter] to continue...
 
 
Please specify a desired location for WANPIPE configuration files.
 
 
        (Press Enter for Default: /etc/wanpipe)
 
 
<specify path:> /etc/wanpipe
 
 
Please specify a desired location for WANPIPE interface files.
 
 
        (Press Enter for Default: /etc/wanpipe/interfaces)
 
 
<specify path:> /etc/wanpipe/interfaces
 
 
Please specify a location for WANPIPE binary, firmware files.
 
 
        (Press Enter for Default: /etc/wanpipe/firmware)
 
 
<specify path:> /etc/wanpipe/firmware
 
 
 
    WANPIPE v3.5.10 Installation Script
 
    Copyright (c) 1995-2009, Sangoma Technologies Inc.
 
 
WANPIPE UTILITIES SETUP
 
 
WANPIPE utilities are used to:
 
 
        1) create configuration files: for Zaptel and Asterisk
 
                /usr/sbin/wancfg_zaptel #Zaptel and Asterisk
 
                /usr/sbin/wancfg_dahdi  #Dahdi and Asterisk
 
                /usr/sbin/wancfg_smg    #BRI/SS7, Zaptel and Asterisk
 
                /usr/sbin/wancfg_tdmapi #TDM API
 
        2) create WANPIPE WAN/IP configuration files.
 
                (/usr/sbin/wancfg)
 
        3) start,stop,restart individual/all devices and interfaces.
 
                (/usr/sbin/wanrouter)
 
        4) debug line, protocol and driver problems.
 
                (/usr/sbin/wanpipemon)
 
        5) aid in WANPIPE API development
 
                (/etc/wanpipe/api)
 
 
 
Refer to the WanpipeInstallation.(pdf/txt) for more information.
 
 
Press [Enter] to continue...
 
 
Press [Enter] to continue...
 
 
 
Installing WANPIPE Files ... ! Installing WANPIPE Utilities in /usr/sbin Installing wanrouter.rc in /etc/wanpipe Installing wanpipe libraries in  /etc/wanpipe Installing firmware in /etc/wanpipe/firmware Installing documentation in /usr/share/doc/wanpipe Installing sample api code in /etc/wanpipe/api Installing AFT Firmware update utility in /etc/wanpipe/util Installing driver headers in /etc/wanpipe/api/include/linux Installing Hardware Echo Cancel Utilites Press [Enter] to continue...
 
 
 
Would you like to install WANPIPE start-up scripts? (y/n) y
 
 
 
    WANPIPE v3.5.10 Installation Script
 
    Copyright (c) 1995-2009, Sangoma Technologies Inc.
 
 
WANPIPE INSTALLATON: COMPLETE
 
 
WANPIPE installation is now complete. WANPIPE kernel drivers and configuration/debug utilities have been compiled and installed.
 
 
 
        1) Proceed to configure the WANPIPE drivers:
 
                Asterisk/Zaptel  : /usr/sbin/wancfg_zaptel
 
                Asterisk/Dahdi  : /usr/sbin/wancfg_dahdi
 
                TDM API          : /usr/sbin/wancfg_tdmapi
 
                SMG SS7/BRI/PRI  : /usr/sbin/wancfg_smg
 
                WAN Routing/API  : /usr/sbin/wancfg
 
        2) Use the /usr/sbin/wanrouter startup script to start and stop
 
          the router. (eg: wanrouter start)
 
        3) To uninstall WANPIPE package run ./Setup remove
 
 
Please read http://wiki.sangoma.com for further instructions.
 
 
 
 
 
Sometimes you need an
 
 
 
depmod -a
 
  
 
==GIT Install==
 
==GIT Install==
cd /usr/local/src
+
Since we added the epel repo, GIT can be installed via YUM
yum -y install gcc gcc-c++ make gettext-devel expat-devel curl-devel zlib-devel openssl-devel bzip2
 
wget http://kernel.org/pub/software/scm/git/git-1.7.4.tar.bz2
 
tar -xvjf git-1.7.4.tar.bz2
 
cd git-1.7.4
 
make prefix=/usr/local all
 
make prefix=/usr/local install
 
  
==Dependencies Install==
+
  yum -y install git
Install the following dependencies
 
  yum install subversion autoconf automake libtool gcc-c++ git-core ncurses-devel make expat-devel zlib zlib-devel
 
yum install nano unixODBC-devel openssl-devel gnutls-devel libogg-devel libvorbis-devel curl-devel libtiff-devel libjpeg-devel python-devel expat-devel zlib zlib-devel bzip2
 
  
 
==FreeSWITCH Install==
 
==FreeSWITCH Install==
Line 197: Line 48:
  
 
  cd /usr/src/
 
  cd /usr/src/
  git clone git://git.freeswitch.org/freeswitch.git
+
  git clone -b v1.4 https://freeswitch.org/stash/scm/fs/freeswitch.git
 
  cd /usr/src/freeswitch
 
  cd /usr/src/freeswitch
 
  ./bootstrap.sh
 
  ./bootstrap.sh
  
 
Edit modules.conf to enable or disable desired modules. To enable a few extra features you may want to go ahead and edit modules.conf. Remove the # in front of the lines with these modules:
 
Edit modules.conf to enable or disable desired modules. To enable a few extra features you may want to go ahead and edit modules.conf. Remove the # in front of the lines with these modules:
 +
mod_rtmp
 +
mod_directory
 +
mod_callcenter
 +
mod_tts_commandline
 +
mod_dingaling
 +
mod_flite
 +
mod_shout
 +
mod_pocketsphinx
 +
mod_cidlookup
  
mod_spandsp
 
mod_shout
 
mod_flite
 
mod_pocketshpinx
 
  
 
Complete the FreeSWITCH compile.
 
Complete the FreeSWITCH compile.
Line 212: Line 68:
 
  ./configure
 
  ./configure
 
  make install
 
  make install
 +
make samples
 +
 +
8 kHz Standard Audio
 +
make sounds-install
 +
make moh-install
 +
 +
16 kHz High Definition Audio
 +
make hd-moh-install
 +
make hd-sounds-install
 +
 +
32 kHz Ultra High Definition Audio
 +
make uhd-moh-install
 +
make uhd-sounds-install
 +
 +
48 kHz CD Quality Audio
 
  make cd-sounds-install
 
  make cd-sounds-install
 
  make cd-moh-install
 
  make cd-moh-install
make hd-moh-install
+
 
make hd-sounds-install
 
  
 
  +---------- FreeSWITCH install Complete ----------+
 
  +---------- FreeSWITCH install Complete ----------+
Line 270: Line 140:
  
  
In the future to upgrade use the following:
+
To upgrade FreeSWITCH in the future do the following:
  
 
  cd /usr/src/freeswitch
 
  cd /usr/src/freeswitch
 
  make current
 
  make current
 
After this you have the latest FreeSWITCH ready for use with FusionPBX
 
  
 
==FreeSWITCH Auto Start==
 
==FreeSWITCH Auto Start==
Line 283: Line 151:
 
   cp build/freeswitch.init.redhat /etc/init.d/freeswitch
 
   cp build/freeswitch.init.redhat /etc/init.d/freeswitch
  
Open /etc/init.d/freeswitch and change the freeswitch-directory from /opt/freeswitch to /usr/local/freeswitch
+
Replace /opt/freeswitch with /usr/local/freeswitch in the /etc/init.d/freeswitch
  
  nano /etc/init.d/freeswich
+
sed -i 's/\/opt\/freeswitch/\/usr\/local\/freeswitch/g' /etc/init.d/freeswitch
  ''PID_FILE=${PID_FILE-'''/usr/local/'''freeswitch/run/freeswitch.pid}
 
  ''FS_FILE=${FS_FILE-'''/usr/local/'''freeswitch/bin/freeswitch}''
 
  ''FS_HOME=${FS_HOME-'''/usr/local/'''freeswitch}''
 
 
 
  
 +
Set the permissions and add it to run on startup
  
Set the permissions and add it to run on startup
+
chmod 765 /etc/init.d/freeswitch
 +
/sbin/chkconfig --add freeswitch
 +
/sbin/chkconfig --level 5 freeswitch on
 +
/sbin/chkconfig --list freeswitch
  
chmod 755 /etc/init.d/freeswitch
+
==FreeSWITCH conf==
chkconfig --add freeswitch
 
chkconfig --level 5 freeswitch on
 
chkconfig --list freeswitch
 
  
==CentoOS 32-bit Install==
+
Disable the following files but leave them for examples
  
    * Take a look at, installing FusionPBX on CentOS in 4 Steps.  
+
cd /usr/local/freeswitch/conf/dialplan/default
 +
mv 00_ladspa.xml 00_ladspa.noload
 +
mv 00_pizza_demo.xml 00_pizza_demo.noload
 +
mv 01_Talking_Clock.xml 01_Talking_Clock.noload
  
==CentoOS 64-bit Install==
 
  
If you don't have 64-bit support, just remove x86_64 from the below packages.
+
==SELinux==
  
==Additional Tools==
+
Can create problems for file access and running services. The following link describes how to disable SELinux.
  
On CentOS w/ 64-bit support: CentOS does not yet ship a recent enough version of PHP, so we suggest you use the RPMs provided in the REMI repository. To do so:
+
http://www.crypt.gen.nz/selinux/disable_selinux.html
  
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
+
==Database==
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
 
rpm -Uvh epel-release-5-4.noarch.rpm
 
rpm -Uvh remi-release-5.rpm
 
  
 +
===SQLite===
  
yum install zaptel.x86_64 zaptel-lib.x86_64 zaptel-utils.x86_64 libpri.x86_64 spandsp.x86_64
+
Is installed with PHP
  
PostgreSQL
+
===PostgreSQL===
  
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm 
+
Postgres 8.4 or higher is required. The following instructions install version 9.0
yum --enablerepo=remi install php php-common php-pgsql php-pdo php-soap php-xml php-xmlrpc
+
Replace the custom-username and custom-password with the account information.
yum --enablerepo=remi upgrade php php-common php-pdo
 
  
 +
http://wiki.postgresql.org/wiki/YUM_Installation (additional information)
  
MySQL
+
Locate and edit your distributions .repo file, located: [base] and [updates] sections
 +
nano /etc/yum.repos.d/CentOS-Base.repo
  
Before installing the remi packages, it is suggested that you install the dependent libraries. The upstream packages does not have the correct version and conflict with each other. To do so:
+
To the section(s) identified above, you need to append a line:
 +
exclude=postgresql*
  
  wget http://downloads.mysql.com/archives/mysql-5.1/MySQL-shared-compat-5.1.30-0.rhel5.x86_64.rpm
+
Download and install PGDG RPM file
  rpm -Uvh MySQL-shared-compat-5.1.30-0.rhel5.x86_64.rpm
+
  wget http://yum.postgresql.org/9.0/redhat/rhel-5-i386/pgdg-centos90-9.0-5.noarch.rpm
 +
rpm -ivh pgdg-centos-9.0-5.noarch.rpm
 +
  yum install postgresql90-server
 +
service postgresql-9.0 initdb
 +
/sbin/chkconfig postgresql-9.0 on
 +
service postgresql-9.0 start
 +
su postgres
 +
psql
 +
CREATE ROLE custom-username WITH SUPERUSER LOGIN PASSWORD 'custom-password';
 +
\q
 +
exit
 +
sed -i 's/ident/md5/g' /var/lib/pgsql/9.0/data/pg_hba.conf
 +
service postgresql-9.0 restart
  
If you get a conflict, force it.
+
===MySQL===
  
  rpm -Uvh MySQL-shared-compat-5.1.30-0.rhel5.x86_64.rpm --force
+
Check to see if MySQL is installed
 +
  yum --enablerepo=webtatic list mysql55 mysql55-server
 +
 +
If it is installed then update it to a newer version
  
Now that you have all the version of mysql client libraries; things just install cleanly.
+
yum --enablerepo=webtatic upgrade mysql55 mysql55-server
  
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm  yum --enablerepo=remi install php php-common php-mysql php-pdo php-soap php-xml php-xmlrpc
+
If it is not installed then add it
yum --enablerepo=remi upgrade php php-common php-pdo
 
  
==Permissions==
+
yum –-enablerepo=webtatic install mysql55 mysql55-server
 +
/sbin/chkconfig mysqld on
 +
service mysqld start
  
Set permissions
+
Set the root password
 +
mysqladmin -u root password new_password_here
 +
mysqladmin -h 127.0.0.1 -u root password new_password_here
  
adduser freeswitch
+
==PHP==
chown -R freeswitch:freeswitch /usr/local/freeswitch
 
chown -R apache:apache /var/www/fusionpbx
 
chmod 766 -R /var/www/fusionpbx
 
  
Add the apache user to the freeswitch group
+
yum --enablerepo=webtatic install php php-common php-pdo php-soap php-xml php-xmlrpc
 +
yum --enablerepo=webtatic upgrade php php-common php-pdo
  
nano /etc/group
+
For PostgreSQL add
  
Before:
+
yum --enablerepo=webtatic install php-pgsql
  
freeswitch:x:500
+
For MySQL then add
  
After:
+
yum --enablerepo=webtatic install php-mysql mysql-connector-odbc
  
  freeswitch:x:500:freeswitch,apache
+
Install PHP Fast CGI
 +
  yum --enablerepo=webtatic install php-fpm
 +
/sbin/chkconfig php-fpm on
  
==Fusionpbx==
+
==Web Server==
  
Dependencies Subversion
+
There are multiple choices for a web server to use. These instructions focus on nginx because it takes very little server resources and scales well.
  
  yum install subversion
+
NGINX (pronounced: engine x)
 +
  yum --enablerepo=webtatic install nginx
 +
/sbin/chkconfig nginx on
  
Apache
+
Add the following directories.
  
yum install apache2
+
mkdir /etc/nginx/sites-available
 +
mkdir /etc/nginx/sites-enabled
  
PHP >= 5.2.3
+
Remove the original config and add a more flexible one. Don't try to paste these in all at once because the "rm"  and the wgets will make you miss something following.
  
  yum install php5 php5-pdo php-sqlite php5-pdo_sqlite
+
  cd /etc/nginx
 +
rm nginx.conf
 +
wget http://www.fusionpbx.com/downloads/centos/nginx/nginx.conf
 +
cd /etc/nginx/sites-available
 +
wget http://www.fusionpbx.com/downloads/centos/nginx/fusionpbx.conf
 +
ln /etc/nginx/sites-available/fusionpbx.conf /etc/nginx/sites-enabled/fusionpbx.conf
  
Install the backend of your choice
+
==OpenSSL==
  
sqlite
+
Make sure the /etc/ssl directory exists
 +
mkdir -p /etc/ssl
 +
Change the directory
 +
cd /etc/ssl
 +
Generate a private key:
 +
openssl genrsa -des3 -passout pass:fusionpbx_cert_password -out fusionpbx.ssl.key 1024
 +
Remove password from private key:
 +
openssl rsa -in fusionpbx.ssl.key -passin pass:fusionpbx_cert_password -out fusionpbx.ssl.key.nopass
 +
Create a CSR (certificate signing request):
 +
openssl req -new -key fusionpbx.ssl.key.nopass -out fusionpbx.ssl.csr -subj "/CN=fusionpbx/OU=Project/O=FusionPBX/L=Boise/C=US"
 +
Generate self-signed cert:
 +
openssl x509 -req -days 3650 -in fusionpbx.ssl.csr -signkey fusionpbx.ssl.key.nopass -out fusionpbx.ssl.crt
  
yum install sqlite3 php5-pdo_sqlite
+
==FusionPBX==
  
mysql
+
Download FusionPBX source and add it to the web server directory.
  
  yum install mysql-server.x86_64 mysql.x86_64 mysql-server-devel.x86_64 php5-pdo_mysql
+
  cd /var/www
 +
  svn checkout http://fusionpbx.googlecode.com/svn/trunk/fusionpbx /var/www/fusionpbx
  
postgresql
+
If you get an error: 'svn: command not found.' Then add subversion. Then run the svn checkout again.
  
  yum install php5-pdo_pgsql postgresql-server.x86_64 postgresql.x86_64
+
  yum install subversion
  
FusionPBX install
+
==Permissions==
 +
There are multiple ways to handle permissions. FreeSWITCH creates some file on demand such as voicemail and does not give the necessary group permissions because of that the following method is currently recommended. This method adds the www-data user, changes ownership of the files to use www-data and then make the php-fpm and freeswitch services run as www-data.
  
Download FusionPBX source and add it to Apache
+
/usr/sbin/adduser www-data
 +
chown -R www-data:www-data /usr/local/freeswitch
 +
chown -R www-data:www-data /var/www/fusionpbx
 +
sed -i 's/user = apache/user = www-data/g' /etc/php-fpm.d/www.conf
 +
sed -i 's/group = apache/group = www-data/g' /etc/php-fpm.d/www.conf
 +
sed -i 's/${FS_USER-freeswitch}/${FS_USER-www-data}/g' /etc/init.d/freeswitch
 +
chown -R www-data:www-data -R /var/lib/php/session
  
cd /var/www
 
sudo svn checkout http://fusionpbx.googlecode.com/svn/trunk/fusionpbx /var/www/fusionpbx
 
  
===Network Time Protocol===
+
==Network Time Protocol==
  
 
If NTP is not installed then install it.
 
If NTP is not installed then install it.
Line 412: Line 322:
 
  ntpdate pool.ntp.org
 
  ntpdate pool.ntp.org
 
  service ntpd start
 
  service ntpd start
 +
 +
==Fail2ban==
 +
 +
Brute force attacks are common. If the SIP and RTP ports are exposed to the Internet then it is important to install and configure Fail2ban.  Fail2ban can be configured to analyze the FreeSWITCH logs. When attacker are identified it blocks the offenders.
 +
 +
yum install fail2ban
 +
cd /etc/init.d
 +
/sbin/chkconfig fail2ban on
 +
 +
The configurations directory is
 +
/etc/fail2ban
 +
 +
For more info go to [[Fail2Ban]]
 +
 +
==Start the remaining services==
 +
 +
Start php-fpm (Without doing so will result in ERR 502 BAD GATEWAY)
 +
 +
service php-fpm start
 +
 +
Start FreeSWITCH
 +
service freeswitch start
 +
 +
Start nginx (Web Server)
 +
 +
service nginx start
 +
 +
==Browser==
 +
 +
To complete install go to the ip address or domain of the server in your web browser. You can use http or https and follow the instructions.
 +
 +
==Login==
 +
 +
After completing the install the default login information is whatever you set during setup
 +
after your initial connection to the web page.
 +
 +
Defaults used to be:
 +
 +
user: superadmin
 +
 +
pass: fusionpbx
 +
 +
System setup now makes you choose
 +
 +
==TDM notes==
 +
 +
Optional TDM card notes. These notes have not been updated in a while.
 +
[[CentOS Install TDM]]
  
 
==Additional Notes==
 
==Additional Notes==
  
 
How to start stop FreeSWITCH
 
How to start stop FreeSWITCH
 +
service freeswitch start
 +
service freeswitch stop
  
/usr/local/freeswitch/bin/freeswitch -stop
+
How to start, stop and restart nginx (Web Server)
/usr/local/freeswitch/bin/freeswitch -nc
 
  
How to start, stop and restart Apache
+
  service nginx start
 
+
  service nginx stop
  service httpd start
+
  service nginx restart
  service httpd stop
 
  service httpd restart
 
  
 
Change the CentOS root password
 
Change the CentOS root password
Line 430: Line 387:
 
  su root
 
  su root
 
  passwd
 
  passwd
 +
 +
== '''Alternate method'''==
 +
You can follow next [https://okay.com.mx/en/entrepreneurs/install-fusionpbx-in-a-moment.html directions] to install the software using RPMS. It has been tested on Centos 6.6 and 7.

Latest revision as of 02:38, 22 April 2015

Script Install

http://code.google.com/p/fusionpbx/source/browse/trunk/scripts/install/centos6/install_fusionpbx.sh


CentOS 6.4 Installation Steps

http://wiki.fusionpbx.com/index.php?title=Installing_FusionPBX_3.2_on_CentOS_6.4_and_Mysql


Preface

The following instructions were written for CentOS 5.6. http://mirror.centos.org/centos/5/isos/ After installing CentOS follow the instructions below.

Instructions to install FusionPBX with CentOS 6.2 and PostgreSQL can be found at: http://wiki.fusionpbx.com/index.php/CentOS_6.2_with_PostgreSQL

[[1]]

Dependencies

Install the following dependencies

yum -y install subversion autoconf automake libtool gcc-c++ git-core ncurses-devel make expat-devel bison zlib zlib-devel ghostscript gettext-devel
yum -y install nano unixODBC-devel openssl-devel gnutls-devel libogg-devel libvorbis-devel curl-devel libtiff-devel libjpeg-devel python-devel expat-devel zlib zlib-devel bzip2

Repositories

CentOS does not yet ship a recent enough version of PHP in order to use PHP FPM (fast cgi), so we suggest you use the RPMs provided in the Webtatic repository. Also, this allows GIT to be installed via YUM. To do so:


Use this link for EPEL repository for 32 bit machines

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Use this link for EPEL repository for 64 bit machines

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

--PoolPro 23:35, 26 February 2012 (UTC)

GIT Install

Since we added the epel repo, GIT can be installed via YUM

yum -y install git

FreeSWITCH Install

Then use the following

cd /usr/src/
git clone -b v1.4 https://freeswitch.org/stash/scm/fs/freeswitch.git
cd /usr/src/freeswitch
./bootstrap.sh

Edit modules.conf to enable or disable desired modules. To enable a few extra features you may want to go ahead and edit modules.conf. Remove the # in front of the lines with these modules:

mod_rtmp
mod_directory
mod_callcenter
mod_tts_commandline
mod_dingaling
mod_flite
mod_shout
mod_pocketsphinx
mod_cidlookup


Complete the FreeSWITCH compile.

./configure
make install
make samples

8 kHz Standard Audio

make sounds-install
make moh-install

16 kHz High Definition Audio

make hd-moh-install
make hd-sounds-install

32 kHz Ultra High Definition Audio

make uhd-moh-install
make uhd-sounds-install

48 kHz CD Quality Audio

make cd-sounds-install
make cd-moh-install


+---------- FreeSWITCH install Complete ----------+
+ FreeSWITCH has been successfully installed.     +
+                                                 +
+       Install sounds:                           +
+       (uhd-sounds includes hd-sounds, sounds)   +
+       (hd-sounds includes sounds)               +
+       ------------------------------------      +
+                make cd-sounds-install           +
+                make cd-moh-install              +
+                                                 +
+                make uhd-sounds-install          +
+                make uhd-moh-install             +
+                                                 +
+                make hd-sounds-install           +
+                make hd-moh-install              +
+                                                 +
+                make sounds-install              +
+                make moh-install                 +
+                                                 +
+       Install non english sounds:               +
+       replace XX with language                  +
+       (ru : Russian)                            +
+       ------------------------------------      +
+                make cd-sounds-XX-install        +
+                make uhd-sounds-XX-install       +
+                make hd-sounds-XX-install        +
+                make sounds-XX-install           +
+                                                 +
+       Upgrade to latest:                        +
+       ----------------------------------        +
+                make current                     +
+                                                 +
+       Rebuild all:                              +
+       ----------------------------------        +
+                make sure                        +
+                                                 +
+       Install/Re-install default config:        +
+       ----------------------------------        +
+                make samples                     +
+                                                 +
+                                                 +
+       Additional resources:                     +
+       ----------------------------------        +
+       http://www.freeswitch.org               +
+       http://wiki.freeswitch.org              +
+       http://jira.freeswitch.org              +
+       http://lists.freeswitch.org             +
+                                                 +
+       irc.freenode.net / #freeswitch            +
+                                                 +
+-------------------------------------------------+


To upgrade FreeSWITCH in the future do the following:

cd /usr/src/freeswitch
make current

FreeSWITCH Auto Start

Copy the sample-init-file to /etc/init.d/

 cp build/freeswitch.init.redhat /etc/init.d/freeswitch

Replace /opt/freeswitch with /usr/local/freeswitch in the /etc/init.d/freeswitch

sed -i 's/\/opt\/freeswitch/\/usr\/local\/freeswitch/g' /etc/init.d/freeswitch

Set the permissions and add it to run on startup

chmod 765 /etc/init.d/freeswitch
/sbin/chkconfig --add freeswitch
/sbin/chkconfig --level 5 freeswitch on
/sbin/chkconfig --list freeswitch

FreeSWITCH conf

Disable the following files but leave them for examples

cd /usr/local/freeswitch/conf/dialplan/default
mv 00_ladspa.xml 00_ladspa.noload
mv 00_pizza_demo.xml 00_pizza_demo.noload
mv 01_Talking_Clock.xml 01_Talking_Clock.noload


SELinux

Can create problems for file access and running services. The following link describes how to disable SELinux.

http://www.crypt.gen.nz/selinux/disable_selinux.html

Database

SQLite

Is installed with PHP

PostgreSQL

Postgres 8.4 or higher is required. The following instructions install version 9.0 Replace the custom-username and custom-password with the account information.

http://wiki.postgresql.org/wiki/YUM_Installation (additional information)

Locate and edit your distributions .repo file, located: [base] and [updates] sections

nano /etc/yum.repos.d/CentOS-Base.repo

To the section(s) identified above, you need to append a line:

exclude=postgresql*

Download and install PGDG RPM file

wget  http://yum.postgresql.org/9.0/redhat/rhel-5-i386/pgdg-centos90-9.0-5.noarch.rpm
rpm -ivh pgdg-centos-9.0-5.noarch.rpm
yum install postgresql90-server
service postgresql-9.0 initdb
/sbin/chkconfig postgresql-9.0 on
service postgresql-9.0 start
su postgres
psql
CREATE ROLE custom-username WITH SUPERUSER LOGIN PASSWORD 'custom-password';
\q
exit
sed -i 's/ident/md5/g' /var/lib/pgsql/9.0/data/pg_hba.conf
service postgresql-9.0 restart

MySQL

Check to see if MySQL is installed

yum --enablerepo=webtatic list mysql55 mysql55-server

If it is installed then update it to a newer version

yum --enablerepo=webtatic upgrade mysql55 mysql55-server

If it is not installed then add it

yum –-enablerepo=webtatic install mysql55 mysql55-server
/sbin/chkconfig mysqld on
service mysqld start

Set the root password

mysqladmin -u root password new_password_here
mysqladmin -h 127.0.0.1 -u root password new_password_here

PHP

yum --enablerepo=webtatic install php php-common php-pdo php-soap php-xml php-xmlrpc 
yum --enablerepo=webtatic upgrade php php-common php-pdo

For PostgreSQL add

yum --enablerepo=webtatic install php-pgsql

For MySQL then add

yum --enablerepo=webtatic install php-mysql mysql-connector-odbc

Install PHP Fast CGI

yum --enablerepo=webtatic install php-fpm
/sbin/chkconfig php-fpm on

Web Server

There are multiple choices for a web server to use. These instructions focus on nginx because it takes very little server resources and scales well.

NGINX (pronounced: engine x)

yum --enablerepo=webtatic install nginx
/sbin/chkconfig nginx on

Add the following directories.

mkdir /etc/nginx/sites-available
mkdir /etc/nginx/sites-enabled

Remove the original config and add a more flexible one. Don't try to paste these in all at once because the "rm" and the wgets will make you miss something following.

cd /etc/nginx
rm nginx.conf
wget http://www.fusionpbx.com/downloads/centos/nginx/nginx.conf
cd /etc/nginx/sites-available
wget http://www.fusionpbx.com/downloads/centos/nginx/fusionpbx.conf
ln /etc/nginx/sites-available/fusionpbx.conf /etc/nginx/sites-enabled/fusionpbx.conf

OpenSSL

Make sure the /etc/ssl directory exists

mkdir -p /etc/ssl

Change the directory

cd /etc/ssl

Generate a private key:

openssl genrsa -des3 -passout pass:fusionpbx_cert_password -out fusionpbx.ssl.key 1024

Remove password from private key:

openssl rsa -in fusionpbx.ssl.key -passin pass:fusionpbx_cert_password -out fusionpbx.ssl.key.nopass

Create a CSR (certificate signing request):

openssl req -new -key fusionpbx.ssl.key.nopass -out fusionpbx.ssl.csr -subj "/CN=fusionpbx/OU=Project/O=FusionPBX/L=Boise/C=US"

Generate self-signed cert:

openssl x509 -req -days 3650 -in fusionpbx.ssl.csr -signkey fusionpbx.ssl.key.nopass -out fusionpbx.ssl.crt

FusionPBX

Download FusionPBX source and add it to the web server directory.

cd /var/www
svn checkout http://fusionpbx.googlecode.com/svn/trunk/fusionpbx /var/www/fusionpbx

If you get an error: 'svn: command not found.' Then add subversion. Then run the svn checkout again.

yum install subversion

Permissions

There are multiple ways to handle permissions. FreeSWITCH creates some file on demand such as voicemail and does not give the necessary group permissions because of that the following method is currently recommended. This method adds the www-data user, changes ownership of the files to use www-data and then make the php-fpm and freeswitch services run as www-data.

/usr/sbin/adduser www-data
chown -R www-data:www-data /usr/local/freeswitch
chown -R www-data:www-data /var/www/fusionpbx
sed -i 's/user = apache/user = www-data/g' /etc/php-fpm.d/www.conf
sed -i 's/group = apache/group = www-data/g' /etc/php-fpm.d/www.conf
sed -i 's/${FS_USER-freeswitch}/${FS_USER-www-data}/g' /etc/init.d/freeswitch
chown -R www-data:www-data -R /var/lib/php/session


Network Time Protocol

If NTP is not installed then install it.

yum install ntp
chkconfig ntpd on
ntpdate pool.ntp.org
service ntpd start

If NTP is running then do the following:

service ntpd stop
ntpdate pool.ntp.org
service ntpd start

Fail2ban

Brute force attacks are common. If the SIP and RTP ports are exposed to the Internet then it is important to install and configure Fail2ban. Fail2ban can be configured to analyze the FreeSWITCH logs. When attacker are identified it blocks the offenders.

yum install fail2ban
cd /etc/init.d
/sbin/chkconfig fail2ban on

The configurations directory is

/etc/fail2ban

For more info go to Fail2Ban

Start the remaining services

Start php-fpm (Without doing so will result in ERR 502 BAD GATEWAY)

service php-fpm start

Start FreeSWITCH

service freeswitch start

Start nginx (Web Server)

service nginx start

Browser

To complete install go to the ip address or domain of the server in your web browser. You can use http or https and follow the instructions.

Login

After completing the install the default login information is whatever you set during setup after your initial connection to the web page.

Defaults used to be:

user: superadmin

pass: fusionpbx

System setup now makes you choose

TDM notes

Optional TDM card notes. These notes have not been updated in a while. CentOS Install TDM

Additional Notes

How to start stop FreeSWITCH

service freeswitch start
service freeswitch stop

How to start, stop and restart nginx (Web Server)

service nginx start
service nginx stop
service nginx restart

Change the CentOS root password

su root
passwd

Alternate method

You can follow next directions to install the software using RPMS. It has been tested on Centos 6.6 and 7.