[UPDATE 11-09-2013 – FREEPBX 2.11 FULL RELEASE]
MORE UPDATE : Why not try our VMWare Image of Asterisk 11 and FBX2.11B2, no installation required! Fully functional and business ready.
Hi guys, been a while since I got my hands on the blogging software. Anyway, I would like to share a simple guide to get an Asterisk 11 and FreePBX 2.11 (full release) running on a Debian 6.0x OS. If you use other OSes, the only thing you will probably change is the software repo manager (debians use apt, centos will like use yum) and the packages name. It won’t run too far from the installation shown here. Here’s a quick guide to install to Ubuntu (close to debian installation) and CentOS.
NOTES
- You should use FreePBX 2.11 as it officially supports Asterisk 11. Other versions may work but things may also break
- This is a step by step copy paste guide, no explanations are provided. If anything breaks, something is wrong, nothing should break actually
- # means it’s a command line you need to copy paste. Of course, don’t copy the # itself, its just an indicator that it’s shell command …
- Some of the Asterisk installations steps are taken off http://blogs.digium.com (don’t have to reinvent the wheel..)
- This is not a comprehensive installation with best practices etc, but it does take care of some basic security stuff, do read online as much as possible
- Get your Debian installed and ready to get worked on, be sure to work on a putty.exe session so be sure to install ssh # apt-get install ssh
- # apt-get update && apt-get upgrade (reboot the box if updates are installed, if clean install no need to reboot)
- # apt-get install –force-yes build-essential ssh sudo libxml2 libxml2-dev libtiff4 libtiff4-dev php5 libapache2-mod-php5 php5-cli php5-curl php5-mysql php5-gd libmysqlclient-dev php-pear php-db linux-headers-`uname -r` curl sox apache2 libssl-dev libncurses5-dev bison libaudiofile-dev subversion libnewt-dev libcurl4-openssl-dev libnet-ssleay-perl openssl libauthen-pam-perl libio-pty-perl vim tcpdump htop php5-cgi mpg123 libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl libplrpc-perl libterm-readkey-perl mysql-client-5.1 mysql-common libapt-pkg-perl libsqlite3-dev uuid-dev -y (These include dependencies for FreePBX as well and some extras)
- # reboot (yes, reboot, then login to continue from below)
- # cd /usr/src/
- # wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
- # wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
- # wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
- # tar -zxvf dahdi-linux-complete-current.tar.gz
- # tar -zxvf libpri-1.4-current.tar.gz
- # tar -zxvf asterisk-11-current.tar.gz
- # cd dahdi-*
- # make && make install && make config
- # cd ..
- # cd libpri-*
- # make && make install (if you face errors with esp Ubuntu, you need to get a patch here, you should not see any errors tho)
- Before we install Asterisk, we would like to prep it for FreePBX use, e.g. creating groups and users and associating Apache to run as that low privileged user, dependencies etc, etc..
- # groupadd asterisk
- # useradd -g asterisk -c “Asterisk PBX” -d /var/lib/asterisk asterisk
- # mkdir /var/run/asterisk
- # chown -R asterisk:asterisk /var/run/asterisk
- # cd /etc/apache2 (now, we will attempt to modify apache configs to run as the new user/group asterisk we just created, steps may be different from other OSes, take note)
- # mv envvars envvars.old
- # echo “export APACHE_RUN_USER=asterisk” >> envvars
- # echo “export APACHE_RUN_GROUP=asterisk” >> envvars
- # echo “export APACHE_PID_FILE=/var/run/apache2.pid” >> envvars
- # echo “export APACHE_RUN_DIR=/etc/apache2” >> envvars
- # echo “export APACHE_LOG_DIR=/var/log/apache2” >> envvars
- # chown -R asterisk:asterisk /var/lib/php5
- # /etc/init.d/apache2 restart
- # cd ..
- # cd /usr/src/asterisk-11*
- # contrib/scripts/get_mp3_source.sh
- # ./configure && make menuconfig (when the menu pops up, be sure to select under Add-ons, format_mp3, res_config_mysql, app_mysql, app_saycountpl and cdr_mysql. Now, go to Extra Sound Packages and if you can’t see that left menu option just keep scrolling down using your down arrow key, when you found it, move over to the right menu then select Extra-Sounds-En-WAV, in core sound packages, also select the WAV version for best compatibility. Save and exit)
- # make && make install && make samples (NOTE: Don’t need to make config since we are using FreePBX and we start amportal rather than just asterisk itself)
- At this point you have a running Asterisk server! Congrats, now comes FreePBX. But there’s not much configs, so be prepared for Asterisk complaining about stuff and all if you try to start it.
- # apt-get install -y mysql-server (when prompted, create the MySQL password, for this guide, we will use my@sql as the password
- # cd /usr/src
- # wget http://mirror.freepbx.org/freepbx-2.11.0.tar.gz (replace appropriate version that’s newer when available, see here )
- # tar -zxvf freepbx*
- # cd freepbx*
- # mysqladmin create asteriskcdrdb -h localhost -u root -p (Enter your MySQL password as above when prompted)
- # mysql -u root -p asteriskcdrdb < /usr/src/freepbx-2.11.0/SQL/cdr_mysql_table.sql (Enter your MySQL password when prompted, also note the directory of FreePBX to match the ver you downloaded)
- # mysqladmin create asterisk -h localhost -u root -p (Enter your MySQL password as above when prompted)
- # mysql -u root -p asterisk < /usr/src/freepbx-2.11.0/SQL/newinstall.sql (Password again)
- # mysql -h localhost -u root -p mysql –execute=”GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY ‘fbx@mysql’;” (Note: Here we create a new user for FreePBX to use MySQL and that is user asteriskuser with password fbx@mysql, change accordingly)
- # mysql -h localhost -u root -p mysql –execute=”GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY ‘fbx@mysql’;”
- # cd /usr/src/freepbx-2.11.0/
- # mysql -h localhost -u root -p mysql –execute=”FLUSH PRIVILEGES”
- # asterisk && ./install_amp (AT THIS POINT, ONLY ENTER THE DATABASE PASSWORD YOU CREATED IN STEP 34, in the case above that would be fbx@mysql)
- # /var/lib/asterisk/bin/module_admin upgradeall
- # /var/lib/asterisk/bin/module_admin reload
- Now to sign on to FreePBX. Go to your server http://<ipaddress>/html, default username and password is admin/admin be sure to change that too!!!
- Immediately update all modules in module admin
- NOTE: If you see FreePBX complain about some symlinks, do this below rm /etc/asterisk/iax.conf
rm /etc/asterisk/sip.conf
rm /etc/asterisk/extensions.conf
rm /etc/asterisk/logger.conf
rm /etc/asterisk/features.conf
rm /etc/asterisk/sip_notify.conf
rm /etc/asterisk/confbridge.conf
rm /etc/asterisk/ccss.conf
rm /etc/asterisk/cel.conf
rm /etc/asterisk/cel_odbc.conf
rm /etc/asterisk/res_odbc.conf
/var/lib/asterisk/bin/retrieve_conf- Then refresh your FreePBX browser page, and hit Apply Conf. If there are other .conf files interfering, just rm it and retrieve_conf again….
- VERY IMPORTANT TO DO THIS NOW!!!
- Change the admin password | Go to Admin | Administrators, select admin and change the password there
- Change your AMI password – Go to Settings | Advanced Setting | under Asterisk Manager, change it there to something of your choice
- Change ARI password – Go to Settings | Advanced Settings | under System Settings, change User Portal Admin Password to something of your choice
- Get all the latest packages – Go to Admin | Module Admin | select Basic and Extended, click on download all, upgrade all, click process, wait to download, click Apply
- Sometimes, the SIP Nat settings can be wrong, click on Advanced | Asterisk SIP Settings | Be sure to set to Public to get things started..
- If you get errors with conference just ignore or clear it, it wont come back and conferencing will work just fine
- You should not screen any significant errors or warnings in the Dashboard
- OPTIONALLY, if you want Asterisk to start automatically when reboot
- Create a FreePBX startup script
- # echo “#!/bin/bash” > /usr/bin/amportal-start
# echo “/usr/local/sbin/amportal start” >> /usr/bin/amportal-start
# echo “exit 0” >> /usr/bin/amportal-start
# chmod +x /usr/bin/amportal-start - # nano /etc/rc.local
- Before where it says exit 0, paste this line
# /usr/bin/amportal-start - Reboot at least once
- And there you go, functional FreePBX 2.11 with Asterisk 11 ready to go…
- Test, test and test more
Known issues (this list keeps getting updated!)
- You might get errors with the FreePBX UI not loading and what not and says server error, tail the apache error log, its likely some module like digium modules breaking it, if you get that, run this # amportal a ma disable digiumaddoninstaller
# amportal a ma delete digium_phones
# amportal a ma delete digiumaddoninstaller You can add them later using Module AdminThanks and have a great week ahead!
Sanjay
Dear Sanjay,
thank you for Wonderful steps for installation of system. we have installed Freepbx + ubuntu 12.10 + asterisk 11. system is working fine.
can you please explain littel more for step 45, I am new to linux and not sure where to run these commands.
# echo “#!/bin/bash” > /usr/bin/amportal-start
# echo “/usr/local/sbin/amportal start” >> /usr/bin/amportal-start
# echo “exit 0” >> /usr/bin/amportal-start
# chmod +x /usr/bin/amportal-start
Also when I logon to GUI, there is an errors as
Error Unable to write to /etc/modprobe.d/dahdi.conf
Error File /etc/modprobe.d/dahdi.conf is not owned by asterisk
Error Could not reload FOP server
Error Failed to copy from module agi-bin
Hi
The guide was written for debian not Ubuntu tho.
As for those commands they are to create a file for automatically starting asterisk on boot
Dear Sanjay,
Thanks for this post.
When I am running second command.
"apt-get install –force-yes build-essential ssh sudo libxml2 libxml2-dev libtiff4 libtiff4-dev php5 libapache2-mod-php5 php5-cli php5-curl php5-mysql php5-gd libmysqlclient-dev php-pear php-db linux-headers-`uname -r` curl sox apache2 libssl-dev libncurses5-dev bison libaudiofile-dev subversion libnewt-dev libcurl4-openssl-dev libnet-ssleay-perl openssl libauthen-pam-perl libio-pty-perl vim tcpdump htop php5-cgi mpg123 libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl libplrpc-perl libterm-readkey-perl mysql-client-5.1 mysql-common libapt-pkg-perl libsqlite3-dev -y",
I am getting following three errors
"Unable to locate package php-db,
Unable to locate package libnewt-dev ,Unable to locate package mpg123". Can you please help me on this.?
What OS are u working with? This guide is for debian 6..
Dear Sanjay,
Thanks for the Post
I am using Debian 6.0.6
i have a problem when i try to run asterisk:
root@pbx:~# asterisk
Illegal instruction
tail /var/log/messages
pbx kernel: [ 1435.377645] asterisk[1512] trap invalid opcode ip:55d700 sp:7fff33194b50 error:0 in asterisk[400000+1fb000]
debian 6
i have a problem when i try run asterisk
root@pbx:~# asterisk
Illegal instruction
pbx kernel: [ 1435.377645] asterisk[1512] trap invalid opcode ip:55d700 sp:7fff33194b50 error:0 in asterisk[400000+1fb000]
debian 6
Hi,
tnx for your how to.
While I'm installing it on a remote server, the network goes down on point 36.
Now, if I try it again, I see:
# asterisk && ./install_amp Asterisk already running on /var/run/asterisk/asterisk.ctl. Use 'asterisk -r' to connect
And if I try with "-r":
Checking for selinux..OK
Connecting to database..PHP Notice: Undefined index: AMPDBUSER in /usr/src/freepbx-2.11.0beta2/install_amp on line 1216
PHP Notice: Undefined index: AMPDBPASS in /usr/src/freepbx-2.11.0beta2/install_amp on line 1217
FAILED
Try running ./install_amp –username=user –password=pass (using your own user and pass)
[FATAL] Cannot connect to database
Please help me
🙁
Failed to copy from module agi-bin
Retrieve conf failed to copy file(s) from a module's agi-bin dir: copy(/var/lib/asterisk/agi-bin/fixlocalprefix): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/directory): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/enumlookup.agi): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/dialparties.agi): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/sql.php): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/checksound.agi): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/user_login_out.agi): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/list-item-remove.php): failed to open stream: Permission denied
Added 5 minutes ago
(retrieve_conf.CPAGIBIN)
Failed to copy from module agi-bin
Retrieve conf failed to copy file(s) from a module's agi-bin dir: copy(/var/lib/asterisk/agi-bin/fixlocalprefix): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/directory): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/enumlookup.agi): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/dialparties.agi): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/sql.php): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/checksound.agi): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/user_login_out.agi): failed to open stream: Permission denied
copy(/var/lib/asterisk/agi-bin/list-item-remove.php): failed to open stream: Permission denied
Added 5 minutes ago
(retrieve_conf.CPAGIBIN)
Hi Sanjay.
I am at step 36 and only changed the password, however did not change the IP address to reflect the actual (192.168.92.170). The end of the install shows to connect to 192.168.1.1 and there is nothing listening on port 80. I have tried changing the amp_config, tried deleting /etc/amportal.conf and entering the correct IP, etc. Still nothing.
The below errors show when setting freepbx :
freepbx setting [AMPDBHOST] DOES NOT EXIST, can't set to [localhost]
freepbx setting [AMPDBENGINE] DOES NOT EXIST, can't set to [mysql]
freepbx setting [AMPENGINE] set to [asterisk]
freepbx setting [AMPMGRUSER] set to [admin]
freepbx setting [AMPMGRPASS] set to [amp111]
freepbx setting [AMPBIN] set to [/var/lib/asterisk/bin]
freepbx setting [AMPSBIN] set to [/usr/local/sbin]
freepbx setting [AMPWEBROOT] set to [/var/www/html]
freepbx setting [AMPCGIBIN] set to [/var/www/cgi-bin ]
freepbx setting [FOPWEBROOT] set to [/var/www/html/panel]
freepbx setting [FOPPASSWORD] DOES NOT EXIST, can't set to [passw0rd]
freepbx setting [AUTHTYPE] set to [database]
freepbx setting [AMPEXTENSIONS] set to [extensions]
freepbx setting [AMPDBUSER] DOES NOT EXIST, can't set to [asteriskuser]
freepbx setting [AMPDBPASS] DOES NOT EXIST, can't set to [fbx@mysql]
freepbx setting [AMPWEBADDRESS] set to [192.168.92.170]
freepbx setting [AMPDBNAME] DOES NOT EXIST, can't set to [asterisk]
freepbx setting [ASTETCDIR] set to [/etc/asterisk]
freepbx setting [ASTMODDIR] set to [/usr/lib/asterisk/modules]
freepbx setting [ASTVARLIBDIR] set to [/var/lib/asterisk]
freepbx setting [ASTAGIDIR] set to [/var/lib/asterisk/agi-bin]
freepbx setting [ASTSPOOLDIR] set to [/var/spool/asterisk]
freepbx setting [ASTRUNDIR] set to [/var/run/asterisk]
freepbx setting [ASTLOGDIR] set to [/var/log/asterisk]
freepbx setting [FPBXDBUGFILE] set to [/var/log/asterisk/freepbx_debug]
root@asterisk:/etc/apache2# /etc/init.d/apache2 restart
Restarting web server: apache2/var/lock/apache2 already exists but is not a directory owned by asterisk.
Please fix manually. Aborting.
failed!
can u help me?
i got error in step 16
root@asterisk:/etc/apache2# /etc/init.d/apache2 restart
Restarting web server: apache2/var/lock/apache2 already exists but is not a directory owned by asterisk.
Please fix manually. Aborting.
failed!
Hi,
run following command
root@asterisk# chown -R asterisk:asterisk /var/lock/apache2
Amazing tutorial!!
Just I can not register my extensions!
I get a Wrong password error although my NAT settings and localnet settings are fine!
What do you think the issue is?
I'm having a similar issue. Any advice?
Very great Tutorial one of the best i find for asterisk and freepbx. Thank you so much everythink working like a charm:)
Hi Sir
It is a great tutorial for asterisk and freepbx.
But i am getting a error.Whenever i run this command '/var/lib/asterisk/bin/module_admin upgradeall' i get this error
/usr/src/freepbx-2.11.0beta2# /var/lib/asterisk/bin/module_admin upgradeall
no repos specified, using: [standard] from last GUI settings
Up to date.
**** WARNING: ERROR IN CONFIGURATION ****
astrundir in '/etc/asterisk' is set to but the directory
does not exists. Attempting to create it with: 'mkdir -p '
mkdir: missing operand
Try 'mkdir –help' for more information.
**** ERROR: COULD NOT CREATE ****
Attempt to execute 'mkdir -p ' failed with an exit code of 1
You must create this directory and the try again.
need your help…
is it possible to have a script to install it in fresh installs of debian squeeze/wheezy?