- How To Install step by step Asterisk in Ubuntu Server
- Linux Version : Ubuntu Server
- Linux Kernel : 2.6.22
- Asterisk Version : Asterisk V.1.4.13
- FreePBX Version : FreePBX 2.3.1
- Linux filesystem partition example
- /boot 100 MB
- /var 4 GB
- /home 6 GB
- /usr 12 GB
- / 6 GB
- Swap 600 MB
- RAM Memory: 512 MB
- CPU: Intel(R) Pentium(R) 4 CPU 3.06GHz
- Ethernet: 10/100 VT6102 Rhine-II
- FXO Card: 1 FXO Tiger Jet Network Inc. Tiger3XX Modem/ISDN interface
- FXS card:
- Sound: VT8233/A/8235/8237 AC97 Audio Controller
- Bluetooth:
- WiFi:
- Other Devices:
- ************************************************************************************************
- ************************************************************************************************
- ******************************** Packages Install
- ************************************************************************************************
- ************************************************************************************************
- After of install Ubuntu Linux the first thing that we need to do is change the root password
sudo passwd root
password
- Edit the next file /etc/apt/sources.list and uncomment the next packages repositories
sudo editor /etc/apt/sources.list
- uncomment and after save the edited file
deb dapper universe
deb-src dapper universe
- First we need to install OpenSSH to communicate from other PC using SSH.
sudo apt-get install openssl libssl-dev ssh
- After we need to install compilation library
sudo apt-get install gcc make g++
- View what kernel version has installed our Ubuntu Linux
uname -a
- after of run the command uname I can see something like that
LinuxMexRom2.6.22-14-generic#1SMPSunOct1423:05:12GMT2007i686GNU/Linux
- Then I need to search the headers, images and sources for kernel
apt-cache search 2.6.22
- we need to install the headers, image and sources for the kernel
sudo apt-get install linux-headers-2.6.22-14-generic linux-image-2.6.22-14-generic linux-source-2.6.22
- too we need install the next applications nmap is practice to view what porst have open our linux systmen, lynx to see any web site from CLI and emacs to files edit
sudo apt-get install nmap lynx emacs21
- We will install festival beacuse is very important for make AGIs with asterisk and any programming language
sudo apt-get install festival festival-dev
- We need the next library to Asterisk
sudo apt-get install ncurses-base ncurses-bin ncurses-term libncurses5 libncursesw5 libncurses5-dev libncursesw5-dev
- Too is necessary to install the next library
sudo apt-get install zlib1g zlib1g-dev
- This library are required by FreePBX
sudo apt-get install bison bison-doc
- library required for FreePBX
sudo apt-get install libxml2 libxml2-dev
- library required for FreePBX
sudo apt-get install libtiff4 libtiff4-dev
- library required for FreePBX for audio processing
sudo apt-get install libasound2 libgsm1 libltdl3 libpq4 libspeex1 libsqlite0 libtonezone1 libaudiofile0 libaudiofile-dev
- if you will install a Sangoma Card then you will need install the next
sudo apt-get install flex
- This library are necessary to Asterisk Documentation and install new versions of Asterisk and FreePBX
sudo apt-get install subversion curl doxygen
- library required for FreePBX
sudo apt-get install libnet-telnet-perl mime-construct libipc-signal-perl libmime-types-perl libproc-waitstat-perl
- Install Apache web server to acces from any computer to FreePBX GUI
sudo apt-get install apache2
- PHP Librarys required for FreePBX
sudo apt-get install php5 php5-cli php5-mysql php-pear libapache2-mod-php5 php5-curl php5-gd php-db
- We need install MySQL Database server to manage the cdr information and asterisk configuration from FreePBX.
sudo apt-get install mysql-client-5.0 mysql-server-5.0 libmysqlclient15-dev
- After of Install MySQL maybe we need make any changes these
We need enter the root password to MySQL Server
Change the information of Internet Site and select of type like this
localhost.localdomain
- ************************************************************************************************
- ************************************************************************************************
- ******************************** Asterisk Package Compilations ****************************
- ************************************************************************************************
- ************************************************************************************************
- in this second step we need create a new folder to put the asterisk packages downloaded
mkdir ~/asterisk
cd asterisk
- Download the next files and save in the new folder created
- Download asterisk-perl this module will allow us process the Asterisk Configuration
wget
- These files are requires to control the mp3 and other audio files such as GSM, Ulaw, alaw files etc.
wget
wget
- Download FreePBX Package that is the main application to configure asterisk from a web navigator
wget
- Asterisk Packages
wget
- If we have a digium card to connect the pstn to our voip network then we need download and install the next package
wget
wget
wget
- voices in english for Asterisk
wget
wget
wget
- we go the following directory
cd /usr/src/
- we decompress the lame package and we compile and to install
sudo tar -xvzf ~/asterisk/lame-3.97.tar.gz
cd lame-3.97
sudo ./configure --prefix=/usr --sysconfdir=/etc
sudo make & sudo make install
- we decompress sox package and we install this library to process multimedia files
cd /usr/src/
sudo tar -xzvf ~/asterisk/sox-14.0.0.tar.gz
cd sox-14.0.0
sudo./configure
sudomake
sudomakeinstall
- We need to install Asterisk-Perl to process the Asterisk File Configuration
cd /usr/src/
sudo tar -xzvf ~/asterisk/asterisk-perl-0.10.tar.gz
cd asterisk-perl-0.10
sudo perl Makefile.PL
sudo make all
sudo make install
- To descompress FreePBX
cd /usr/src
sudo tar -xzvf ~/asterisk/freepbx-2.3.1.tar.gz
cd /usr/src/freepbx-2.3.1
- Begin to install the database for Asterisk in MySQL
- First We need to access to MySQL CLI, enter the password root, if you don't have configure the password root for mysql then is very important that yo make this step.
mysql -u root -p
ENTER
showdatabases;
usemysql;
- Change the root password if you dont have make it
updateusersetpassword=password("PaSsWoRd")whereuser="root";
- Create the asterisk user for mysql
grantallprivilegeson*.*toasterisk@localhostidentifiedby"4st3r1sk";
flushprivileges;
exit
- Entet to mysql using the asterisk user created
mysql-uasterisk-p
- create the database for Asterisk Configuration and CDR information
createdatabaseasteriskcdrdb;
createdatabaseasterisk;
exit
- dump the database schema that is in SQL Folder of FreePBX installation directory
mysql-uasterisk-pasterisk/usr/src/freepbx-2.3.1/SQL/newinstall.sql
mysql-uasterisk-pasteriskcdrdb/usr/src/freepbx-2.3.1/SQL/cdr_mysql_table.sql
- Finish the MySQL Configuration
- Create the user for Asterisk and change him password
sudo groupadd asterisk
sudo useradd -c "PBX asterisk" -d /var/lib/asterisk -g asterisk asterisk
sudo passwd asterisk
- Create the next directory where Asterisk will put the PID Asterisk Run
sudo mkdir /var/run/asterisk
sudo chown asterisk:asterisk /var/run/asterisk
- Add the Asterisk user for Apache
sudo emacs /etc/group
www-data:x:33:asterisk
- press ctrl+x ctrl+s, para salir ctr+x, ctr+cto save and quit
- Search the apache configuration using the find command
find /etc/apache2/ -type f | xargs grep Group
- Edit the next file
sudo emacs /etc/apache2/apache2.conf
- to search en Emacs press Ctrl+s and enter the text to search
- Change default user for Apache by asterisk user
Userwww-data
Groupwww-data
- change by
Userasterisk
Groupasterisk
- saver and quit (to save ctrl+x ctrl+s, to quit ctr+x, ctr+c )
- execute the next command to change the permissions of php lib sessions
sudo chown -R asterisk /var/lib/php5
- Edit the php file configuration and modify the following php properties
sudoemacs/etc/php5/apache2/php.ini
upload_max_filesize = 32M
max_execution_time = 120
max_input_time = 120
- create the Asterisk directrory in /usr/src
sudomkdir/usr/src/asterisk
cd/usr/src/asterisk
- decompress the libpri library
sudo tar zvxf ~/asterisk/libpri-1.4.1.tar.gz
- decompress the zaptel library
sudo tar zvxf ~/asterisk/zaptel-1.4.5.1.tar.gz
- decompress Asterisk Files
sudo tar zvxf ~/asterisk/asterisk-1.4.13.tar.gz
- decompress Asterisk AddOns
sudo tar zvxf ~/asterisk/asterisk-addons-1.4.4.tar.gz
- decompress Asterisk Sounds
sudo mkdir asterisk-sounds
cd asterisk-sounds
sudo tar zvxf ~/asterisk/asterisk-core-sounds-en-ulaw-current.tar.gz
sudo tar zvxf ~/asterisk/asterisk-extra-sounds-en-ulaw-current.tar.gz
sudo tar zvxf ~/asterisk/asterisk-moh-freeplay-ulaw.tar.gz
- compile LibPri library
cd/usr/src/asterisk/libpri-1.4.1
sudomakesudomakeinstall
- compile the Zaptel Drivers for asterisk
cd/usr/src/asterisk/zaptel-1.4.5.1
sudomakeclean
sudomake
sudomakeinstall
sudo make config
- Compiling Asterisk
cd/usr/src/asterisk/asterisk-1.4.13
sudomakeclean
sudo ./configure
sudomake
sudomakeinstall
sudomakesamples
sudomakeprogdocs
- Compiling Asterisk AddOns
cd /usr/src/asterisk/asterisk-addons-1.4.4
sudo make
sudo make install
- Copy the Asterisk Sound to Asterisk sound default directory
sudo cp -rf /usr/src/asterisk/asterisk-sounds/* /var/lib/asterisk/sounds/
- Restart Apache Web Server
sudo/etc/init.d/apache2restart
- Edit the asterisk file config
sudoemacs/etc/asterisk/asterisk.conf
- change the next line
RUNASTERISK=/var/run
- by
RUNASTERISK=/var/run/asterisk
- change the user for /var/run/asterisk
sudochown-Rasterisk:asterisk/var/run/asterisk
- Start Asterisk before to begin install FreePBX or FreePBX dont let you to install if dont have started asterisk previously
sudo asterisk start
- check if asterisk has started
ps aux | grep asterisk
- if Asterisk has started then maybe you can see somethink like this
root 14992 0.2 1.7 22044 7752 ? Ssl 07:14 0:00 asterisk start
- To go FreePBX Directory Installation
cd/usr/src/freepbx-2.3.1/
- Install the db library using pear
sudopearinstalldb
- if you dont found the package, then you can install it manually : sudo pear install db.17.0.0.tgz
sudo mkdir /var/www/asterisk/
sudo mkdir /var/www/asterisk/cgi-bin
sudo chown asterisk:asterisk /var/www/asterisk
sudo ./install_amp
- after to execute install_amp it will request the values to create the file configuration
- first will request the mysql database user
asteriskuser asterisk
- after enter the password for mysql user
Enter your PASSWORD to connect to the 'asterisk' database:
amp109 4st3r1sk
- Enter the name of database server, if your database server is other server that not be your local hostlocalhost then enter the IP address or the domain name.
Enter the hostname of the 'asterisk' database:
localhost localhost
- User name to access to Asterisk Manager Interface
Enter a USERNAME to connect to the Asterisk Manager interface:
admin asterisk
- Password for AMI
Enter a PASSWORD to connect to the Asterisk Manager interface:
amp111 4st3.r1sk
- Path for the web directory of FreePBX installation
Enter the path to use for your AMP web root:
/var/www/html /var/www/asterisk
- IP Address of web server
Enter the IP ADDRESS or hostname used to access the AMP web-admin:
<ahref='xx.xx.xx.xx'>xx.xx.xx.xx192.168.1.2 </ahref='xx.xx.xx.xx'>
- Password to operate Flash Operator Panel
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:
<ahref='passw0rd'>passw0rd4st3r1sk.01 </ahref='passw0rd'>
- Select default
Use simple Extensions extensions admin or separate Devices and Users deviceanduser?
<ahref='extensions'>extensions </ahref='extensions'>
- Select default
Enter directory in which to store AMP executable scripts:
<ahref=' var="" lib="" asterisk="" bin="">/var/lib/asterisk/bin </ahref='>
- Select default
Enter directory in which to store super-user scripts:
<ahref=' usr="" local="" sbin="">/usr/local/sbin </ahref='>
- if you had any error check the database password and user, php and mysql library, apache restart, check pear and php-db installation
- en caso de que tuviera un error al ejecutar FreePBX puede reconfigurarlo pero previamente eliminar el archivo de configuracion en /etc/amportal.conf
- create the following directory
sudomkdir/var/lib/asterisk/sounds/custom
- change the user for the following directory
sudochown-Rasterisk:asterisk/var/lib/asterisk/
- stop asterisk
ps aux | grep asterisk
root 14992 0.0 1.7 22524 7892 ? Ssl 07:14 0:00 asterisk start
- 14992 is the Asterisk PID , you will have to stop this pid using the kill command
sudo kill -s 9 14992
- Edit the next file and add the following line if this dont exist in the file
sudo emacs /etc/default/asterisk
RUNASTERISK=yes
- Run amportal
sudoamportalstart
- verify if asterisk is running
sudo ps aux | grep asterisk
- if asterisk is running you should see something like this
root 15759 0.0 0.1 3864 736 pts/2 S 07:30 0:00 /bin/bash /usr/sbin/safe_asterisk -U asterisk -G asterisk
asterisk 15764 2.0 1.9 22436 8552 pts/2 Sl 07:30 0:00 /usr/sbin/asterisk -f -U asterisk -G asterisk -vvvg -c
asterisk 15811 0.0 0.1 1752 496 pts/2 S 07:30 0:00 sh /var/www/asterisk/panel/safe_opserver
asterisk 15812 14.0 1.8 11072 8340 pts/2 S 07:30 0:00 /usr/bin/perl -w /var/www/asterisk/panel/op_server.pl
- Open FireFox and enter the ip address of your web server and put the complete path for FreePBX
- By default FreePBX not request your password, but after you should change the admin password and user
- Disconnect of FreePBX
- Later edit the amportal.conf file and change the AUTHTYPE value to database
sudo emacs /etc/amportal.conf
AUTHTYPE=database
- try again connect to FreePBX newly you will be able of enter your user and password to connect to FreePBX Admin
login:admin
password:4st3r1sk
- Now we have enabled the FreePBX to config Asterisk PBX
- You too can go to the Admin Module and check for new updates and downlooad this modules for have a FreePBX more advanced.
- If the Flash Operator Panel was not enabled, then copy the FOP files of panel directory in FreePBX Installation directory to directory configured in amportal for FOP.
cd /usr/src/freepbx-2.3.1
sudo cp -rf amp_conf/htdocs_panel/* /var/www/asterisk/panel
sudo chown asterisk.asterisk /var/www/asterisk/