Difference between revisions of "Easy FusionPBX"

From FusionPBX
Jump to: navigation, search
(Created page with "=Supported Distributions= ==Debian== ===Lenny=== ===Squeeze=== ==Ubuntu== ===10.04 LTS Lucid=== ===12.04 LTS Precise=== ==Download Ubuntu 10.04 Server LTS (Lucid)== http://w...")
 
Line 141: Line 141:
 
----
 
----
  
====Older Versions====
+
===Older Versions===
 
Please see [[Easy_Ubuntu_10.04_Old_Script_Versions]] for Errata, errors, and fixes.
 
Please see [[Easy_Ubuntu_10.04_Old_Script_Versions]] for Errata, errors, and fixes.
  
===Options===
+
==Options==
 
<pre>
 
<pre>
 
This script should be called as:
 
This script should be called as:
Line 169: Line 169:
 
</pre>
 
</pre>
  
===Install==
+
==Install==
 
----
 
----
 
  sudo install_fusionpbx install-both user
 
  sudo install_fusionpbx install-both user
  
===Variables===
+
==Variables==
 
----
 
----
 
These are included to make the auto mode more flexible. Open the script and set them however you wish.
 
These are included to make the auto mode more flexible. Open the script and set them however you wish.
Line 198: Line 198:
 
:modules_add=( mod_dingaling mod_portaudio mod_callcenter mod_lcr mod_cidlookup mod_directory mod_flite mod_pocketsphinx mod_xml_rpc mod_xml_cdr mod_xml_curl mod_say_es )
 
:modules_add=( mod_dingaling mod_portaudio mod_callcenter mod_lcr mod_cidlookup mod_directory mod_flite mod_pocketsphinx mod_xml_rpc mod_xml_cdr mod_xml_curl mod_say_es )
  
===Changelog===
+
= Bugs and Getting Help =
----
 
*v4.3.3 2011 January 31
 
#Added: smp compile support. Script works, make -j doesn't. see jira FS-3005
 
#Fixed: NGinx file size error
 
#FIXED removing nginx removes gnome/x.
 
#Added: Postgres (seems good)
 
#Fixed: Set up apache properly (fusionpbx file instead of default, use heredoc)
 
#Fixed: sqlite http request issue for nginx/apache
 
#Added: now doing ppa's the ubuntu way with apt-add-repository
 
#Added: set up auto install for nginx/apache, mysql/postgresql/sqlite, setnonat.
 
#Added: now prompts for rm -Rf /opt (or variable for auto-install).
 
#Added: Remove Nginx/php/apache properly
 
#*There's a bug in either ppa-purge or apt-add-repository (likely latter). if you install nginx, change your mind, install apache, change your mind again and re-install nginx, the repository for nginx/php5-fpm gets removed proerly [a '#' covers repo], but when re-enabling, the '#' gets replaced, and an 'n' is left on a newline afterward, preventing update/install from that repo.
 
#Fixed: Checking for nginx/apache2 binary instead of init scripts for if[x] restart
 
#TODO: look into setting up FS for mysql/pgsql
 
 
 
*v4.3.2.1 2011 January 1
 
#small problem when selecting nginx and sqlite. php5-fpm needed to restart so FusionPBX could see the FreeSWITCH directory.
 
*v4.3.2 2010 December 30
 
#logrotate was improperly setup. Needed to send sighup to fs_cli. Caused FS to die the first time it tried to log after rotation.
 
#php5-cli is a dependancy for FusionPBX. required for voicemail to email, and fax to email.
 
#added an nginx/php-fpm option.  You can change a variable (for auto run)or it will prompt you when you install fusionpbx in user mode
 
#mysql added as an option.
 
#problem with the way ubuntu logs ssh failures [fail2ban].
 
#*Failed password for root from 1.2.3.4 port 22 ssh2 
 
#*last message repeated 5 times
 
#*SOLUTION: Turn off RepeatedMsgReduction in rsyslog.
 
#fail2ban: previous setup looked for freeswitch log in /var/log/freeswitch.log log is actually /usr/local/freeswitch/log/freeswitch.log
 
#Tries to see if you're on a static IP address. If you are, it wants to start FreeSWITCH with the -nonat option to save some time. Also a new variable
 
#TODO: Maybe probe cores and to the -b thing for quicker compile/bootstrap
 
#TODO: IPTABLES
 
 
 
*v4.3.1 2010 December 23
 
#made a state save file.  so if there's an error, don't re-bootstrap, configure, etc. and remove it on a clean exit.
 
#requests for modules add/enable for ugrade-freeswitch. DONE
 
#mod dingaling needs libgnutls-dev libgnutls26 packages, and change:
 
#*"--mode=relink gcc" --> "--mode=relink gcc -lgnutls"
 
#*in /usr/src/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.la
 
#*appears to be an ubuntu problem....
 
 
 
*v4.3 2010 December 22
 
#under case upgrade-freeswitch, variables were not set properly.  It upgraded fusionpbx.. fixed.
 
#done: fail2ban error fixed. removed associated text
 
#done: have install check for /etc/fail2ban. reinstall (as in from iso) duplicates some txt
 
#done: remove or fix fusionpbx upgrade code. it either needs to log in and then update and run the schema upgrade. or get rid of it. Fixed by prompting the user to open a browser window, and warn.
 
#done: get logrotate working... let's not fill the disk.
 
#stop/start freeswitch for an upgrade, and an install...
 
 
 
*v4.2 2010 December 17
 
#made some changes so the text flows correctly now that we use curl to do install.php. 
 
#sent curl output to dev null..
 
#added apt-get update before we install apache since remastersys removes apt data
 
#stopping FS before FusionPBX install, and starting afteward.
 
#changed license to WAF v1
 
 
 
*v4.1 2010 December 15
 
#changing cd sounds (48/32/16/8khz) down to hd sounds (16/8Kkhz)
 
 
 
*v4 2010 December 14
 
#now install-fusion|install-freeswitch|upgrade...
 
#also adding curl commands to finish fusionpbx install.
 
 
 
*v3 2010 December 13
 
#adding fail2ban et al.
 
 
 
*v2 2010 December 07
 
#adds arrays to process the modules.  should make this much easier to edit.
 
#*just make additions to modules_add
 
#*This should work fine (even on a 2nd run).
 
 
 
*v1 2010 December 06
 
#first cut
 
 
 
== Bugs and Getting Help ==
 
 
soapee01 on #fusionpbx (freenode) wrote this script.  For help, go there.  Bugs and feature requests can be handled on the sourceforge  project page:
 
soapee01 on #fusionpbx (freenode) wrote this script.  For help, go there.  Bugs and feature requests can be handled on the sourceforge  project page:
  
http://sourceforge.net/projects/fusionpbxinstal/
 
 
 
 
"Freeswitch dies after it starts!"
 
There is a problem when using "install-fusionpbx install-freeswitch" after the Ubuntu ISO released 01-31-11. It has to do with the source used to build the version of FreeSwitch not being included in the ISO for space reasons.
 
 
If you'd like to backup your settings, then copy /var/www/fusionpbx/secure/fusionpbx.db to somewhere safe, /tmp or ~/ would work.
 
  
At this point, you need to remove your fusionpbx directory, then reinstall it. If you're logged into the web interface, now might be a good time to log out. rm -rf /var/www/fusionpbx. You've just nuked your FusionPBX install!
 
 
Now to re-install and restore all these settings.
 
 
`install-fusionpbx install-fusionpbx user`
 
 
Follow all the dialogues, once the installer finishes, copy back that fusionpbx.db from your /tmp or ~/ (or wherever you put it, I'll assume ~/) `# cp ~/fusionpbx.db /var/www/fusionpbx/secure/`
 
 
Once that's done, login to your web interface using your admin account and password that was specified prior to reinstall. Navigate the gui over to: Advanced > Commands
 
Once you're there, go to the PHP area and use this command: sync_package_freeswitch();
 
 
Click the "execute" button and hit "Apply" after the command executes, and your system should have all its settings prior to upgrade.
 
 
== ISO ==
 
<u>2011 November 11</u>
 
 
This is a LiveCD for installing FreeSWITCH/FusionPBX.  It's currently in work (64 bit and 32 bit).  These are beta.  They were created in KVM sessions, but the do install on real hardware.  Please read [[Easy_Ubuntu_10.04#Instructions|Instructions]] and [[Easy_Ubuntu_10.04#Errata_2|Errata]] closely.
 
 
Feedback requested: /msg soapee01 on Freenode (#fusionpbx). As of December 30, 2010 it actually functions as a LiveCD. FreeSWITCH and FusionPBX are running so you can test the FusionPBX gui. Please don't connect up to a SIP client and complain about audio quality while you run from a CD-ROM. :)
 
 
The latest ISO images can be found here:
 
:http://fusionpbx.googlecode.com/svn/iso/ubuntu/10.04-LTS/i386/fusionpbx_ub_i386-beta-2011-11-11.iso
 
:http://fusionpbx.googlecode.com/svn/iso/ubuntu/10.04-LTS/i386/fusionpbx_ub_i386-beta-2011-11-11.iso.md5
 
 
The latest Torrents for the images can be found here (Thanks hyper_ch!)
 
:https://
 
 
===ISO Major Inclusions===
 
Ubuntu Server version: 10.04 LTS
 
Freeswitch git number: ISO Date
 
FusionPBX SVN: ISO Date
 
web server: Ngnix/php5-fpm (post install you can change to Apache2)
 
database: sqlite (post install you can change to MySQL or PostgreSQL)
 
tftp server: not included
 
Other: logrotate, fail2ban
 
 
===If you have to compile freeswitch===
 
If you require the use of a module that wasn't included when freeswitch was compiled to create the ISO you will need to re-compile.  In order to fit the ISO image onto the CD, the source files have been removed, however the source files that were used to build the ISO are actually available - If you look on the sourceforge page for the iso, there's a tar.gz that is the compiled FreeSWITCH source that built the iso. Get it and xtracat it to /usr/src and then you'll be able to edit the modules.conf and compile.
 
 
===Instructions===
 
----
 
# Read [[Easy_Ubuntu_10.04#Errata_2|Errata List]]
 
# Download the ISO
 
# Verify the MD5 Sum.
 
# Burn to a CD or run from VMWare/VirtualBOX (testing only)
 
# Boot (be patient... LiveCDs take a while)
 
# Double Click the install icon
 
# Post-install: decide whether or not you want to upgrade FusionBPX.
 
#* <b>ABOUT THIS UPGRADE:</b>
 
#**What it really does is completely delete the current version installed on the iso, and grab the latest version of FusionPBX from svn.  Then it reruns the installer with your choice of database, web server, etc.  This is the preferred method for iso installation.  This way the iso will always provide the latest FusionPBX.  In a nutshell, it does 'rm -rf /var/www/fusionpbx' and calls the script '/usr/local/bin/install_fusionpbx install-fusionpbx user'
 
#* The system will not boot with a GUI. If you need one, run startx
 
# Default Username/Password for FusionPBX on LiveCD/post-install
 
#* username: superadmin
 
#* password: fusionpbx
 
 
===Errata===
 
----
 
 
===Permissions after Upgrade===
 
<del>Unfortunately FreeSWITCH creates new files with no group rw permissions. Linux ACL's, system UMASK, and init.d/freeswitch UMASK has been tried to work around this.  The permissions are hard coded into FreeSWITCH. [http://jira.freeswitch.org/browse/FS-3016 See jira FS-3016.]</del>
 
 
 
If you upgrade FreeSWITCH, permissions will be changed.  This is due to the way make install is configured.  Your first sign of this is that FreeSWITCH will fail to start. This is due to the /etc/init.d/freeswitch script trying to start FreeSWITCH as user www-data, and www-data doesn't have access to the FreeSWITCH binaries anymore. Post upgrade, run the following:
 
====Fix www-data Permissions====
 
run
 
install_fusionpbx fix-permissions
 
or
 
This is a script to make FreeSWITCH and FusionPBX run as the same user again. Save it to a file (ex: fixperms.sh), make it executable (chmod ugo+x ./fixperms.sh) and run it with sudo (sudo ./fixperms.sh).
 
<pre>
 
/bin/echo "setting FreeSWITCH owned by www-dat.www-data"
 
/bin/chown -R www-data.www-data /usr/local/freeswitch
 
#remove 'other' permissions on freeswitch
 
/bin/chmod -R o-rwx /usr/local/freeswitch/
 
#set FreeSWITCH directories full permissions for user/group with group sticky
 
/bin/echo "Setting group ID sticky for FreeSWITCH"
 
/usr/bin/find /usr/local/freeswitch -type d -exec /bin/chmod u=rwx,g=srx,o= {} \;
 
#make sure FreeSWITCH directories have group write
 
/bin/echo "Setting Group Write for FreeSWITCH files"
 
/usr/bin/find /usr/local/freeswitch -type f -exec /bin/chmod g+w {} \;
 
#make sure FreeSWITCH files have group write
 
/bin/echo "Setting Group Write for FreeSWITCH directories"
 
/usr/bin/find /usr/local/freeswitch -type d -exec /bin/chmod g+w {} \;
 
/bin/echo "setting FusionPBX owned by www-data.www-data just in case"
 
if [ -e /var/www/fusionpbx ]; then
 
    /bin/chown -R www-data.www-data /var/www/fusionpbx
 
fi
 
/bin/echo "Changing /etc/init.d/freeswitch to start with user www-data"
 
/bin/sed -i -e s,'USER=freeswitch','USER=www-data', /etc/init.d/freeswitch
 
#/etc/init.d/freeswitch start
 
</pre>
 
 
===Older Versions===
 
Please see:[[Easy_Ubuntu_10.04_Old_CD_Versions]]
 
  
 
== PortAudio ==
 
== PortAudio ==
Line 406: Line 231:
 
Tested with VMWare Player 2011/02/27
 
Tested with VMWare Player 2011/02/27
  
==Certificates==
+
=Certificates=
 
Information on importing the self signed certificates can be found here [[Self-Signed CA]]
 
Information on importing the self signed certificates can be found here [[Self-Signed CA]]
  
== Wishlist ==
+
= Wishlist =
 
*Option to download FreeSWITCH compiled source as tar.gz for iso
 
*Option to download FreeSWITCH compiled source as tar.gz for iso
 
*<del>Option --fix-permissions</del>
 
*<del>Option --fix-permissions</del>

Revision as of 16:14, 26 April 2012

Supported Distributions

Debian

Lenny

Squeeze

Ubuntu

10.04 LTS Lucid

12.04 LTS Precise

Download Ubuntu 10.04 Server LTS (Lucid)

http://www.ubuntu.com/server/get-ubuntu/download

    Select Ubuntu 10.04 LTS Long Term Support
    Choose 32 bit or 64 bit depending on your hardware

When you install ubuntu, you should select the "Manual package selection" option. This way we can keep the install to the bare minimum. Just quit tasksel during the install.

Make sure the following necessary packages are installed before continuing:

Debian Squeeze

It works there too! See: Debian_Install

Get the latest install script

Project

http://sourceforge.net/projects/fusionpbxinstal/files/

migrated to fusionpbx googlecode svn (2011-11-10)

Install Script

via subversion

sudo apt-get install subversion
sudo svn checkout https://fusionpbx.googlecode.com/svn/trunk/scripts/install/ubuntu/ /usr/src/install_fusionpbx
sudo chmod 755 /usr/src/install_fusionpbx/install_fusionpbx.sh
sudo ln -s /usr/src/install_fusionpbx/install_fusionpbx.sh /usr/local/bin/

with wget

To download with wget:

sudo wget -O /usr/local/bin/install_fusionpbx.sh http://fusionpbx.googlecode.com/svn/trunk/scripts/install/ubuntu /usr/local/bin/install_fusionpbx.sh
sudo chmod 755 /usr/local/bin/install_fusionpbx.sh

Run Script

sudo /usr/local/bin/install_fusionpbx.sh

Better way to run:

sudo /usr/local/bin/install_fusionpbx.sh install-both user |tee /tmp/install_fusion.log

Features

  • FreeSWITCH
    • It installs all necessary dependencies.
    • It grabs the latest FreeSWITCH git and compile it, including dealing with a mod_dingaling issue.
    • It sets permissions properly for FreeSWITCH.
    • Sets up Fail2Ban (for FreeSWITCH)
    • Sets up LogRotate (for FreeSWITCH)
    • Checks for public IP address, optionally starts FreeSWITCH with -nonat for faster startup
  • FusionPBX (optional)
    • It sets permissions properly FusionPBX to edit FreeSWITCH config files. FreeSWITCH is now running as www-data starting with v4.3.3
    • Grabs the latest FusionPBX from SVN and dependencies (php5-cli, php5-sqlite, sqlite)
    • OPTION: Installs and configures: apache2 with mod-php5 OR nginx with php5-fpm.
    • OPTION: Install MySQL for the FusionPBX database (instead of default sqlite).
    • OPTION: PostgreSQL 8 (or 9) beginning with v4.3.3
      • If using odbc for voicemail, FusionPBX requires php5-odbc!

Everything should automatically configured!

License

------------------------------------------------------------------------------

 "THE WAF LICENSE" (version 1)
 This is the Wife Acceptance Factor (WAF) License.
 jamesdotfsatstubbornrosesd0tcom  wrote this file.  As long as you retain this
 notice you can do whatever you want with it. If you appreciate the work,
 please consider purchasing something from my wife's wishlist. That pays
 bigger dividends to this coder than anything else I can think of ;).  It also
 keeps her happy while she's being ignored; so I can work on this stuff.
   James Rose

 latest wishlist: http://www.stubbornroses.com/waf.html

 Credit: Based off of the BEER-WARE LICENSE (REVISION 42) by Poul-Henning Kamp

------------------------------------------------------------------------------

Under no conditions, should a donation be considered to my loving wife until you've first donated to FusionPBX, and FreeSWITCH (so requests soapee01)

Notes


Errata

Nginx

4/16/2012

Latest PPA versions of nginx have changed the default configuration, so that when you upgrade it won't work. An example would be post installation of the current iso.

Open this file:

vim /etc/nginx/fastcgi_params

comment out (with #):

fastcgi_param HTTPS $https;

restart nginx

/etc/init.d/nginx restart

Bison

install bison first (new FS dependency)Fixed

Apache Config

Bug reported about setting the Document root path in the apache configuration. Variable substitution wasn't working. In /etc/apache2/sites-enabled/fusionpbx change the root directory to /var/www/fusionpbx and it should be fine. Fixed

Logrotate

The logrotate script doesn't necessarily work as advertised. The cause is due to the way FS handles the sighup. When received, FS will automatically mv /usr/local/freeswitch/log/freeswitch.log to /usr/local/freeswitch/log/freeswitch.log.`date "+%whatever" In some rare instances, logrotate can cause FS to crash when it tries to write/mv to a file that has already been handled by logrotate. Solution is here Changed

Call Detail Records (CDRs)

If your CDRs do not work and you see something like:

18:46:11.070791 [ERR] mod_xml_cdr.c:384 Unable to post to web server, writing to file

The issue here is in /usr/local/freeswitch/conf/autoload_configs/xml_cdr.conf.xml

You'll see:

<param name="url" value="http://PUBLIC_IP_ADDRESS/mod/xml_cdr/v_xml_cdr_import.php"/>

Change it to:

<param name="url" value="http://localhost/mod/xml_cdr/v_xml_cdr_import.php"/>

This is due to the nginx https redirect for the public IP. There's an exception in the config file for localhost.

This issue also affects outbound CID when using an Asterisk gateway.

  • install.php needs to tweak for this...

Permissions

Permissions aren't perfect (sorry), there's a script bug. Fixed

Setting group ID sticky for FreeSWITCH
/usr/bin/find: `freeswitch': No such file or directory

The script has had:

/usr/bin/find freeswitch -type d -exec /bin/chmod u=rwx,g=srx,o= {} \;

This needs to be is:

/usr/bin/find /usr/local/freeswitch -type d -exec /bin/chmod u=rwx,g=srx,o= {} \;

NGinx Log Files

Nginx logs for FusionPBX are stored in a non-standard location. See:Fixed

/var/log/fusionpbx_gui.access_log
/var/log/fusionpbx_gui.error_log

Older Versions

Please see Easy_Ubuntu_10.04_Old_Script_Versions for Errata, errors, and fixes.

Options

This script should be called as:
  install_fusionpbx option1 option2

    option1:
      install-freeswitch
      install-fusionpbx
      install-both
      upgrade-freeswitch
      upgrade-fusionpbx
      fix-https
      fix-permissions
      version|--version|-v

    option2:
      user: option waits in certain places for the user to check for errors
            it is interactive and prompts you about what to install"
      auto: tries an automatic install. Get a cup of coffee, this will
        take a while. FOR THE BRAVE!

      EXAMPLE
         install_fusionpbx install-both user

Install


sudo install_fusionpbx install-both user

Variables


These are included to make the auto mode more flexible. Open the script and set them however you wish.

  • for apache set to a, for nginx/php-fpm set to n -> for an auto install, user mode will prompt
APACHENGINX=n
  • for mysql set m. for sqlite set s. for postgresql set p
SQLITEMYSQL=s
  • for postgresql v 9.0 (from ppa) set to 9, otherwise stick with 8
  • must set SQLITEMYSQL to p
POSTGRES9=8
  • to start FreeSWITCH with -nonat option set SETNONAT to y
SETNONAT=n
  • rm -Rf /opt? A default install doesn't have /opt so no worries
  • if you do, set to no, and it will link /usr/local/freeswitch to /opt/freeswitch
RMOPT=y
  • below is a list of modules we want to add to provide functionality for FusionPBX don't worry about the applications/mod_ format. This script will find that in modules.conf
  • PAY ATTENTION TO THE SPACES POST AND PRE PARENTHESIS
modules_add=( mod_dingaling mod_portaudio mod_callcenter mod_lcr mod_cidlookup mod_directory mod_flite mod_pocketsphinx mod_xml_rpc mod_xml_cdr mod_xml_curl mod_say_es )

Bugs and Getting Help

soapee01 on #fusionpbx (freenode) wrote this script. For help, go there. Bugs and feature requests can be handled on the sourceforge project page:


PortAudio

Have fun with your sound card. Make sure the modules are loaded

lsmod |grep snd
lspci

It's already compiled (script and iso), but alsa is not present.

apt-get install alsa alsa-utils alsa-tools

You'll need to add your users to the audio group.

adduser www-data audio

Run alsamixer and unmute the channgels (with M) and crank the volume all the way up.

alsamixer
Reboot is now required (/etc/init.d/alsa might work, didn't for me)

Check that the soundcard is there.

cat /proc/asound/cards

Try playing a file from the CLI

aplay /usr/local/freeswitch/sounds/music/8000/suite-espanola-op-47-leyenda.wav

It should be working. reference with nice alsamixer pics

Enable the module in FusionPBX

  • System->Modules->PortAudio
    • Enable it
    • Start it

Example Port Audio Commands

Tested with VMWare Player 2011/02/27

Certificates

Information on importing the self signed certificates can be found here Self-Signed CA

Wishlist

  • Option to download FreeSWITCH compiled source as tar.gz for iso
  • Option --fix-permissions
    • Needs to check FreeSWITCH init script
  • upgrade-fusionpbx needs to fix permissions, since a FS upgrade kills them.
  • Logrotate for nginx
  • Fail2ban for FusionPBX failed login attempts
    • Need information on attempts/rate/etc
  • Change Fail2ban on FreeSWITCH with attempts/rate/etc in config file (not default settings)
  • Change or have option to download GIT from GitHub repository (It's faster)
    • git://github.com/FreeSWITCH/FreeSWITCH.git
  • Make nginx/apache https by default
    • iso needs to regenerate certificates post install, ideally with 10 year expirations.
  • fix nginx config to not block html files... Don't block ~ .ht
       # Disable viewing .htaccess & .htpassword & .db
       location ~ .htaccess {
               deny all;
       }
       location ~ .htpassword {
               deny all;
       }
  • Install TFTPD, change permissions to www-data.
    • /var/lib/tftpboot is root dir.
    • /etc/default/tftpd-hpa is config file
TFTP_USERNAME="www-data"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
  • Install NTPD
    • Package in repository is just 'ntp'