Showing posts with label FreePBX. Show all posts
Showing posts with label FreePBX. Show all posts

Tuesday, 15 January 2013

FreePBX on Debian



UPDATE:Try this to fix the problems with mysql permissions.  This was suggested by someone else.  I have not tried it myself.  "The 'astrundir' must be changed to  /var/run/asterisk before installing FreePBX. Otherwise, the owner for /var/run/mysqld will be changed to asterisk and that causes mysqld to fail starting. Or you can just change permission of /var/run/mysqld to 777"
I have updated the how-to build asterisk with freepbx on debian sarge with a minimal install that was originally located atsquishychicken.com.
The total install is around 500MB (after deb archives are removed of course :)  )... enjoy.  Please let me know if there are any glaring errors that I have over looked.
Just a quick note before we get started.... there are a couple of things that I assume here.  One is that you are familiar with your shell.  Be sure that you don't just blindly cut and paste this into a window... look at the command and think about what they are doing.  When you see cat > /some/file <<EOF  make sure you cut to the next EOF...
 YMMV and use at your own risk.
 #Install barebones Debian Sarge using the "linux26" command from the initial boot screen.
 boot:linux26
# update all packages and make sure we are current
 apt-get update
apt-get upgrade
 # install and configure etherconf for static IP
# specify the hostname and assign a static ip for later
 apt-get install etherconf
#install sshd so that you can do the rest of the install remotely without the need for a mouse/kb/monitor.  It is also handy for doing the cut and paste thing which Windows users know and love.
apt-get install ssh
# get needed software and dependencies
apt-get install vim libasound2 libgsm1 libltdl3 libpq3 libspeex1 libsqlite0 libtonezone1 odbcinst1 unixodbc openssl libssl0.9.7 libssl-dev libreadline4 libreadline4-dev libeditline0 libeditline-dev libedit-dev libedit2 libncurses5 libncurses5-dev zlib1g-dev bison libnet-telnet-perl mime-construct libipc-signal-perl libmime-types-perl libproc-waitstat-perl subversion libipc-signal-perl libproc-waitstat-perl apache2 mysql-server php4 php4-cli php4-mysql php4-pear libapache2-mod-php4 php4-curl libmysqlclient14-dev libmysqlclient14 php4-gd make gcc g++ fxload
# don't forget the kernel headers
apt-get install kernel-headers-`uname -r`
# get the latest asterisk  from cvs
cd /usr/src
svn checkout http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2
svn checkout http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2
svn checkout http://svn.digium.com/svn/libpri/branches/1.2 libpri-1.2
svn checkout http://svn.digium.com/svn/asterisk-addons/branches/1.2 asterisk-addons-1.2
svn checkout http://svn.digium.com/svn/asterisk-sounds/trunk asterisk-sounds
# build zaptel drivers for 2.6 kernel
cd zaptel-1.2
make clean; make linux26; make install
# if you need pri support
cd ../libpri-1.2
make clean; make install
#NOTE: In asterisk 1.2.x and above you no longer need the mpg123 player so the installation procedure has been removed from this document.  You DO need to install the asterisk-addons package in order to use the built in MOH.
cd ../asterisk-1.2
make clean; make install
# build asterisk addons with mysql patch to makefile
cd ../asterisk-addons-1.2
perl -p -i.bak -e 's/CFLAGS.*D_GNU_SOURCE/CFLAGS+=-D_GNU_SOURCE\nCFLAGS+=-DMYSQL_LOGUNIQUEID/' Makefile
make clean; make install
# build asterisk-sounds
cd ../asterisk-sounds
make clean; make install
# install lame for mp3 resample
cd /usr/src
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.96.1.tar.gz
tar -xvzf lame-3.96.1.tar.gz
cd lame-3.96.1
./configure --prefix=/usr --sysconfdir=/etc
make && make install
# use xorcoms handy zaptel toolset
cd /usr/src
wget http://rapid.sunsite.dk/rapid/pool/main/z/zaptel/zaptel_1.2.5-3_i386.deb
dpkg -i zaptel_1.2.5-3_i386.deb
# If it asks you whether to keep the existing package or install the new one 
go with the default by hitting 'ENTER' or typing 'N'
# auto detect zaptel hardware
genzaptelconf -ds
# install asterisk perl
cd /usr/src
wget http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz
tar zxf asterisk-perl-0.08.tar.gz
cd asterisk-perl-0.08
perl Makefile.PL
make install
# get freepbx
cd /usr/src
wget http://ufpr.dl.sourceforge.net/sourceforge/amportal/freepbx-2.1.1.tar.gz
tar -xvzf freepbx-2.1.1.tar.gz
cd freepbx-2.1.1

# create the databases and tables
mysqladmin create asteriskcdrdb
mysql asteriskcdrdb < /usr/src/freepbx-2.1.1/SQL/cdr_mysql_table.sql
mysqladmin create asterisk
mysql asterisk < /usr/src/freepbx-2.1.1/SQL/newinstall.sql
#grant access to asterisk user.  The usernames and passwords here MUST be the same as those configured during the freepbx install.  Freepbx defaults (username 'asteriskuser' and password 'amp109') are used here.  If you change them here you MUST also change them to the same during the freepbx install.
 echo "GRANT ALL ON  asterisk.* to asteriskuser@localhost identified by 'amp109'" | mysql
 echo "GRANT ALL ON  asteriskcdrdb.* to asteriskuser@localhost identified by 'amp109'" | mysql
 # add the asterisk user and group
 groupadd asterisk
useradd -g asterisk -d /var/lib/asterisk -s /bin/bash asterisk
# make the directory for the virtual host and for recordings.
mkdir -p /var/www/`uname -n`/cgi-bin
mkdir -p /var/www/`uname -n`/htdocs
mkdir -p /var/lib/asterisk/sounds/custom
# build the default zapata.conf
 cat > /etc/asterisk/zapata.conf << EOF
[channels]
language=en
language=en
context=from-pstn
signalling=fxs_ks
rxwink=300              ; Atlas seems to use long (250ms) winks
;
; Whether or not to do distinctive ring detection on FXO lines
;
;usedistinctiveringdetection=yes

usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
echotraining=800
rxgain=0.0
txgain=0.0
group=0
callgroup=1
pickupgroup=1
immediate=no
;faxdetect=both
relaxdtmf=yes
faxdetect=incoming
;faxdetect=outgoing
;faxdetect=no

; include zap extensions defined in AMP
#include zapata_additional.conf
#include zapata-channels.conf
EOF
# don't forget the run directory
mkdir /var/run/asterisk
# Now install freepbx.  During this install, it will ask for changes to the defaults.  If you hit ENTER the default will be used.  You MUST pay close attention to these defaults as they need to be changed to the defaults used earlier and in the next step after this one.  There is nothing preventing you from using different usernames, passwords, and directories as long as they are the same in the freepbx setup as they are through out the rest of this document which I have/will point out.
uname -n
#Change the defaults during the install to the following.  Substitute "uname -n" to whatever was returned when you typed in "uname -n" above:
#Enter the path to use for your AMP web root:[/var/www/"uname -n"/htdocs]
#Enter the path to use for your FOP web root:[/var/www/"uname -n"/htdocs/panel]
#Enter the path to your Apache cgi-bin:[/var/www/"uname -n"/cgi-bin]
#Enter the IP ADDRESS or hostname used to access the AMP web-admin:[xx.xx.xx.xx] The IP Address of your #Asterisk Machine

cd /usr/src/freepbx-2.1.1
./install_amp
# create the virtual host file with good defaults.  These original defaults MUST have been changed manually during the automated freepbx install above.
cat > /etc/apache2/sites-available/pbx.conf << EOF

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName `uname -n`
DocumentRoot /var/www/`uname -n`/htdocs
<Directory />

Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/`uname -n`/htdocs>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

</Directory>
ScriptAlias /cgi-bin/ /var/www/`uname -n`
<Directory "/var/www/`uname -n`/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

</VirtualHost>
EOF
# make apache run as user asterisk and enable the virtual host
ln -s /etc/apache2/sites-available/pbx.conf  /etc/apache2/sites-enabled
perl -p -i.bak -e 's/User www-data/User asterisk/' /etc/apache2/apache2.conf
perl -p -i.bak -e 's/Group www-data/Group asterisk/' /etc/apache2/apache2.conf
# make tweeks for php to allow for file uploads
perl -p -i.bak -e 's/upload_max_filesize.*$/upload_max_filesize = 20M/' /etc/php4/apache2/php.ini
perl -p -i.bak -e 's#AddType application/x-httpd-php-source .phps#AddType application/x-httpd-php-source .phps\nLimitRequestBody 20000000#' /etc/apache2/mods-available/php4.conf
# restart to get changes
/etc/init.d/apache2 restart
# change the security to database authentication.  The username and password must be the same as those used during the freepbx install earlier in this document.  The freepbx defaults (username=admin, password=amp111) are used
perl -p -i.bak -e 's/AUTHTYPE=none/AUTHTYPE=database/' /etc/amportal.conf
echo "insert into ampusers values ('admin','amp111','','','','*');" | mysql asterisk
# You will probably get an error/warning here.  Something about "duplicate entry 'admin' for  key 1".  Just ignore it.
# install astmanproxy for astapi dialing
cd /usr/src/
svn checkout http://svncommunity.digium.com/svn/astmanproxy/tags/1.20
cd 1.20
make && make install
# modify /etc/asterisk/astmanproxy.conf and assign username/password
eg: host = localhost, 5038, proxy, 1234, on
# modify /etc/asterisk/manager_custom.conf to add the following
[proxy]
secret = 1234
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.255
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

[astapi]
secret = 1234
deny=0.0.0.0/0.0.0.0
permit=10.0.0.0/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
# build an rc.local startup script
echo '#!/bin/bash' > /etc/init.d/local
chmod +x /etc/init.d/local
update-rc.d local defaults 80
echo '/usr/local/sbin/astmanproxy' >> /etc/init.d/local
# change the user that astmanproxy runs as
perl -p -i -e 's/proc_user.*$/proc_user = asterisk/' /etc/asterisk/astmanproxy.conf
perl -p -i -e 's/proc_group.*$/proc_group = asterisk/' /etc/asterisk/astmanproxy.conf
# change permissions and start amp
amportal chown
amportal start
#If you don't have a zaptel card
modprobe ztdummy
#build a freepbx automatic start and stop script as last to start and first to stop.  I know there is a way to do it with just one script but I haven't figured out how to modify the "skeleton" file included in init.d yet.
echo '#!/bin/bash' > /etc/init.d/amportal-start
chmod +x /etc/init.d/amportal-start
update-rc.d amportal-start start 99 2 3 4 5 .
# Add this line if you do NOT have a zaptel card
echo 'modprobe ztdummy' >> /etc/init.d/amportal-start
# Now complete the start script and add the stop script
echo '/usr/sbin/amportal start' >> /etc/init.d/amportal-start
echo '#!/bin/bash' > /etc/init.d/amportal-stop
chmod +x /etc/init.d/amportal-stop
update-rc.d amportal-stop stop 10 0 1 6 .
echo '/usr/sbin/amportal stop' >> /etc/init.d/amportal-stop

FreePBX on Ubuntu

Originally written for Ubuntu 6.  Should work on newer versions.
In this document there are various boxes, with text inside them.
These are examples of what you see on your screen, what you should
type, and/or the expected responses. For example:
rob@rob-laptop:~$ id
uid=1000(rob) gid=1000(rob)
groups=4(adm),20(dialout),24(cdrom),25(floppy),
29(audio),30(dip),44(video),46(plugdev),
106(lpadmin),110(scanner),112(admin),1000(rob)
In that situation, you would type 'id' and the response would be
similar to the response indicated. If you see an error, that probably
means you've typed something incorrectly, but it could also suggest
other problems. Read the error carefully, and if you don't know how to
fix it, feel free to post to the forums or ask on IRC.
Operating System Installation
Installation of Ubuntu is out of the scope of this document.. As a
reference point this document was written with accepting the defaults
for everything suggested in the installer..
Post Installation Configuration
After your machine has rebooted and you've logged in, you need to
switch to the 'root' account. Whilst installing you were prompted for a
password, which is what you must enter when prompted below:
rob@rob-laptop:~$ sudo su -
Password: Enter Password Here
root@rob-laptop:~#
This gives you full control of the system. It's the equivlent of typing 'sudo' before every command.
You now need to ensure that your machine is able to access the
internet, and once that is working you can proceed with the
installation Usually being able to browse the internet with Firefox is
a good indication that you won't be having any problems.
Check for updates and install required packages
Before running apt-get, you must edit the sources.list file so that you can install from the "universe".
nano +17 -w /etc/apt/sources.list
Remove the # signs from this line and add multiverse at the end:
deb http://us.archive.ubuntu.com/ubuntu/ dapper universe multiverse
Multiverse gives you access to a lot more packages then the standard repository does, useful for future reference.
Unless you've added extra repositories, your sources.list should look something like:
deb http://archive.ubuntu.com/ubuntu/ dapper main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ dapper-security main restricted universe multiverse
In addition to this, you must update apt's package lists"
apt-get update
You need to ensure that your machine is up to date with the current
security packages release by Ubuntu. After doing so, an apt-get of the
modules below will install all the requirements for freePBX
root@rob-laptop:~# apt-get install
php5 php5-cli php5-mysql mysql-server php-pear php-db openssh-server
curl sox apache2 subversion build-essential libncurses5-dev libssl-dev
linux-headers-`uname -r` libmysqlclient15-dev
... Please copy-and-paste that line, rather than trying to type it in.
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
apache-common apache2-common apache2-mpm-prefork apache2-utils
... Several more lines of automatically imported packages ...
mysql-server-5.0 openssh-server php-db php-http php-mail php-net-smtp
php-net-socket php-pear php-xml-parser php4 php4-cli php4-common php4-mysql
php4-pear php5-common sox ssl-cert zlib1g-dev
0 upgraded, 39 newly installed, 0 to remove and 6 not upgraded.
Need to get 40.6MB of archives.
After unpacking 107MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://au.archive.ubuntu.com dapper/main libpcre3 6.4-1.1ubuntu4 [174kB]
Get:2 http://security.ubuntu.com dapper-security/main libapr0 2.0.55-4ubuntu2.1 [132kB]
Get:3 http://au.archive.ubuntu.com dapper/main ssl-cert 1.0.13 [9526B]
Get:4 http://au.archive.ubuntu.com dapper/main curl 7.15.1-1ubuntu2 [168kB]
... The machine now proceeds to download and install packages ...
Setting up sox (12.17.9-1) ...
root@rob-laptop:~#
Downloading and Installing Asterisk
Previous comment:
Options, if you use edgy instead of dapper, you will get the
latest version of asterisk without needing to compile etc etc etc, all
you need to do is: apt-get install asterisk and skip to the section on
MySQL... Dapper also has packaged versions of asterisk and is quite
useable also, and is a lot easier to manage then compiling and
re-compiling to upgrade all the time
Rob's Response:
Well, I tried this, (on 6.06 LTS) and got Asterisk-1.2.7.1, and
Zaptel-1.2.5. Both of these are _woefully_ out of date. Asterisk has 3
Denial-Of-Service bugs and 2 security bugs, and Zaptel doesn't have the
proper echo cancellation enabled in it. Yes. Maybe it might be easier
to type in 'apt-get install asterisk zaptel', but it'll be crap.
Compile from source, it's not that hard. To make it easier, I've put
one box at the bottom of the downloading section that you can
copy-and-paste from to install everything from source.
Downloading
We will be using subversion to download the latest version of the
1.2 branch of Asterisk, Zaptel, LibPRI and Asterisk-Addons.
asterisk-sounds will be the latest version.
root@rob-laptop:/usr/src# svn co http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2
... Lots of files are downloaded ...
root@rob-laptop:/usr/src# svn co http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2
... Zaptel files download ...
root@rob-laptop:/usr/src# svn co http://svn.digium.com/svn/libpri/branches/1.2 libpri-1.2
... LibPRI downloads - Note, this is quite small, only about 15 files. This is normal ...
root@rob-laptop:/usr/src# svn co http://svn.digium.com/svn/asterisk-addons/branches/1.2 asterisk-addons-1.2
... Asterisk-Addons downloads...
root@rob-laptop:/usr/src# svn co http://svn.digium.com/svn/asterisk/trunk/sounds asterisk-sounds
... The default Sounds package downloads now. This can be quite large ...
root@rob-laptop:/usr/src#
Compiling and Installing
You now need to compile and install the latest version of asterisk.
root@rob-laptop:/usr/src# cd libpri-1.2
root@rob-laptop:/usr/src/libpri-1.2# make install
gcc -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -c -o copy_string.o copy_string.c
gcc -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -c -o pri.o pri.c
... libpri compiles ...
install -m 644 libpri.a /usr/lib
if test $(id -u) = 0; then /sbin/ldconfig -n /usr/lib; fi
root@rob-laptop:/usr/src/libpri-1.2# cd ../zaptel-1.2
root@rob-laptop:/usr/src/zaptel-1.2# make install config
cc -I. -O4 -g -Wall -DBUILDING_TONEZONE -DSTANDALONE_ZAPATA
-DZAPTEL_CONFIG=\"/etc/zaptel.conf\" -DHOTPLUG_FIRMWARE -c -o
gendigits.o gendigits.c
cc -o gendigits gendigits.o -lm
./gendigits > tones.h
... zaptel compiles - Note that any errors here are usually
because of you not having the correct version of linux-headers'
installed ...
ZAPTELVERSION="SVN-branch-1.2-r1468" build_tools/make_version_h > version.h.tmp
if cmp -s version.h.tmp version.h ; then echo; else \
mv version.h.tmp version.h ; \
fi
... Zaptel compiles ...
root@rob-laptop:/usr/src/zaptel-1.2# cd ../asterisk-1.2
root@rob-laptop:/usr/src/asterisk-1.2# make install
if cmp -s .cleancount .lastclean ; then echo ; else \
make clean; cp -f .cleancount .lastclean;\
fi
make1: Entering directory `/usr/src/asterisk-1.2'
... Asterisk Compiles ...
root@rob-laptop:/usr/src/asterisk-1.2# cd ../asterisk-addons-1.2
root@rob-laptop:/usr/src/asterisk-addons-1.2# make install
./mkdep -fPIC -I../asterisk -D_GNU_SOURCE -I/usr/include/mysql `ls *.c`
make -C format_mp3 all
... Asterisk-Addons now install ...
root@rob-laptop:/usr/src/asterisk-addons-1.2# cd ../asterisk-sounds/
root@rob-laptop:/usr/src/asterisk-sounds# make install
... Lots of additional sound files are installed here ...
root@rob-laptop:/usr/src/asterisk-sounds#
Copy-And-Paste this, for ease of installation:
cd /usr/src
svn co http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2
svn co http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2
svn co http://svn.digium.com/svn/libpri/branches/1.2 libpri-1.2
svn co http://svn.digium.com/svn/asterisk-addons/branches/1.2 asterisk-addons-1.2
svn co http://svn.digium.com/svn/asterisk/trunk/sounds asterisk-sounds
cd /usr/src/libpri-1.2 && make install
cd /usr/src/zaptel-1.2
sed -i 's!^#define ECHO_CAN_KB1!/* #define ECHO_CAN_KB1 */!' zconfig.h
sed -i 's!/\* #define ECHO_CAN_MG2 \*/!#define ECHO_CAN_MG2!' zconfig.h
make install
cd /usr/src/asterisk-1.2 && make install
cd /usr/src/asterisk-addons-1.2
sed -i 's/_GNU_SOURCE/_GNU_SOURCE -DMYSQL_LOGUNIQUEID/' Makefile
make install
If all you wanted to do was install Asterisk on a Ubuntu machine,
you're done - you now have a fully functional Asterisk box, for you to
play with as you wish. If you want, you can run 'make samples' in the
asterisk-1.2 directory to install some example configuration files for
you to play with. However, since you're reading this on the FreePBX
site, we're now up to isetting the machine up and nstalling FreePBX.
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.
root@rob-laptop:~# addgroup asterisk
Adding group `asterisk' (1001)...
Done.
root@rob-laptop:~# useradd -g asterisk -c "Asterisk PBX" -d /var/lib/asterisk asterisk
root@rob-laptop:~# mkdir /var/run/asterisk
root@rob-laptop:~# chown -R asterisk /var/lib/php5
Using nano (or your favourite editor, but nano is fine), you need to change User apache and Group apache to User asterisk and Group asterisk.
[root@dhcp1 ~]# nano +101 /etc/apache2/apache2.conf (Push Control-X to save when you've finished)
You also want to change AllowOverride None to AllowOverride All
[root@dhcp1 ~]# nano +12 /etc/apache2/sites-enabled/000-default (Push Control-X to save when you've finished)
And then restart asterisk to re-load its configuration.
root@rob-laptop:~# /etc/init.d/apache2 restart
Set up MySQL
Before you can do anything to MySQL, you need to make sure it's running:
root@rob-laptop:~# /etc/init.d/mysql start
Starting MySQL database server: mysqld.
root@rob-laptop:~#
Now, you must cd to the /usr/src directory and get the source to freepbx using svn:
root@rob-laptop:/usr/src/freepbx# cd /usr/src/
root@rob-laptop:/usr/src# svn co https://svn.sourceforge.net/svnroot/amportal/freepbx/branches/2.2 freepbx-2.2
A freepbx/amp_conf
A freepbx/amp_conf/astetc
... freePBX now downloads ...
Checked out revision 2574.
root@rob-laptop:/usr/src# cd /usr/src/freepbx-2.2
Now, to configure the databases for freePBX:
root@rob-laptop:/usr/src/freepbx# mysqladmin create asterisk
root@rob-laptop:/usr/src/freepbx# mysqladmin create asteriskcdrdb
root@rob-laptop:/usr/src/freepbx# mysql asterisk < SQL/newinstall.sql
root@rob-laptop:/usr/src/freepbx# 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 Asterisk@Home builds. If anyone's trying
to attack your machine, they will try this.
root@rob-laptop:/usr/src/freepbx# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12 to server version: 5.0.22-Debian_0ubuntu6.06.2-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109'; (This is the first username and password asked for below)
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost 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
root@rob-laptop:/usr/src/freepbx#
Now, after all of this, you need to pick a root 'mysql' password.
For this, we'll pretend it's 's33kret'. If you need to do anything else
with mysql, you'll need to provide this password.
root@rob-laptop:/usr/src/freepbx# mysqladmin -u root password 's33kret'
Install freePBX at last!
You're there - you've done the hard yards, and finally you can install freePBX!
WARNING! If you have an existing Asterisk
installation, the script below will overwrite your Asterisk
configuration files. Backup your /etc/asterisk directory before
running.
root@rob-laptop:/usr/src/freepbx# ./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] (Just push enter if you've done the defaults above, or, fill in the details you entered)
Enter your PASSWORD to connect to the 'asterisk' database:
[amp109] (As above, the password you picked in the MYSQL command)
Enter the hostname of the 'asterisk' database:
[localhost] (Just push enter)
Enter a USERNAME to connect to the Asterisk Manager interface:
[admin] (Just push enter)
Enter a PASSWORD to connect to the Asterisk Manager interface:
[amp111] (Just push enter)
Enter the path to use for your AMP web root:
[/var/www/html]
/var/www
Enter the path to use for your FOP web root:
[/var/www/html/panel]
/var/www/panel
Enter the path to your Apache cgi-bin:
[/var/www/cgi-bin] /usr/lib/cgi-bin
Enter the IP ADDRESS or hostname used to access the AMP web-admin:
[xx.xx.xx.xx] Enter the IP Address of your UBUNTU SERVER HERE
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:
[passw0rd] (Just push enter)
Use simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]?
[extensions](Just push enter)
Enter directory in which to store AMP executable scripts:
[/var/lib/asterisk/bin] (Just push enter)
Created /var/lib/asterisk/bin
Enter directory in which to store super-user scripts:
[/usr/sbin] (Just push enter)
/etc/amportal.conf writtenOK
Reading /etc/amportal.conf..OK
Checking for /etc/asterisk/asterisk.conf..OK
Reading /etc/asterisk/asterisk.conf..OK
Checking for Asterisk 1.2..OK
Checking for selinux..OK
At this stage, you're almost done, but there's quite often a
problem when people have made a typo, or forgotten to put a password in
the mysql server. If you see these lines:
Connecting to database..FAILED
Try running ./install_amp --username=user --password=pass (using your own user and pass)
[FATAL] Cannot connect to database
root@rob-laptop:/usr/src/freepbx#
it means that you haven't done the 'GRANT ALL PRIVILEGES ...'
command in MySQL, or, you've put the wrong password in when you were
doing the installation. All is not lost. If you want to re-run the
installation, with it prompting you again, you can simply delete the
/etc/amportal.conf file (rm /etc/amportal.conf) or edit it and put the correct password in. Then re-run ./install_amp and it should proceed along happily.
root@rob-laptop:/usr/src/freepbx# ./install_amp
Checking for PEAR DB..OK
Checking for PEAR Console::Getopt..OK
Checking user..OK
Checking for /etc/amportal.conf..OK
Reading /etc/amportal.conf..OK
Checking for /etc/asterisk/asterisk.conf..OK
Reading /etc/asterisk/asterisk.conf..OK
Checking for Asterisk 1.2..OK
Checking for selinux..OK
Connecting to database..OK
Checking current version of AMP..2.1.2
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..
Checking for PEAR DB..OK
Checking for PEAR Console::Getopt..OK
Checking for /etc/amportal.conf..OK
Reading /etc/amportal.conf..OK
Reading /etc/asterisk/asterisk.conf..OK
Connecting to database..OK
Please Reload Asterisk by visiting http://192.168.1.53/admin
Generating AMP configs..OK
Restarting Flash Operator Panel..op_server.pl: no process killed
OK
Please Reload Asterisk by visiting http://192.168.1.53/admin
root@rob-laptop:/usr/src/freepbx# modprobe ztdummy
root@rob-laptop:/usr/src/freepbx# amportal start
Starting FreePBX and Asterisk automatically
If you don't have any zaptel hardware, you can automatically start
ztdummy and asterisk by editing /etc/rc.local, and before the 'exit 0'
line insert these two lines:
modprobe ztdummy
/usr/sbin/amportal start &
That ensures that the timing module (ztdummy) is loaded, and that
asterisk is running on bootup. You can also use the /etc/init.d/zaptel
script to start zaptel, hopefully someone with more ubuntu knowledge
can update this page with how to enable it.
Congratulations!
You're done - you now have a fully functional FreePBX
Installation. The first thing to do is log in (Go to the IP address of
the Ubuntu machine above, and click on 'Setup'). The default username
is 'admin' and the default password is 'admin'. Go to the
'Administrators' tab and change the password straight away. After that,
you can visit the Online Module Repository and see what modules are
available.