You are on page 1of 3

Preparing Asterisk Manager

To allow FreePBX to communicate with Asterisk, the Asterisk Manager must be enabled.
Edit the file /etc/asterisk/manager.conf with your favourite text editor

Enable the manager, by editing the line 25 from:


enabled = no
to:

enabled = yes
Create a user, by appending at the end of the file the lines:
[aabbccAABBCC]
secret = ddeeffDDEEFF
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
where aabbccAABBCC is the username
and ddeeffDDEEFF is his password. If you choose your own username and password, take note of
them.

Preparing user and group


Asterisk, FreePBX and the web environment must run as the same system user.

Create the group asterisk, with the command:

addgroup asterisk
Create the user asterisk, with the command:
useradd -g asterisk -c "Asterisk PBX" -d /var/lib/asterisk asterisk

Editing PID path


Change the path of the file which stores the Asterisks Process ID

Create the folder /var/run/asterisk, with the command:

mkdir -p /var/run/asterisk
Edit the file /etc/asterisk/asterisk.conf with your favourite text editor and change the line:
astrundir => /var/run
into:

astrundir => /var/run/asterisk


Change the permissions of the folder /var/run/asterisk, with the command:
chown asterisk.asterisk /var/run/asterisk

Edit permissions
Change the user and the group ownership of some folders to have them consistent with the new
configuration

Type the command:


chown -Rf asterisk.asterisk /var/log/asterisk

Configuring web server


Edit the web server configuration to have it running as the same user and group as Asterisk

Edit the file /etc/apache2/envvars with your favourite text editor and change the lines:
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
into
export APACHE_RUN_USER=asterisk

export APACHE_RUN_GROUP=asterisk
Restart the web server, with the command:
/etc/init.d/apache2 restart

Download and unpack FreePBX

Download the latest version of the 2 series, from here

Unpack the downloaded archive using tar, with the command:


tar xzvf freepbx-2.x.x.tar.gz

a new folder will be created named freepbx-2.x.x


Change the current working directory to that folder, with cd:
cd freepbx-2.x.x

Create database
It is now necessary to create two databases.

Lunch the MySQL console, with the command:


mysql -p

the MySQLs root password will be asked, type it and press enter.
Create the database which will hold the FreePBX configuration, with the command:

create database asterisk;


Create the database which will hold the CDR, with the command:

create database asteriskcdrdb;


Logout from the MySQL console, type:
exit

Populate database
While in the FreePBXs source files folder freepbx-2.x.x

Populate the database asterisk, with the command:


mysql -p asterisk < SQL/newinstall.sql

the MySQLs root password will be asked, type it and press enter
Populate the database asteriskcdrdb, with the command:
mysql -p asteriskcdrdb < SQL/cdr_mysql_table.sql
the MySQLs root password will be asked, type it and press enter

Installing FreePBX
While in the FreePBXs source files folder freepbx-2.x.x

Lunch the script to install FreePBX, with the command:


./install_amp
and answer:
Enter your USERNAME to connect to the asterisk database: root
Enter your PASSWORD to connect to the asterisk database: <type MySQLs root password>
Enter the hostname of the asterisk database: <press enter or type localhost>
Enter a USERNAME to connect to the Asterisk Manager interface: <type the created username of

the Asterisk Manager, in this example aabbccAABBCC>


Enter a PASSWORD to connect to the Asterisk Manager interface: <type the password of the
created username of the Asterisk Manager, in this example ddeeffDDEEFF>
Enter the path to use for your AMP web root: /var/www
Enter the IP ADDRESS or hostname used to access the AMP web-admin:<type the IP address of
the server, usually the IP address inside the LAN>
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:<confirm the
default passw0rd by pressing enter>
Use simple Extensions [extensions] admin or separate Devices and Users
[deviceanduser]? <specify if each extension will correspond to a user or if they will be dynamic. If
not sure type extensions or press enter>
Enter directory in which to store AMP executable scripts: <confirm the
default /var/lib/asterisk/bin by pressing enter>
Enter directory in which to store super-user scripts: <confirm the default/usr/local/sbin by
pressing enter>
The FreePBX installation should now proceed to the end.
If it breaks printint the error Cannot redeclare __parse_dialrulesfile, repeat again the installation, with
the command:
./install_amp
and this time the script should end successfully.
This is a known bug.
Also, you must delete a file, which will later be automatically symlinked by FreePBX. Type:
rm /etc/asterisk/sip_notify.conf

First access to FreePBX


Access FreePBX, using a web browser to the address:
http://<Servers IP address>
Press FreePBX Administration and once inside FreePBX press the Apply Configuration Changes orange
button at the center top of the page.

You might also like