Installing Asterisk and FreePBX on Ubuntu Server 6.06 LTS

This document assumes prior knowledge of how to use Linux and some Asterisk knowledge. If you ever have trouble with asterisk starting, run sudo su asterisk to view any error messages when running asterisk -vvvc. All of these instructions are written with the intention that the user be root at all times during the installation. To access a root shell on an Ubuntu system run sudo su.
Installing Ubuntu 6.06 LTS and setting up packages

1. Install Ubuntu Server 6.06. I recommend setting up a large partition for the /var filesystem since that is where a majority of the data for an Asterisk install is located.

2. After restarting from installation, the first thing we want to do is install SSH and setup a static IP on the box.

a) uncomment the universal repository line from /etc/apt/sources.list

deb dapper universe
deb-src dapper universe

b) update apt database and install openssh-server

aptitude update
aptitude openssh-server

c) at this point you probably will want to setup a static ip address if you haven’t already done so. Please check the Ubuntu documentation on how to do this

3. Get all Ubuntu updates

aptitude upgrade

4. Install necessary dependencies – Insert installation cd before proceeding

aptitude install cvs build-essential automake autoconf bison flex libtool libncurses5-dev libssl-dev php5 php5-cli php5-curl php5-gd php5-mysql mysql-server php-pear php-db curl sox apache2 subversion libssl-dev libmysqlclient15-dev

5. Install the correct version of the linux headers for your kernel version. Use uname to determine current kernel version. In this example our kernel version is 2.6.15-26-server. We also need to link these to

uname -a
apt-cache search linux-headers 2.6.15-26-server (replace kernel version with what's returned from uname -a)
aptitude install linux-headers-2.6.15-26-server
ln -s /usr/src/linux-headers-2.6.15-26-server /usr/src/linux-2.6

Installing Asterisk

1. Download the source file from into /usr/src. You will need the files for Asterisk, Zaptel, Sounds, and Addons.

2. change to the /usr/src folder where we saved the source files to

cd /usr/src

3. Install the Zaptel drivers

tar zxvf zap*
cd zaptel-1.2.19
vi zconfig.h - change zconfig.h to comment out KB1 and enable MG2 echo cancellation
make clean
make install
make config
vi /etc/default/zaptel - #'d out all MODULE lines except the one's you need for your specific hardware

b) Using documentation available on the web, configure /etc/zaptel.conf and /etc/asterisk/zapata.conf files

c) Let’s start the zaptel drivers

/etc/init.d/zaptel start
update-rc.d zaptel defaults 20 80

4. Create user for asterisk to run as

groupadd asterisk
useradd -c "asterisk PBX" -d /var/lib/asterisk -g asterisk asterisk

5. Compile and install Asterisk and all additional components

mkdir /var/run/asterisk
chown asterisk:asterisk /var/run/asterisk/
cd /usr/src/
tar zxvf asterisk-1.2.24.tar.gz
cd asterisk-1.2.24
make clean
make install
make samples
cd ..
tar zxvf asterisk-addons-1.2.7.tar.gz
cd asterisk-addons-1.2.7
make clean && make && make install
cd ..
tar zxvf asterisk-sounds-1.2.1.tar.gz
cd asterisk-sounds-1.2.1
make install
chown asterisk:asterisk /etc/asterisk -R
chown asterisk:asterisk /var/lib/asterisk -R
chown asterisk:asterisk /var/log/asterisk -R
chown asterisk:asterisk /var/spool/asterisk/ -R
vi /etc/asterisk/asterisk.conf - change astrundir setting to astrundir => /var/run/asterisk

6. Setup MySQL
Download the latest version of FreePBX from and save to /usr/src/

cd /usr/src
tar zxvf freepbx-2.3.0.tar.gz
cd freepbx-2.3.0
mysqladmin -u root password '<chosen MySQL Password>'
mysqladmin create asteriskcdrdb -p
mysql --user=root --password= asteriskcdrdb < ./SQL/cdr_mysql_table.sql
mysqladmin create asterisk -p
mysql --user=root --password=<chosen MySQL Password> asterisk < ./SQL/newinstall.sql
mysql --user root -p
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';

7. Configure Apache

vi /etc/apache2/apache2.conf
change User and Group to = asterisk
 vi /etc/apache2/sites-enabled/000-default
change AllowOveride None to AllowOverid All under both instances of /var/www
vi /etc/php5/apache2/php.ini
upload_max_filesize = 20M
vi /etc/php5/cli/php.ini
upload_max_filesize = 20M
chown asterisk:asterisk /var/lib/php5 -R
chown asterisk:asterisk /var/www -R
/etc/init.d/apache2 restart

8. Install FreePBX

a) Start Asterisk

cd /usr/src/freepbx-2.3.0
./start_asterisk start
accept defaults on all questions except on:
Enter the path to use for your AMP web root: /var/www
ip address

b) No point a web browser at http:///admin/ and click on the orange reload config banner at the top of the page

c) back to the asterisk server we need to create init script for asterisk and freebpx in /etc/init.d

vi /etc/init.d/asterisk

paste the following into the file and save it

set -e 


test -x $DAEMON || exit 0 

d_start() {
                amportal start

d_stop() {
                amportal stop

d_reload() {
                amportal restart

case "$1" in
        echo -n "Starting $DESC: $NAME"
        echo "."
        echo -n "Stopping $DESC: $NAME"
        echo "."
        echo -n "Restarting $DESC: $NAME"
        sleep 10
        echo "."
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
exit 0

d) make init file executable and load at startup

chmod 755 /etc/init.d/asterisk
update-rc.d asterisk defaults 90 10

e) If you want the Flash Operator Panel enabled

vi /etc/amportal.conf

enable FOP by changing FOPRUN=false to FOPRUN=true

f) Remove old config files from /etc/asterisk

rm /etc/asterisk/*.0

g) Reboot your system and you should have a working Asterisk/FreePBX system up and running.

Related posts:

  1. Установка FreePBX + Asterisk Проект компании Digium – Asterisk. Известен многим, как и вэб...
  2. Asterisk – храним CDR в БД MySQL. Asterisk. Настройка. Статья#1. Складываем CDR в MySQL. Должны быть установлены...
  3. Установка Netams-3.4.5 под Centos. Настройка и тюнинг Бесплатное программное обеспечение NETAMS 4.0 (релиз 489 от 4 марта)...
  4. Взлом и защита вашего сервера Asterisk Сегодня я наткнулся на интересную программу – sipvicious. Это SIP...
  5. Microsoft ISA Server 2006 + Cygwin. Оригинальный способ биллинга. Приветствую! Сегодня мы рассмотрим один из вариантов снятия статистики интернет...
You can leave a response, or trackback from your own site.

Оставить комментарий