|
Preparations
Before you begin, you will need to have 5 different passwords. Some you already know, some you have to generate and write them down. I will refer to these passwords as follows:
PASSWORD1 – Your SSH root password (You have this already) PASSWORD2 – Used for the asterisk database user (Write this one down) PASSWORD3 – Used for the FreePBX administrator (Write this one down) PASSWORD4 – Used for Flash Operator Panel (Write this one down) PASSWORD5 – Used for the Asterisk Recording Interface (Write this one down)
Pre-install requirement
|
1
2
3
4
5
|
yum groupinstall "DNS Name Server"
yum groupinstall "Web Server"
yum groupinstall "Mail Server"
yum groupinstall "MySQL Database"
yum groupinstall "Development Tools"
yum install php-pear*
|
Once you are sure that the needed package groups are installed, you will want to install the prerequisites as follows.
|
1
2
3
|
yum install e2fsprogs-devel keyutils-libs-devel krb5-devel libogg libselinux-devel libsepol-devel libxml2-devel libtiff-devel
yum install gmp php-pear php-pear-DB php-gd php-mysql php-pdo kernel-devel ncurses-devel audiofile-devel libogg-devel
yum install openssl-devel mysql-devel zlib-devel perl-DateManip sendmail-cf sox
|
Also be sure that wget is installed on your system.
In the next step we will generate the named.conf file.
|
1
2
3
4
5
6
7
8
9
10
|
echo "options {" >> /var/named/chroot/etc/named.conf
echo " directory \"/var/named\";" >> /var/named/chroot/etc/named.conf
echo " dump-file \"/var/named/data/cache_dump.db\";" >> /var/named/chroot/etc/named.conf
echo " statistics-file \"/var/named/data/named_stats.txt\";" >> /var/named/chroot/etc/named.conf
echo "};" >> /var/named/chroot/etc/named.conf
echo "include \"/etc/rndc.key\";" >> /var/named/chroot/etc/named.conf
cd /var/named/chroot/etc/
chmod 640 named.conf
chgrp named named.conf
ln -s /var/named/chroot/etc/named.conf /etc/named.conf
|
We need to turn off SELinux. If you don't turn SELinux off your setup of FreePBX with Asterisk propably won't work.
|
1
|
echo "SELINUX=disabled" > /etc/selinux/config
|
In this next step we are going to configure iptables voor Asterisk and FreePBX. If you wish you can also disable iptables on your server. If you wish to configure iptables, please make sure the file /etc/sysconfig/iptables looks like this:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
*mangle
:PREROUTING ACCEPT [83145:120824770]
:INPUT ACCEPT [83145:120824770]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [46823:2584014]
:POSTROUTING ACCEPT [46823:2584014]
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1:60]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -f -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -i eth0 -p tcp -m tcp --dport 4445 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 5060 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 5060 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 10000:20000 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 5061 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 5061 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 4569 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -m state --state NEW -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-port-unreachable
COMMIT
*nat
:PREROUTING ACCEPT [164:6544]
:POSTROUTING ACCEPT [148:8939]
:OUTPUT ACCEPT [148:8939]
COMMIT
|
LAME is required for Asterisk’s audio related functions. You will want to download LAME to a source directory, compile and then install it.
|
1
2
3
4
5
|
cd /usr/src
wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz?ts=1292626574&use_mirror=cdnetworks-us-1
tar zxvf lame-3.98.4.tar.gz
cd lame-3.98.4
./configure
|
You can optionally remove the source once you have installed LAME.
|
1
2
3
|
cd ..
rm -fr lame-3.98.4
rm lame-3.98.4.tar.gz
|
We also need to add DAHDI support if you want to set up conferences in FreePBX / Asterisk. Most of you do want this feature I believe, if not, skip this step.
|
1
2
3
4
5
6
7
8
9
|
cd /usr/src/
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.4.0+2.4.0.tar.gz
tar zxvf dahdi-linux-complete-2.4.0+2.4.0.tar.gz
cd dahdi-linux-complete-2.4.0+2.4.0
make all
make install
make config
/etc/init.d/dahdi restart
chkconfig dahdi on
|
Before continuing, ensure that all packages are up to date and then reboot.
Installing Asterisk 1.8
Get Asterisk 1.8 and extract it to its own source folder. Afterwards we start the installation immediately.
|
1
2
3
4
5
6
7
8
|
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
tar xvfz asterisk-1.8-current.tar.gz
cd asterisk-1.8.x.x #Replace 1.8.x.x with the correct version
contrib/scripts/get_mp3_source.sh
./configure
make
menuconfig
|
The last command will launch the source configuration manager. Make sure you select the following:
- Head into Channel Drivers and make sure chan_dahdi is selected (only needed if you want to use conferences and installed dahdi in the steps before) - Head into Add-Ons and make sure app_mysql, app_saycountpl, cdr_mysql, format_mp3, res_config_mysql are selected - Head into Extra Sound Packages and make sure EXTRAS-SOUNDS-EN-GSM is selected
Save your selections and exit. Now compile the source and install.
You can optionally remove the source directory once you have installed Asterisk.
|
1
2
3
|
cd ..
rm -fR asterisk-1.8.x.x #Replace 1.8.x.x with the correct version
rm asterisk-1.8-current.tar.gz
|
Installing FreePBX 2.8
Get FreePBX 2.8 and extract it to its own source folder.
|
1
2
3
4
|
cd /usr/src
wget http://mirror.freepbx.org/freepbx-2.8.0.tar.gz
tar xvfz freepbx-2.8.0.tar.gz
cd freepbx-2.8.0
|
Start MySQL, create the asterisk databases and run the initial SQL setup scripts.
|
1
2
3
4
5
6
|
/etc/init.d/mysqld start
chkconfig mysqld on
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql
|
Start the MySQL command line.
Define the user and password for each of the databases.
Change the MySQL user to root.
|
1
|
mysqladmin -u root password 'PASSWORD1'
|
Create the Asterisk user and set folder permissions.
|
1
2
3
4
|
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk
chown -R asterisk:asterisk /var/run/asterisk
chown -R asterisk:asterisk /var/log/asterisk
chown -R asterisk:asterisk /var/lib/php/session/
|
Update the Apache configuration file.
|
1
|
vi /etc/httpd/conf/httpd.conf
|
In this file change the following settings to the values as listed here:
|
1
2
3
4
5
6
7
8
9
10
11
12
|
# Search for the setting User & Group
User asterisk
Group asterisk
# Search for the setting AllowOverride
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
# Search for the setting ServerName
ServerName <your ip or hostname>:80
|
Start the Apache webserver.
|
1
2
|
/etc/init.d/httpd start
chkconfig httpd on
|
Start Asterisk
Configure FreePBX.
|
1
|
./install_amp --username=asteriskuser --password=PASSWORD2
|
The next series of prompts will give you default values within square brackets which you can accept by hitting enter. If you wish to change a value, simply type it and hit enter after.
This is the database user you specified earlier.
This is the password for the database user.
Use the default value.
The username for the FreePBX administrator.
The password for the FreePBX administrator. It is important to change this. (Use PASSWORD3 you prepared earlier.)
Use the default value.
The public IP that will be used.
The Flash Operator Panel password. It is important to change this. (Use PASSWORD4 you prepared earlier)
Use the default value.
|
1
|
[/var/lib/asterisk/bin]
|
Use the default value.
Use the default value.
Change the Asterisk Recording Interface password and turn on user authentication for the web interface by editing the amportal.conf file.
Change the ARI_ADMIN_PASSWORD entry to update the ARI password.
|
1
|
ARI_ADMIN_PASSWORD=PASSWORD5
|
Change the AUTHTYPE entry to database to enable authentication.
Optionally, you can turn off the FOP completely by changing the following settings.
|
1
2
|
FOPRUN=false
FOPDISABLE=true
|
Save and exit.
Add FreePBX to the boot process.
|
1
|
echo "/usr/local/sbin/amportal start" >> /etc/rc.local
|
Reset the permissions of the /var/www/html
|
1
|
chown -R asterisk:asterisk /var/www/html
|
Finally, reboot the server one last time.
Post installation actions
After you succesfully installed FreePBX and Asterisk, you need to do some extra steps.
First open a browser and go to your Asterisk server by enetering the URL http://<your ip or hostname>. When you are there go to "FreePBX Administration". You will receive an pop-up, fill username "admin" and password "admin". Once logged in, in the left menu click on "Administrators". Then click in the right menu on "admin". Now change the admin password to PASSWORD3 (you prepared it earlier).
Then click on the left menu on the option "Module Admin". Now click on "Check for updates online" and install the updates you want and install the new modules if you like (I installed and updated all modules). |