Installing CentOS for Asterisk
Based on Centos 5 for i386 on AMD Duo-core 64bit machine ================>
Required packages
Minimal install
kernel-devel / kernel-smp-devel
bison
openssl-devel
for mysql support (Asterisk sip mysql peers, Asterisk voicemail database, Asterisk cdr mysql etc) add
mysql
mysq-server
mysql-devel
Installation process
Select minimal from the Package Group selector option (on Centos 4.1 this required just disk1 for my hardware – HP DL360 – G4)
When the installation completes, install the YUM GPG Key
rpm –import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-45
Now simply install the required packages using yum
yum -y install kernel-devel bison openssl-devel
or to include mysql:
yum -y install kernel-devel bison openssl-devel mysql mysql-server mysql-devel
If you run an SMP kernel, you need kernel-smp-devel instead of kernel-devel above.
Now go make yourself a cup of tea/coffee as this will take a while, depending on your connection speed (it will download and install all dependencies and packages required)
Then:
yum -y update
Another cup of coffee, and a reboot to ensure that you compile against the correct kernel.
Once installed, standard asterisk installation procedure applies.
Installing Asterisk on to CentOS 5.x
Quick and Easy Install Guide, continuing from above section.
>>> If you are running an SMP kernel, then instead of “kernel-devel” use “kernel-smp-devel”<<<
Install prereqs:
yum -y update
yum -y install gcc kernel-smp-devel bison openssl-devel mysql mysql-server mysql-devel
#installing/upgrading asterisk
#clean modules – just in case this is an upgrade.
rm -f /usr/lib/asterisk/modules/*
Go fetch latest asterisk sources. If you get “404″ errors, chances are that there
are newer versions. Please update this page. (Yes, I know about /releases ,
and I avoided using it to keep this page up-to-date)
===> check of freepbx supports asterisk-1.4.6
If not, install asterisk-1.2.20
/usr/src
rm asterisk
wget http://ftp.digium.com/pub/asterisk/asterisk-1.4.6.tar.gz
tar -zxvf asterisk-1.4.6.tar.gz
ln -s asterisk-1.4.6 asterisk
rm -f zaptel
wget http://ftp.digium.com/pub/zaptel/zaptel-1.4.3.tar.gz
tar -zxvf zaptel-1.4.3.tar.gz
ln -s zaptel-1.4.3 zaptel
rm -f libpri
wget http://ftp.digium.com/pub/libpri/libpri-1.4.0.tar.gz
tar -zxvf libpri-1.4.0.tar.gz
mv libpri-1.4.0 libpri
rm -f asterisk-addons
wget http://ftp.digium.com/pub/asterisk/asterisk-addons-1.4.2.tar.gz
tar -zxvf asterisk-addons-1.4.2.tar.gz
mv asterisk-addons-1.4.2 asterisk-addons
Should be run before building asterisk: ===================>
cd /usr/src/zaptel
./configure
# make menuselect
make install
make config
===> If you get kernel error in ‘make install’ for zaptel:
# rpm -q | grep kernel
— check if kernel mentoned in zaptel error appears.
If not follow the procedure below:
# ls /lib/modules/2.6.18-8.1.6.el5xen -l
# cd /lib/modules/2.6.18-8.1.6.el5xen/
# rm build (press ‘y’ when prompted)
# ln -s /usr/src/kernels/2.6.18-8.1.6.el5-i686/ build
# cd /usr/src/zaptel
# make clean
# make install
# make config
Optional: If you have Zaptel digital cards:
cd ../libpri
make clean
make install
Must be installed after zaptel and (if you need it) libpri:
cd ../asterisk
./configure
# make menuselect # for extra configuration
make
make install
make samples
make config
Optional. Should be run after installing Asterisk:
cd ../asterisk-addons
./configure
make
make install
===> If you get compilation error for ‘libchan_h323.so.1.0.1′:
# ls -la asterisk-ooh323c/.libs
(check if you have ‘libchan_h323.1.0.1′)
# cp asterisk-ooh323c/.libs/libchan_h323.1.0.1 asterisk-ooh323c/.libs/libchan_h323.so.1.0.1
# make install
Installing freepbx 2.2.2 ============================>
# yum install gcc libxml2-devel libtiff-devel mysql-server php-gd php-mysql kernel-devel kernel-smp-devel bison ncurses-devel audiofile-devel subversion libogg-devel openssl-devel mysql-devel
OR
Do ‘yum’ for all of these: (you might need ‘php-pear’ only)
build-essential php5 php5-cli php5-mysql mysql-server php-pear php-db
openssh-server curl sox apache2 subversion libncurses5-dev libssl-dev
linux-headers-`uname -r` libmysqlclient15-dev
e.g. # yum install php5
OR
both:)
lame is not available through a yum repository; but it can be obtained and installed
from Dag Wieers’ RPM repository:
[root@dhcp1 ~]# rpm -ivh http://apt.sw.be/redhat/el4/en/i386/RPMS.dag/lame-3.96.1-2.2.el4.rf.i386.rpm
# cd /usr/src
# wget http://superb-east.dl.sourceforge.net/sourceforge/amportal/freepbx-2.2.2-withmodules.tar.gz
# tar -xvzf freepbx-2.2.2-withmodules.tar.gz
Setup users, groups, folders and permissions: ===>
[root@dhcp1 ~l]# useradd -c “Asterisk PBX” -d /var/lib/asterisk asterisk
[root@dhcp1 ~]# chown asterisk /var/lib/php/session/
Using nano (or your favourite editor, but nano is fine), you need to change User apache and Group apache to User asterisk and Group asterisk.
[root@dhcp1 ~]# nano +227 /etc/httpd/conf/httpd.conf (Push Control-X to save when you’ve finished)
You also want to change AllowOverride None to AllowOverride All
[root@dhcp1 ~]# nano +311 /etc/httpd/conf/httpd.conf (Push Control-X to save when you’ve finished)
Set up MySQL ======>
Before you can do anything to MySQL, you need to make sure it’s running:
[root@dhcp1 ~]# /etc/init.d/mysqld start
Initializing MySQL database: [ OK ]
Starting MySQL: [ OK ]
[root@dhcp1 ~]#
Now, to configure the databases for freePBX:
[root@dhcp1 ~]# cd /usr/src/freepbx-2.2.2
[root@dhcp1 freepbx-2.2.2]# mysqladmin create asterisk
[root@dhcp1 freepbx-2.2.2]# mysqladmin create asteriskcdrdb
[root@dhcp1 freepbx-2.2.2]# mysql asterisk < SQL/newinstall.sql
[root@dhcp1 freepbx-2.2.2]# mysql asteriskcdrdb < SQL/cdr_mysql_table.sql
They also need to be secured, so that not just anyone can access them. freePBX will prompt you for a database password when you do the install. You need to pick that now. We’ll assume that you’ve picked ‘asteriskuser’ and ‘amp109′ – you probably shouldn’t use these, as they are well known passwords for Asterisk@Home builds. If anyone’s trying to attack your machine, they will try this.
[root@dhcp1 freepbx-2.2.2]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8 to server version: 4.1.16
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO eapenuser@localhost IDENTIFIED BY ‘electron’;
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON asterisk.* TO eapenuser@localhost IDENTIFIED BY ‘electron’;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
[root@dhcp1 freepbx-2.2.2]
Now, after all of this, you need to pick a root ‘mysql’ password. For this, we’ll pretend it’s ‘quark101′. If you need to do anything else with mysql, you’ll need to provide this password.
[root@dhcp1 freepbx-2.2.2]# mysqladmin -u root password ‘quark101′
Build the cdr_mysql module for Asterisk (Yep, more compiling!)
[root@dhcp1 freepbx-2.1.1]# cd /usr/src/asterisk-addons
[root@dhcp1 freepbx-2.1.1]# cp Makefile Makefile.orig
[root@dhcp1 freepbx-2.1.1]# sed -i ’s/SOURCE/SOURCE -DMYSQL_LOGUNIQUEID/’ Makefile
[root@dhcp1 freepbx-2.1.1]# make && make install
Install freePBX at last!
You’re there – you’ve done the hard yards, and finally you can install freePBX!
WARNING! If you have an existing Asterisk installation, the script below will overwrite your Asterisk configuration files. Backup your
/etc/asterisk directory before running.
$cd /usr/src/freepbx-2.2.2
$./install_amp
===> If you get PEAR DB…FAILED
# yum install php-gd
# yum install php-mbstring
# pear install DB
Checking for PEAR DB..OK
Checking for PEAR Console::Getopt..OK
Checking for libasteriskperl (perl bindings for asterisk)…Checking user..OK
Checking for /etc/amportal.conf../etc/amportal.conf does not exist, copying default
Creating new /etc/amportal.conf
Enter your USERNAME to connect to the ‘asterisk’ database: [eapenuser]
Enter your PASSWORD to connect to the ‘asterisk’ database: [electron]
Enter the hostname of the ‘asterisk’ database: [localhost]
Enter a USERNAME to connect to the Asterisk Manager interface: [admin]
Enter a PASSWORD to connect to the Asterisk Manager interface:[quark111]
Enter the path to use for your AMP web root:[/var/www/html]
Enter the path to use for your FOP web root:[/var/www/html/panel]
Created /var/www/html/panel
Enter the path to your Apache cgi-bin:[/var/www/cgi-bin]
Enter the IP ADDRESS or hostname used to access the AMP web-admin:[xx.xx.xx.xx] The IP Address of your Asterisk Machine [ElectronTest]
Enter a PASSWORD to perform call transfers with the Flash Operator Panel: [passw0rd]
Use simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]? extensions
Enter directory in which to store AMP executable scripts: [/var/lib/asterisk/bin]
Created /var/lib/asterisk/bin
Enter directory in which to store super-user scripts: [/usr/sbin]
/etc/amportal.conf writtenOK
Reading /etc/amportal.conf..OK
Checking for /etc/asterisk/asterisk.conf../etc/asterisk/asterisk.conf does not exist, copying default
OK
Reading /etc/asterisk/asterisk.conf..OK
Connecting to database..OK
Checking current version of AMP..1.10.010beta1
Installing new AMP files..OK
Configuring install for your environment..OK
Setting permissions on files..OK
Checking for upgrades..5 found
Upgrading to 1.10.010..
Upgrading to 1.10.010..OK
Upgrading to 2.0beta1..
-> Running PHP script /usr/src/freepbx-2.0-beta4/upgrades/2.0beta1/emergencycid.php
-> Running SQL script /usr/src/freepbx-2.0-beta4/upgrades/2.0beta1/tables.sql
PHP Notice: Undefined variable: data in /usr/src/freepbx-2.0-beta4/install_amp on line 305
Upgrading to 2.0beta1..OK
Upgrading to 2.0beta2..
Upgrading to 2.0beta2..OK
Upgrading to 2.0beta3..
-> Running PHP script /usr/src/freepbx-2.0-beta4/upgrades/2.0beta3/fixgotovm.php
Updating existing voicemail destinations..
..OK
Upgrading to 2.0beta3..OK
Upgrading to 2.0beta4..
Upgrading to 2.0beta4..OK
Generating AMP configs..
Generating Configurations.conf..
Checking for PEAR DB..OK
Checking for PEAR Console::Getopt..OK
Checking for /etc/amportal.conf..OK
Reading /etc/amportal.conf..OK
Connecting to database..OK
Please Reload Asterisk by visiting http://XXX.XXX.XXX.XX/admin
Generating AMP configs..OK
Restarting Flash Operator Panel..-bash: /var/www/html/admin/bounce_op.sh: Permission denied
OK
Please Reload Asterisk by visiting http://XXX.XXX.XXX.XX/admin
If you get any warnings or errors in the last part of the output, they’re usually not traumatic, but please use the IRC Support tool to report a bug to the developers.
amportal control script
Starting with version 1.10.004, freePBX provided a new control script. The functionality of which is to start, stop or kill services in the freePBX environment, or to set permissions on directories/files in the freePBX environment:
$amportal
———-AMP Control Script———–
Usage: amportal start|stop|kill|chown
start: Starts Asterisk and Flash Operator Panel server
stop: Gracefully stops Asterisk and the FOP server
restart: Stop and Starts
kill: Kills Asterisk and the FOP server
chown: Sets appropriate permissions on files
The amportal script is the recommended way to stop and start asterisk:
$ /usr/sbin/amportal stop
$ /usr/sbin/amportal start
19.Automatic start-up
echo /usr/sbin/amportal start >> /etc/rc.local
Ensure services are starting at boot time and reboot
In order to access and use freePBX we will want both Apache (httpd) and MySQL (mysqld) to be started at boot. You can check to see if they are setup to start at boot by using chkconfig:
[root@dhcp1 freepbx-2.1.1]# chkconfig –list httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@dhcp1 freepbx-2.1.1]# chkconfig –list mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Here we see that both httpd and mysqld have off across the board (runlevels). chkconfig can also be used to turn on a particular service, which you would want to do in this case.
^[root@dhcp1 freepbx-2.1.1]# chkconfig httpd on
[root@dhcp1 freepbx-2.1.1]# chkconfig mysqld on
You can now access freePBX with your web browser.
The first time you click on the FreePBX Administration link you will be prompted for a username and password. Use admin and admin. CREATE A NEW ADMINISTRATIVE USER IMMEDIATELY AFTER LOGIN.
July 19, 2008 at 6:14 pm
http://infotalk.wordpress.com/2008/07/19/install-asterisk-on-centos/
Check above post and choose the best.