installingFreepbx

Revision 1 as of 2008-12-15 22:40:16

Clear message

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

sudo su

If you want to be sure about MySQL and PHP do this

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:

a2enmod php5

For the localization to work properly you may have to edit /etc/php5/apache2/php.ini and modify as follow (leny/sid):

; 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.

From http://www.freepbx.org/trac/wiki/UbuntuServer >I had the problem with others i18n php websites too and this modification works fine for all of them

other Php.ini settings you should change to make FreePBX happy.

; 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

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

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.

adduser www-data asterisk

With this approach, FreePBX gives an error copying /usr/share/asterisk/bin/agi-bin.

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.

#export APACHE_RUN_USER=www-data
#export APACHE_RUN_GROUP=www-data
export APACHE_RUN_USER=asterisk
export APACHE_RUN_GROUP=asterisk

If you changed from approach 1 to approach 2, you should delete the session files in /var/lib/php5 or change ownership to asterisk

Reload apache

apache2ctl graceful

To make the FOP server start, I changed the default shell for the user asterisk that was set to false:

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

cd /tmp
wget http://mirror.freepbx.org/freepbx-2.5.1.tar.gz
cd /usr/src
tar xvfz /tmp/freepbx-2.5.1.tar.gz
cd freepbx-2.5.1

Prepare database:

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:

./install_amp

Things to write on, the other things may be left to the default values

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, before the global directive.

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

chown asterisk.asterisk -R /usr/share/asterisk

To make it start at the end of everything, edit the /etc/rc.local file before the line exit 0.

/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

There is a problem with this installation, panel shows an incorrect page from the administration links.

Other References

http://www.freepbx.org/support/documentation/installation/install-process-for-ubuntu-6-06