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:
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)
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.
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..
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:
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.
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".
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
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
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
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.
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.
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.
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
-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 ...
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
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.
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.
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:
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.2freepbx-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.
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.
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!
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.
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:
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.
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:
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 &
/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.
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.
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.