Install Freeswitch on Centos 6

NOTE: You can now install Freeswitch on Centos using yum: http://wiki.freeswitch.org/wiki/Installation_Guide#CentOS

We are currently working to replace our current phone system. After tossing up between Asterisk and Freeswitch we decided to go with Freeswitch mainly for its stability and performance over Asterisk. We are running it on Centos 6. Below are the steps required to get it up and running.

  1. We need to use git to pull Freeswitch from the git repo. To install git we need the EPEL repository installed:
    [root@voip ~]# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    [root@voip ~]# yum install git
  2. Install the required packages:
    [root@voip src]# yum install autoconf automake gcc-c++ git-core libjpeg-devel libtool make ncurses-devel unixODBC-devel openssl-devel gnutls-devel libogg-devel libvorbis-devel curl-devel libtiff-devel libjpeg-devel python-devel expat-devel zlib zlib-devel bzip2 which
  3. Change directory and pull the source from the git repo:
    [root@voip src]# cd /usr/local/src
    [root@voip src]# git clone git://git.freeswitch.org/freeswitch.git
  4. Change into the just downloaded source code directory
    [root@voip src]# cd freeswitch/ 
  5. Run the bootstrap and configure scripts to create the required modules.conf and get the code ready for compiling
    [root@voip freeswitch]# ./bootstrap.sh
    [root@voip freeswitch]# ./configure --without-libcurl --without-pgsql 
  6. Edit the modules.conf file. Remove the # in front of any modules you want to compile:
    [root@voip freeswitch]# vim modules.conf
  7. Make and Install Freeswitch
    [root@voip freeswitch]# make && make install 
  8. Install the default sounds
    [root@voip freeswitch]# make uhd-sounds-install && make uhd-moh-install 
  9. Copy the init script and set the correct permissions
    [root@voip freeswitch]# cp build/freeswitch.init.redhat /etc/init.d/freeswitch
    [root@voip init.d]# chmod 755 /etc/init.d/freeswitch
  10. Configure Freeswitch to start on boot
    [root@voip freeswitch]# chkconfig --add freeswitch
    [root@voip freeswitch]# chkconfig freeswitch on 
  11. You need to change the default init script. It points to Freeswitch being installed in /opt/freeswitch/ however we installed it in /usr/local/freeswitch/
    You need to change the lines:

    FS_FILE=${FS_FILE-/opt/freeswitch/bin/freeswitch}
    FS_HOME=${FS_HOME-/opt/freeswitch} 

    To

    FS_FILE=${FS_FILE-/usr/local/freeswitch/bin/freeswitch}
    FS_HOME=${FS_HOME-/usr/local/freeswitch}
  12. Next we need to change the freeswitch directory permissions as we will be running it under the freeswitch account
    [root@voip local]# cd /usr/local
    [root@voip local]# chown -R freeswitch freeswitch
    [root@voip local]# chgrp -R freeswitch freeswitch 
  13. For performance reasons it is recommended to change the kernel boot parameters to disable the tickless feature. To do this you need to add nohz=off to the end of your boot parameters in your grub.conf.
    [root@voip freeswitch]# vim /boot/grub/grub.conf

    Add to the end of the line starting with kernel to add  nohz=off at the end. Mine becomes

    kernel /vmlinuz-2.6.32-71.el6.x86_64 ro root=/dev/mapper/vg_voip-lv_root rd_LVM_LV=vg_voip/lv_root rd_LVM_LV=vg_voip/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet nohz=off
  14. Restart for the kernel parameters to take effect

Further Reading and References: