Error Trying To Install Freepbx 2.2.1 and Asterisk 1.2.15

I am trying to install Freepbx 2.2.1 on Centos 4.4 using Asterisk 1.2.15. Ive followed the documentation but i am getting errors during the installation Process . Here is a copy of my install :-

[[email protected] ~]# cd /usr/src/freepbx-2.2.1
[[email protected] freepbx-2.2.1]# ./install_amp
Checking for PEAR DB…OK
Checking for PEAR Console::Getopt…OK
Checking user…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:
[amp109] DB Password is Here
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]
Enter the path to use for your AMP web root:
[/var/www/html]

Enter the IP ADDRESS or hostname used to access the AMP web-admin:
[xx.xx.xx.xx] 192.168.32.222
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:
[passw0rd]
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]

Enter directory in which to store super-user scripts:
[/usr/sbin]

/etc/amportal.conf writtenAssuming new install, --install-moh added to command line
OK
Reading /etc/amportal.conf…OK
Checking for /etc/asterisk/asterisk.conf…OK
Reading /etc/asterisk/asterisk.conf…OK
Using asterisk as PBX Engine
Checking for Asterisk 1.2…OK
Checking for selinux…OK
Connecting to database…OK
Checking current version of AMP…2.2.1
Installing new AMP files…OK
Configuring install for your environment…OK
Setting permissions on files…OK
Checking for upgrades…0 found
Generating AMP configs…
Generating Configurations.conf…
Content-type: text/html
X-Powered-By: PHP/4.3.9

Checking for PEAR DB…OK
Checking for PEAR Console::Getopt…OK
Running module install.php and install.sql scripts
Checking for /etc/amportal.conf…OK
Reading /etc/amportal.conf…PHP Warning: file(/etc/amportal.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/retrieve_conf on line 41
PHP Warning: Invalid argument supplied for foreach() in /var/lib/asterisk/bin/retrieve_conf on line 42
OK
Reading /etc/asterisk/asterisk.conf…OK
Connecting to database…PHP Notice: Undefined index: AMPDBUSER in /var/lib/asterisk/bin/retrieve_conf on line 199
PHP Notice: Undefined index: AMPDBPASS in /var/lib/asterisk/bin/retrieve_conf on line 200
PHP Notice: Undefined index: AMPDBHOST in /var/lib/asterisk/bin/retrieve_conf on line 201
FAILED
[FATAL] Cannot connect to database
Generating AMP configs…OK
Restarting Flash Operator Panel…op_server.pl: no process killed
OK
Please update your modules and reload Asterisk by visiting http://192.168.32.222/admin


  • Note: It’s possible that if you click the red ‘Update Now’ bar BEFORE *
  • updating your modules, your machine will start dropping calls. Ensure *
  • that all modules are up to date BEFORE YOU CLICK THE RED BAR. As long *
  • as this is observed, your machine will be fully functional whilst the *
  • upgrade is in progress. *

When i try to browse to the Freepbx GUI i can see teh front Page but when i click on admin i get :-

Missing or unreadable config file (/etc/amportal.conf)…cannot continue

My file is below :-

This file contains settings for components of the Asterisk Management Portal

Spaces are not allowed!

Run /usr/src/AMP/apply_conf.sh after making changes to this file

AMPDBHOST: the host to connect to the database named ‘asterisk’

AMPDBHOST=localhost

AMPDBUSER: the user to connect to the database named ‘asterisk’

AMPDBUSER=asteriskuser

AMPDBENGINE: the type of database to use

AMPDBENGINE=mysql

AMPDBPASS: the password for AMPDBUSER

AMPDBPASS=jtsadmin2369

AMPENGINE: the telephony backend engine to use

AMPENGINE=asterisk

AMPMGRUSER: the user to access the Asterisk manager interface

AMPMGRUSER=admin

AMPMGRPASS: the password for AMPMGRUSER

AMPMGRPASS=amp111

AMPBIN: where command line scripts live

AMPBIN=/var/lib/asterisk/bin

#AMPSBIN: where (root) command line scripts live
AMPSBIN=/usr/sbin

AMPWEBROOT: the path to Apache’s webroot (leave off trailing slash)

AMPWEBROOT=/var/www/html

AMPCGIBIN: the path to Apache’s cgi-bin dir (leave off trailing slash)

AMPCGIBIN=/var/www/cgi-bin

AMPWEBADDRESS: the IP address or host name used to access the AMP web admin

#AMPWEBADDRESS=192.168.1.101
AMPWEBADDRESS=192.168.32.222

FOPWEBROOT:web root for the Flash Operator Panel

FOPWEBROOT=/var/www/html/panel

FOPPASSWORD: the secret code for performing transfers and hangups in the Flash Operator Panel

FOPPASSWORD=passw0rd

FOPSORT: FOP should sort extensions by Last Name [lastname] or by Extension [extension]

FOPSORT=extension

AUTHTYPE: authentication type to use for web admin

If type set to ‘database’, the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above

valid: none, database

AUTHTYPE=database

AMPADMINLOGO: Defines the logo that is to be displayed at the TOP LEFT of the admin screen.

This enables you to customize the look of the administration screen.

NOTE: images need to be saved in the …/admin/images directory of your AMP install

This image should be 55px in height

AMPADMINLOGO=freepbx.png

AMPFOOTERLOGO: Defines the logo that is to be displayed at the BOTTOM RIGHT of the admin screen.

This enables you to customize the look of the administration screen.

NOTE: images need to be saved in the …/admin/images directory of your AMP install

This image should be 40px in height

AMPFOOTERLOGO=blank.gif

AMPADMINHREF: Defines the where a user is taken if they click on the footer logo

This enables you to customize the look of the administration screen.

AMPADMINHREF=www.freepbx.org

USECATEGORIES: Controls if the menu items in the admin interface are sorted by category (true),

or sorted alphebetically with no categories shown (false). Defaults to true.

#USECATEGORIES=false

AMPEXTENSIONS: the type of view for extensions admin

If set to ‘deviceanduser’ Devices and Users will be administered seperately, and Users will be able to “login” to devices.

If set to ‘extensions’ Devices and Users will me administered in a single screen.

AMPEXTENSIONS=extensions

POST_RELOAD: automatically execute a script after applying changes in the AMP admin

Set POST_RELOAD to the script you wish to execute after applying changes

If POST_RELOAD_DEBUG=true, you will see the output of the script in the web page

POST_RELOAD=

POST_RELOAD_DEBUG=false

ENABLECW: Enable call waiting by default when an extension is created

Set to ‘yes’ it automatically creates the ‘CW’ key to enable call waiting, not

requiring the user to dial *70 when their phone is first commissioned

ENABLECW=yes

The following are used to optionally have the freepbx backup program optionally

send the generated backup to an ftp server

FTPBACKUP=YES to enable

FTPUSER, FTPPASSWORD, FTPSERVER must be set

FTPSUBDIR is an optional subdirectory at the ftp server, it will cause ftp to do a cd

There is no error checking so you should check to make sure these are set correctly. The

ftp is saved after the backup, so it will not cause the local backup file to be effected

FTPBACKUP=yes

#FTPUSER=asterisk
#FTPPASSWORD=password
#FTPSUBDIR=mybackupfolder
#FTPSERVER=myftpserver

AMPMODULEXML lets you change the module repository that you use. By default, it

should be set to http://mirror.freepbx.org/ - Presently, there are no third

party module repositories.

AMPMODULEXML=http://mirror.freepbx.org/

AMPMODULESVN is the prefix that is appended to tags in the XML file.

This should be set to http://mirror.freepbx.org/modules/

AMPMODULESVN=http://mirror.freepbx.org/modules/

AMPMODULEMSG is URL used to search for warnings or messages in the online repository

and should not be changed.

AMPMODULEMSG=http://mirror.freepbx.org/

AMPDBNAME=asterisk
ASTETCDIR=/etc/asterisk
ASTMODDIR=/usr/lib/asterisk/modules
ASTVARLIBDIR=/var/lib/asterisk
ASTAGIDIR=/var/lib/asterisk/agi-bin
ASTSPOOLDIR=/var/spool/asterisk
ASTRUNDIR=/var/run/asterisk
ASTLOGDIR=/var/log/asterisk

Regards,
Daniel.

I just had this problem with FreePBX v2.2.1 as well.

I had to changed permissions for /etc/amportal.conf using this line:
chmod 775 /etc/amportal.conf

Are you sure you installed all required modules? Cut and paste this into a linux command line:

yum install gcc libxml2-devel libtiff-devel mysql-server php-gd php-mysql kernel-devel bison ncurses-devel audiofile-devel subversion libogg-devel openssl-devel tftp-server php-mbstring ntp

Also, did you set up your sql databases correctly?

Create user and set permissions
Unfortunately, issues in Asterisk 1.2 require us to run the web server process as the same user as asterisk. In this situation, it’s easier for us to run httpd as ‘asterisk’, rather than asterisk as ‘httpd’, as there’s far less configuration that needs to be done.

cd /usr/src

useradd -c “Asterisk PBX” -d /var/lib/asterisk asterisk
chown asterisk /var/lib/php/session/

You need to change User apache and Group apache to User asterisk and Group asterisk.

nano +227 /etc/httpd/conf/httpd.conf (Push Control-X to save when you’ve finished)

You also want to change AllowOverride None to AllowOverride All

nano +311 /etc/httpd/conf/httpd.conf

(Ctrl-X>y>ENTER)

Set up MySQL
Before you can do anything to MySQL, you need to make sure it’s running:

/etc/init.d/mysqld start
Initializing MySQL database: [ OK ]
Starting MySQL: [ OK ]

Now, to configure the databases for freePBX:

cd /usr/src/freepbx-2.1.3
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql

They also need to be secured, so that not just anyone can access them. freePBX will prompt you for a database password when you do the install. You need to pick that now. We’ll assume that you’ve picked ‘asteriskuser’ and ‘amp109’ - you probably shouldn’t use these, as they are well known passwords for [email protected] builds. If anyone’s trying to attack your machine, they will try this.

mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8 to server version: 4.1.16

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO [email protected] IDENTIFIED BY ‘amp109’;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON asterisk.* TO [email protected] IDENTIFIED BY ‘amp109’;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye
[[email protected] freepbx-2.1.3]

Now, after all of this, you need to pick a root ‘mysql’ password. We’ll make it ‘abcdef’. If you need to do anything else with mysql, you’ll need to provide this password.

mysqladmin -u root password ‘abcdef’

Build the cdr_mysql module for Asterisk (Yep, more compiling!)
cd /usr/src/asterisk-addons-1.2.5
cp Makefile Makefile.orig
sed -i ‘s/SOURCE/SOURCE -DMYSQL_LOGUNIQUEID/’ Makefile
make && make install