Instalasi Asterisk, Zaptel dan FreePBX 2.5 di Ubuntu 8.04.2

From OnnoWiki
Jump to: navigation, search

Requirements

Current linux distribution: Ubuntu server 8.04.2

Current kernel version: 2.6.24-23-server

Important notes:

- You are required to connect your Ubuntu server to the Internet

- For fast update and upgrade please configure your apt source to the fastest reachable server

- In this tutorial you are assumed using Intel Pentium 4 (or compatible)

- Some of your installed apache server configuration will be changed

- You are recommended to use fresh install of Ubuntu server 8.04.2 (you will later update and upgrade this server)

- Please stop and attend the problem when problem occurs, do not continue to the next step until you fix it


Development Environment

Login as root and follow steps below.

Enter your sudo password to authenticate your self as superuser

$ sudo su -

Make sure that you see libpri-1.4.7.tar.gz, zaptel-1.4.12.1.tar.gz, asterisk-1.4.21.2.tar.gz, asterisk-addons-1.4.8.tar.gz and freepbx-2.5.1.tar.gz in your asterisk sources directory. You are required to get all the source packages before following below steps.

Please remember that you are required to use particular version, not the latest, so pay attention when you download the package from http://www.asterisk.org and http://www.freepbx.org, or http://voiprakyat.or.id/pub

# cd <your asterisk sources directory>
# ls

Update your Ubuntu packages

# apt-get update
# apt-get upgrade

Install required packages

# apt-get install mc build-essential linux-headers-`uname -r`
# apt-get install libncurses5-dev libssl-dev libmysqlclient15-dev libnewt-dev zlib1g-dev
# apt-get install libxml2-dev libtiff4-dev libaudiofile-dev
# apt-get install openssh-server curl sox lame mpg123

Put 'mysecretpassword' (without quote) as mysql server root password, please remember that this is only for the sake of following this manual, later on you have to change it to your own password

# apt-get install apache2 mysql-server php5 php5-cli php5-gd php5-mysql php-pear php-db


Asterisk Installation

Install libpri

# tar -zxf libpri-1.4.7.tar.gz
# cd libpri-1.4.7
# make
# make install
# cd ../

Install Zaptel

# tar -zxf zaptel-1.4.12.1.tar.gz
# cd zaptel-1.4.12.1
# ./configure

Select all options on ‘Utilities’

Press x to save selections

# make menuconfig

Continue on Zaptel installation

# make
# make install
# make config
# cd ../

Install Asterisk

# tar -zxf asterisk-1.4.21.2.tar.gz
# cd asterisk-1.4.21.2
# ./configure

Remove chan_mgcp, chan_phone, chan_oss, chan_skinny from ‘Channel Drivers’

Remove codec_adpcm, codec_a_mu, codec_lpc10 from ‘Codec Translators’

Select EXTRA-SOUNDS-EN-GSM from 'Extras Sound Packages'

Press x to save selections

# make menuconfig

Continue on Asterisk installation

# make
# make install
# make samples
# cd ../

Install Asterisk addons

# tar -zxf asterisk-addons-1.4.8.tar.gz
# cd asterisk-addons-1.4.8
# ./configure

Remove chan_ooh323 from ‘Channel Drivers’, make sure the rest is selected

# make menuconfig

Continue on Asterisk addons installation

# make
# make install
# make samples
# cd ../

genzaptelconf is part of Zaptel package, but make sure to execute this only after you managed to install asterisk (after Asterisk's make samples above)

# genzaptelconf


FreePBX Installation

Add new user named 'asterisk' (it has tobe this way, please don't use adduser)

# useradd -s /bin/false -m asterisk

On /etc/apache2/envvars, look for this lines:

export APACHE_RUN_USER=www-data

export APACHE_RUN_GROUP=www-data

and change to below lines:

export APACHE_RUN_USER=asterisk

export APACHE_RUN_GROUP=asterisk

# mcedit /etc/apache2/envvars

On /etc/php5/apache2/php.ini, look for this line:

memory_limit = 16M

and change it to this line:

memory_limit = 100M

look for this line:

magic_quotes_gpc = On

and change it to this line:

magic_quotes_gpc = Off

# mcedit /etc/php5/apache2/php.ini

Run this just to make sure that this module (php5) already enabled

# a2enmod php5

Restart apache2, this step is very important for FreePBX installation

# /etc/init.d/apache2 restart

Apache2 running as user asterisk is a must! Check it with ps aux

# ps aux | grep apache

Change Asterisk's files and directories ownership to user asterisk

# chown asterisk:asterisk /etc/asterisk -R
# chown asterisk:asterisk /usr/lib/asterisk -R
# chown asterisk:asterisk /var/lib/asterisk -R
# chown asterisk:asterisk /var/log/asterisk -R
# chown asterisk:asterisk /var/spool/asterisk -R

On /etc/asterisk/asterisk.conf, look for astrundir path like this line:

astrundir => /var/run

and change it to:

astrundir => /var/log/asterisk

# mcedit /etc/asterisk/asterisk.conf

Run this just to make sure that asterisk is not currently running

# killall asterisk

Run Asterisk with specific parameters

# asterisk -U asterisk -G asterisk

It is very important for asterisk running as user asterisk and group asterisk

# ps aux | grep asterisk

Lets make sure that you have changed the mysql server root password (the default is no password), 'mysecretpassword' (without quote) is a password chosen for this manual only

# mysqladmin -u root -p password mysecretpassword

Create required databases

# mysqladmin -u root -p create asterisk
# mysqladmin -u root -p create asteriskcdrdb

Extract FreePBX tarball

# tar -zxf freepbx-2.5.1.tar.gz
# cd freepbx-2.5.1

Insert SQL statements to required databases

# mysql -u root -p asterisk < SQL/newinstall.sql
# mysql -u root -p asteriskcdrdb < SQL/cdr_mysql_table.sql

Make sure this file removed before running install_amp

# rm -f /etc/amportal.conf

Make sure that you know what is your IP address

# ifconfig

While running install_amp, please remember to answer some important question as follow, leave the rest as default.

Q: Enter your USERNAME to connect to the 'asterisk' database:

A: root

Q: Enter your PASSWORD to connect to the 'asterisk' database:

A: mysecretpassword

Q: Enter the path to use for your AMP web root:

A: /var/www

Q: Enter the IP ADDRESS or hostname used to access the AMP web-admin:

A: <put your Ubuntu server IP address here>

# ./install_amp

On /etc/amportal.conf, look for this line:

AUTHTYPE=none

and change it to this line:

AUTHTYPE=database

# mcedit /etc/amportal.conf

Put amportal script to init.d

# ln -s /usr/local/sbin/amportal /etc/init.d/amportal
# update-rc.d amportal defaults
# cd ../

Remove first all default configuration files

# rm -f /etc/asterisk/extensions.conf
# rm -f /etc/asterisk/sip.conf
# rm -f /etc/asterisk/iax.conf
# rm -f /etc/asterisk/zapata.conf

On /etc/asterisk/zapata.conf, type below lines and save the file:

[trunkgroups]

[channels]

#include zapata-channels.conf

# mcedit /etc/asterisk/zapata.conf

Change more files and directories ownership to user asterisk

# chown asterisk:asterisk /etc/asterisk -R
# chown asterisk:asterisk /var/www -R

Edit /usr/sbin/safe_asterisk and look for this line:

TTY=9

and change it to:

TTY=

look for this line:

CONSOLE=yes

and change it to:

CONSOLE=no

look for this line:

ASTPIDFILE=/var/run/asterisk.pid

and change it to:

ASTPIDFILE=/var/log/asterisk/asterisk.pid

look for this line:

# SYSMAXFILE=262144

and change it to:

SYSMAXFILE=262144

look for this line:

# MAXFILE=32768

and change it to:

MAXFILE=32768

# mcedit /usr/sbin/safe_asterisk

Stop and then start amportal

# /etc/init.d/amportal stop
# /etc/init.d/amportal start

Make sure asterisk is running and op_server.pl is running

# ps ax 

Browse FreePBX admin web page using Firefox, http://<your Ubuntu server IP address>/admin

Login as user 'admin', the default password is 'admin' (without quote)

Click 'Apply Configuration Changes' on top of the page


Installation finish.

Please post questions at http://www.voiprakyat.or.id/forum for more informations.