Installing freePBX on Ubuntu Server Intrepid
Preparing to install, things to do first
Install Intrepid server as usual. Mark LAMP when installing the services. This will add Apache, MySQL and PHP5. Log in the server and access the super user account by issuing
If you want to be sure about MySQL and PHP do this
Code:
apt-get install php5-mysql libapache2-mod-php5 mysql-server
You may need to set up apache appropriately, at the least be sure php5 is enabled. In Intrepid Ibex this is not needed:
For the localization to work properly you may have to edit /etc/php5/apache2/php.ini and modify as follow (leny/sid):
Code:
; PHP's built-in default is text/html
default_mimetype = "text/html"
;default_charset = "ISO-8859-1"
default_charset = "utf8";
Adding the last line forces the default charset for php pages (override apache charset) to be utf8.
other Php.ini settings you should change to make FreePBX happy.
Code:
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 100M ; Maximum amount of memory a script may consume (16MB)
Install Asterisk
Code:
apt-get install asterisk asterisk-mysql asterisk-mp3 php-db php5-gd php-pear sox curl
There is no reason to install zaptel if you are using kernel 2.6 or above as it will provide the timing device unless of course you are using zaptel hardware. Ztdummy is no longer necessary.
I am installing these also, sounds and prompts in spanish
Code:
apt-get install asterisk-prompt-es asterisk-sounds-extra
There are two approaches to solve the permissions problem, one is to add the asterisk group to the user www-data default in apache.
Code:
adduser www-data asterisk
The other one is to edit the /etc/apache2/envvars file and change apache's user to asterisk. I tested this one and it works.
Code:
#export APACHE_RUN_USER=www-data
#export APACHE_RUN_GROUP=www-data
export APACHE_RUN_USER=asterisk
export APACHE_RUN_GROUP=asterisk
Reload apache
Code:
apache2ctl graceful
To make the FOP server start, I changed the default shell for the user asterisk that was set to false:
Code:
usermod -s /bin/bash asterisk
In /usr/sbin/safe_asterisk I changed the variable BACKGROUND which is in 0 to 1
Installing FreePBX
Download freepbx from http://www.freepbx.org
Code:
cd /tmp
wget http://mirror.freepbx.org/freepbx-2.5.1.tar.gz
cd /usr/src/freepbx
tar xvfz /tmp/freepbx-2.5.1.tar.gz
cd freepbx-2.5.1
Prepare database:
Code:
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql
mysql
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
flush privileges;
quit
Start installation of freepbx:
Here are some of the relevant settings I changed to work with ubuntu's asterisk and apache packages:
Code:
AMPBIN=/var/lib/asterisk/bin
ASTAGIDIR=/usr/share/asterisk/agi-bin
AMPWEBROOT=/var/www/freepbx
FOPWEBROOT=/var/www/freepbx/panel
In my case, after installing FreePBX Asterisk died without explanation, so after a LOT of testing I disabled two libraries that where stoping it to work. To disable a library you can add lines in /etc/asterisk/modules.conf. The autoload directive will load anything in the lib directory (/usr/lib/asterisk/modules) unless you put the line noload in the configuration file.
Code:
noload =>app_directory.so
noload =>res_adsi.so
From http://www.voip-info.org/wiki/view/Asterisk+modules
Change permissions in /usr/share/lib/asterisk
Code:
chown asterisk.asterisk -R /usr/share/lib/asterisk
To make it start at the end of everything, edit the /etc/rc.local file before the line exit 0.
Code:
/usr/local/sbin/amportal start
exit 0
note/TODO: Asterisk will start on its on after package installation. If you want to run it under safe_asterisk and managed by amportal, remove asterisk from starting on its own.
Bookmarks