How to install Asterisk 1.4 from RPM and FreePBX 2.7 on Centos OS 5
This is a very detailed comprehensive step by step tutorial on how to install Asterisk 1.4 from the digium website rpm repository followed by installing FreePBX 2.7 version on CentOS 5.
[toc maxlevel:5]
Note
Passwords to Remember
AsteriskUser Password : password
MySQL Password : passw0rd
AMI Password : amp111
FoP Password : passw0rd
ARI Password : password
MySQL Password : passw0rd
AMI Password : amp111
FoP Password : passw0rd
ARI Password : password
Installing CentOS 5.5
Install CentOS 5.5 and select Server install.
Disable both Firewall and SELinux by either running "system-config-securitylevel" or "setup"
Set the hostname of the machine
yum -y install ntp
Run the following command to sync up with the time server
ntpdate -u 0.pool.ntp.org
and these to setup the time sync and start NTP service
echo 0.pool.ntp.org > /etc/ntp/step-tickers chkconfig ntpd on service ntpd start
Change the hostname and assign a static ip if required. if you change the hostname, make sure you add the FQDN name in /etc/hosts in front of localhost.localdomain. Also make sure the entries in /etc/sysconfig/network for hostname is correct and /etc/sysconfig/network-scripts/ifcfg-eth0 has static IP. Do a "service network restart" if required.
Installing Asterisk 1.4 from RPM
Install asterisk and asterisk-addons:
Create /etc/yum.repos.d/CentOS-Asterisk.repo with contents
[asterisk-tested] name=CentOS-$releasever - Asterisk - Tested baseurl=http://packages.asterisk.org/centos/$releasever/tested/$basearch/ enabled=0 gpgcheck=0 #gpgkey=http://packages.asterisk.org/RPM-GPG-KEY-Digium [asterisk-current] name=CentOS-$releasever - Asterisk - Current baseurl=http://packages.asterisk.org/centos/$releasever/current/$basearch/ enabled=1 gpgcheck=0 #gpgkey=http://packages.asterisk.org/RPM-GPG-KEY-Digium
Create /etc/yum.repos.d/CentOS-Digium.repo with contents
[digium-tested] name=CentOS-$releasever - Digium - Tested baseurl=http://packages.digium.com/centos/$releasever/tested/$basearch/ enabled=0 gpgcheck=0 #gpgkey=http://packages.digium.com/RPM-GPG-KEY-Digium [digium-current] name=CentOS-$releasever - Digium - Current baseurl=http://packages.digium.com/centos/$releasever/current/$basearch/ enabled=1 gpgcheck=0 #gpgkey=http://packages.digium.com/RPM-GPG-KEY-Digium
Install Asterisk from RPM
yum -y install asterisk14 mysql-server yum -y install asterisk14-configs asterisk14-addons asterisk14-addons-mysql dahdi-tools
Note: If you get the error while running any of the above commands
warning: user asterisk does not exist - using root warning: group asterisk does not exist - using root
Run the Command below to fix permission issues on /var/lib/asterisk/sounds directory
chown -R asterisk:asterisk /var/lib/asterisk/sounds/
Install asterisk-sounds-moh from RPM. Make sure you do this before installing FreePBX. If not, freepbx install will have errors on missing /var/lib/asterisk/moh directory
yum -y install asterisk-sounds-moh-opsound-alaw.noarch yum -y install asterisk-sounds-moh-opsound-ulaw.noarch yum -y install asterisk-sounds-moh-opsound-wav.noarch
Install asterisk-sounds-extra. If not, conference bridge won't work. it won't play any message when dialed into conference extension.
yum -y install asterisk-sounds-extra-en-alaw.noarch yum -y install asterisk-sounds-extra-en-ulaw.noarch yum -y install asterisk-sounds-extra-en-gsm.noarch
Reboot the machine
Reboot the machine now. During one of the yum install commnds, i will update the kernel and will install the new dahdi. dahdi won't start because it needs to boot up with new kernel. Reboot will take care of it. If dahdi wont' start, conference won't work.
Installing FreePBX 2.7
Install the required packages
yum -y install libogg libogg-devel libxml2-devel libtiff-devel php-pear php-pear-DB php-gd php-mysql php-pdo kernel-devel audiofile-devel libogg-devel perl-DateManip sendmail-cf
Install lame rpm
cd /downloads wget http://dag.wieers.com/rpm/packages/lame/lame-3.97-1.el5.rf.i386.rpm rpm -ivh lame-3.97-1.el5.rf.i386.rpm
Install DenyHosts rpm
cd /downloads wget ftp://fr2.rpmfind.net/linux/epel/5/i386/denyhosts-2.6-5.el5.noarch.rpm rpm -ivh denyhosts-2.6-5.el5.noarch.rpm
Download FreePBX 2.7.0
cd /downloads wget http://mirror.freepbx.org/freepbx-2.7.0.tar.gz tar zxvf freepbx-2.7.0.tar.gz cd freepbx-2.7.0
Configure Apache
Edit /etc/httpd/conf/httpd.conf and change the following:
Change "User apache" to "User asterisk" Change "Group apache" to "Group asterisk"
On Line 327, change "AllowOverride None" to "AllowOverride All" (for directory /var/www/html).
This is a good time to change httpd.conf to Name Based virtual hosting with a separate
DocumentRoot directory for freepbx.
This is a good time to change httpd.conf to Name Based virtual hosting with a separate
DocumentRoot directory for freepbx.
Configure mysql
service mysqld start mysqladmin create asterisk mysqladmin create asteriskcdrdb cd /downloads/freepbx-2.7.0 mysql asterisk < SQL/newinstall.sql mysql asteriskcdrdb < SQL/cdr_mysql_table.sql
mysql //To go into the mysql interface At the mysql prompt enter the following commands: GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'password'; flush privileges; exit; mysqladmin -u root password 'rootpassword' //to change mysql root password
Changing Permissions
Changing permissions to avoid PHP errors: If you don't do this, freepbx web interface will cause PHP errors in the httpd.log file. In my case, the voicemail portal was logging out whenever i try to select an option after loggin in. Also had issue with the admin interface when AUTHTYPE=database. After you logout of the admin interface, it logs you in without entering a password.
chown -R asterisk:asterisk /var/run/asterisk chown -R asterisk:asterisk /var/log/asterisk chown -R asterisk:asterisk /var/lib/php/session chown -R asterisk:asterisk /var/lib/asterisk chown -R asterisk:asterisk /etc/asterisk chown -R asterisk:asterisk /var/www/html
Start Asterisk and run FreePBX Install Script
asterisk cd /downloads/freepbx-2.7.0 ./install_amp --username=asteriskuser --password=password
Answer the questions. sample session is included below. You can hit enter to accept the defaults for most of them.
change only password, IP and the install directory if using a different directory for
Note: If you have to change the local IP address to something else after you run ./install_amp, you'll have to edit /etc/amportal.conf and change the value of AMPWEBADDRESS value to the new IP or hostname. If not, when you click on Flash operator panel in the main freepbx website, it will redirect to the IP address that it's current set to for AMPWEBADDRESS in /etc/amportal.conf
Sample session of install_amp:
[root@golden freepbx-2.7.0]# ./install_amp --username=asteriskuser --password=Hitmenow36 Checking for PEAR DB..OK Checking for PEAR Console::Getopt..OK Using username: asteriskuser Using password: ********** Checking user..OK Checking if Asterisk is running..running with PID: 29689..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: [asteriskuser] Enter your PASSWORD to connect to the 'asterisk' database: [Hitmenow36] 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: [amp111] password Enter the path to use for your AMP web root: [/var/www/html] /var/www/html/<NEW_INSTALL_DIR_IF_REQUIRED Enter the IP ADDRESS or hostname used to access the AMP web-admin: [xx.xx.xx.xx] 192.168.X.XX Enter a PASSWORD to perform call transfers with the Flash Operator Panel: [passw0rd] password 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/local/sbin] /etc/amportal.conf writtenAssuming new install, --install-moh added to command line OK
Start amportal automatically and disable FOP
To disable FOP set the following variables in /etc/amportal.conf
FOPRUN=false FOPDISABLE=true
To start amportal automatically
echo "/usr/local/sbin/amportal start" >> /etc/rc.local
Change ARI_ADMIN_PASSWORD
vi /var/www/html/recordings/includes/main.conf.php and change the $ARI_ADMIN_PASSWORD to your password "password".
/etc/php.ini limits
Increase some php limits in /etc/php.in as follows for freepbx
max_execution_time = 60 ; Maximum execution time of each script, in seconds max_input_time = 120 ; Maximum amount of time each script may spend parsing request data memory_limit = 128M ; Maximum amount of memory a script may consume
Start services and Setup Firewall
amportal restart chkconfig httpd on chkconfig mysqld on chkconfig denyhosts on service httpd start service mysqld start service denyhosts start amportal stop_fop #FOP uses a lot of CPU power and is not required. so stop the service
To setup the firewall run "system-config-securitylevel" and set
- http
- https
- 5060:udp
- 10000-20000:udp
Generate freepbx/asterisk config files
NOTE: DO NOT APPLY CHANGES without upgrading the modules
Install additional modules
- Announcements
- Backup & Restore
- Call Forward
- Call Waiting
- Conferences
- Day Night Mode
- Do-Not-Disturb (DND)
- Fax Configuration
- Follow Me
- FreePBX ARI Framework
- Asterisk IAX Settings
- IVR
- Misc Applications
- Misc Destinations
- Paging and Intercom
- Phonebook Directory
- Phonebook
- Print Extensions
- Queues
- Bulk Phone Restart
- Ring Groups
- Asterisk SIP Settings
- Time Conditions
- Weak Password Detection
Only after upgrading modules hit Apply changes.
NAT configuration
vi /etc/asterisk/sip_custom.conf and add the following:
nat=yes externip = <xx.xx.xx.xx> ;your external IP address localnet=192.168.0.0/255.255.0.0 ;your local subnet disallow=all allow=gsm allow=ulaw allow=alaw
vi /etc/asterisk/iax_custom.conf and add the following: disallow=all allow=gsm allow=ulaw allow=alaw
Loading chan_sip.so
When you connect to asterisk using asterisk -r and type "sip show peers", it says no such command found. In order to fix this type "module load chan_sip.so" at the asterisk CLI prompt. This should fix it
Reboot
Reboot the machine now. During one of the yum install commnds, i will update the kernel and will install the new dahdi. dahdi won't start because it needs to boot up with new kernel. Reboot will take care of it. If dahdi wont' start, conference won't work.
Troubleshooting
When selecting # from the main IVR to access Company directory, if the user does not enter any input when prompted to enter the first 3 letters of the person, it still treats it as an entry and will ask to confirm the extension. To fix this, edit /etc/asterisk/vocemail.conf and in the [default] section comment the example 1234 line. This is the wrong format. This should have extra commas.
After selecting # from the main IVR to access Company Directory, user is prompted to enter the first 3 letters of the person's name. When user enters the first 3 letters of the person's name, it reads back the full name of the person and asks user whether this is the person they are trying to reach. If the user doesn't enter a confirmation, it keeps looping back continuously. In order for the system to hang up the call after 2 loops when user doesn't enter a confirmation, edit /var/lib/asterisk/agi-bin/directory and search for "!==". There will be two entries. Change these to "!=" instead.
Conference extension is not working. Create a conference extension and dial from internal extension. It simply hangs up. Install asterisk-sounds-extra from yum repo, see steps above.
From the Grandsteam ATA HT503, you cannot dial to voicemail by dialing *98. It gives busy tone. Fix this in the HT503 admin panel, in the FXS port section, Dial Plan: replace {x+} with {*xx|x+}. Now voicemail access should work.
Notes on FreePBX 2.8
Issue1
When installing new freepbx 2.8 and when executing the following:
sudo ./install_amp --username=asteriskuser --password=secret
sudo ./install_amp --username=asteriskuser --password=secret
You get the following error
Upgrading to 2.8.0alpha2.. -> Running PHP script /usr/src/freepbx-2.8.0/upgrades/2.8.0alpha2/tables.php PHP Fatal error: Cannot redeclare __parse_DialRulesFile() (previously declared in /usr/src/freepbx-2.8.0/upgrades/2.6.0beta1/tables.php:87) in /usr/src/freepbx-2.8.0/upgrades/2.8.0alpha2/tables.php on line 239Removing "__parse_DialRulesFile()" (line 207-239) function from "2.8.0alpha2/tables.php" fixes the installation issue.
Ref: http://www.freepbx.org/forum/freepbx/installation/new-2-8-installation-issue-on-ubuntu-10-04-lucid
Issue2
FreePBX is picky on the password. The following special characters (tested) are not allowed in any FreePBX related password.
- $
- !
No comments:
Post a Comment