This is an old revision of the document!
http://www.powerpbx.org/content/rhel-asterisk-freepbx-install-guide-rhel-v6-asterisk-v18-freepbx-v29
If installing on XenServer (skip otherwise):
mount /dev/xvdd /mnt/
/mnt/Linux/install.sh
reboot
yum -y groupinstall base core yum -y install gcc gcc-c++ wget bison mysql-devel mysql-server php php-mysql php-pear php-pear-DB php-mbstring php-process nano tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel subversion nano kernel-devel yum clean all
Pick one of these three firewall options.
system-config-firewall-tui
The following ports need to be opened:
Protocol | Ports | Description |
---|---|---|
TCP | 80 | HTTP |
TCP | 443 | HTTPS |
TCP | 4445 | Flash Operator Panel |
UDP | 5060-5061 | SIP |
UDP | 10000-20000 | RTP |
UDP | 4569 | IAX |
service iptables stop chkconfig iptables off service ip6tables stop chkconfig ip6tables off
Disable selinux:
vim /etc/selinux/config
SELINUX=disabled
setenforce 0
http://www.php.net/manual/en/timezones.php
ln -sf /usr/share/zoneinfo/America/Phoenix /etc/localtime
vim -c 946 /etc/php.ini
Uncomment and set PHP timezone:
date.timezone = America/Phoenix
vim -c 878 /etc/php.ini upload_max_filesize = 20M
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz tar zxvf asterisk-1.8-current.tar.gz cd /usr/src/asterisk-1.8* make clean ./configure && make menuselect
Select all addons. I believe these are all needed or recommended for FreePBX. Select base and addon sounds. I suggest ulaw as they sound better than gsm especially if you are using ulaw as your default codec. I usually just check both. Then make sure to press the “save” button afterwards.
If upgrading Asterisk on an already running FreePBX system do NOT run make samples.
make && make install && make samples
Create an 'asterisk' user. The user may already exist but this won't hurt:
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk
The following directory may already exist but just to make sure:
mkdir /var/run/asterisk
Set ownership of various folders:
chown -R asterisk /var/run/asterisk chown -R asterisk /var/log/asterisk chown -R asterisk /var/lib/asterisk/moh chown -R asterisk /var/lib/php/session
Adjust the manager interface username and password:
vim /etc/asterisk/manager.conf
Add a stanza like:
[admin] secret = your-manager-password deny=0.0.0.0/0.0.0.0 permit=127.0.0.1/255.255.255.0 read = system,call,log,verbose,command,agent,user write = system,call,log,verbose,command,agent,user
Here we create a symbolic link so that both FreePBX and Asterisk will find and store MOH files in the same place:
ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
Asterisk and FreePBX now only use .wav files for MOH so install mpg123 for converting uploaded mp3's to wav's:
cd /usr/src wget http://sourceforge.net/projects/mpg123/files/mpg123/1.13.4/mpg123-1.13.4.tar.bz2/download tar -xjvf mpg123-1.13.4.tar.bz2 cd mpg123-1.13.4 ./configure && make && make install ln -s /usr/local/bin/mpg123 /usr/bin/mpg123
Here we set the web server to run as the user 'asterisk' and group 'asterisk'.
sed -i "s/User apache/User asterisk/" /etc/httpd/conf/httpd.conf sed -i "s/Group apache/Group asterisk/" /etc/httpd/conf/httpd.conf
service mysqld start
cd /usr/src/freepbx-2.10.0 # adjust version if necessary mysqladmin create asterisk mysqladmin create asteriskcdrdb mysql asterisk < SQL/newinstall.sql mysql asteriskcdrdb < SQL/cdr_mysql_table.sql
mysql
Run these MySQL commands and adjust for your own password:
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'your-password'; GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'your-password'; flush privileges; exit
Finally, we set the MySQL root password. Don't forget it!
mysqladmin -u root password 'your-mysql-root-password'
Get the latest released version.
cd /usr/src wget http://mirror.freepbx.org/freepbx-2.10.0.tar.gz # adjust version if necessary tar zxvf freepbx-2.10.0.tar.gz
MySQL should still be running…
Start asterisk. You can ignore warnings, errors, and notices for now:
/usr/sbin/safe_asterisk cd /usr/src/freepbx-2.10.0 ./install_amp
You will be asked various questions which will be used to populate /etc/amportal.conf.
Use the defaults, mostly, but change:
Variable | Value |
---|---|
AMPMGRUSER | admin |
AMPMGRPASS | password you set when editing manager.conf above |
AMPDBPASS | password you chose when configuring MySQL security above |
AMPWEBADDRESS | the IP address of your PBX |
Now we delete a few configuration files that may interfere with FreePBX:
rm -f /etc/asterisk/{sip_notify.conf,iax.conf,logger.conf,features.conf,sip.conf,extensions.conf,ccss.conf,chan_dahdi.conf}
vim /etc/asterisk/cdr_mysql.conf loguniqueid=yes # add to [Global] section which you may need to also un-comment
cat << EOF >> /etc/logrotate.d/asterisk /var/log/asterisk/messages /var/log/asterisk/*log /var/log/asterisk/full { missingok notifempty sharedscripts create 0640 asterisk asterisk postrotate /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null endscript } EOF kill -HUP $(pidof syslogd)
Enable Apache, MySQL and FreePBX to autostart on boot:
chkconfig httpd on chkconfig mysqld on echo /usr/local/sbin/amportal start >> /etc/rc.local
Reboot now!
Before using FreePBX, you have to visit the configuration page at: http://IP.of.PBX
Click “Apply Configuration Changes”
Reboot again
Function | Username | Password | Comment |
---|---|---|---|
FreePBX | admin | admin | |
Voicemail & Recordings (ARI) | <none> | <none> | Use the FreePBX admin console to enable |
The FreePBX administration console: http://IP.of.PBX
FreePBX → Settings → Advanced System Setup →
Save each change and click Apply Configuration.
Verify that the username and password in /etc/asterisk/manager.conf and /etc/amportal.conf match.
http://www.freepbx.org/support/documentation/faq/changing-the-asterisk-manager-password
If you see an error during FreePBX installation like:
Checking for PEAR DB..FAILED
try:
pear install DB
then re-run:
./install_amp
If you enable remote access to your PBX, secure it!
NAT is a real hurdle for SIP. The best way to deal with NAT issues is to not use NAT if at all possible. NAT on both ends may not be worth attempting if using SIP, it's just not a NAT-friendly protocol like IAX.
Using phones with IAX protocol support is a good alternative if the PBX is behind NAT.
IAX protocol is pretty much Asterisk-specific.
If your PBX is behind NAT, forward the single UDP port 4569 from your NAT firewall in to the PBX.
http://www.freepbx.org/support/documentation/howtos/howto-setup-a-remote-sip-extension
If your PBX is behind NAT and you'd still like to try getting remote SIP extensions to work:
vim /etc/asterisk/sip_nat.conf localnet=192.168.1.0/255.255.255.0 #your local network externhost=your.fqdn.hostname #your resolvable host name fromdomain=your.fqdn.domain.name #your domain mane nat=yes qualify=yes externrefresh=10 canreinvite=no asterisk -rx reload #reload Asterisk configuration
This should be the default:
vim -c 457 /etc/php.ini
memory_limit = 128M
amportal stop rm -f /etc/asterisk/{sip_notify.conf,iax.conf,logger.conf,features.conf,sip.conf,extensions.conf,ccss.conf,chan_dahdi.conf} /usr/sbin/safe_asterisk cd /usr/src/freepbx-2.10.0 ./install_amp
Visit the configuration page at: http://IP.of.PBX
Click “Apply Settings”
Reboot