Page tree
Skip to end of metadata
Go to start of metadata

READ FIRST

Manual installations of FreePBX is considered an EXPERTS ONLY exercise. This method of installation is enough to get CORE functionality of FreePBX. Non-commercial modules may not function as expected or detailed in the Wiki's. Certain modules and features may require additional software to be installed and configured on the server.

**** COMMERCIAL MODULES CANNOT BE INSTALLED ON THIS OS ****

 

Initial System Setup

When installing the machine, at package selection make sure you pick - at least - 'OpenSSH Server', and 'LAMP Packages'.  This installs the base packages required.

MySQL Password

After selecting 'Continue' you will be prompted (several times) for a root password. There is no need to set one, and setting one is discouraged! As part of the FreePBX install, a secure (128 bit) password is generated, and used to lock down MySQL. If you set a password now, it is not possible for the installer to secure your database. Please just push 'enter' when prompted for a password.

Unlock and configure your root password.

You may find it helpful to log in directly as root to manage and update your system. We recommend you do set a root password, and enable SSH logins from root, so you don't need to go through secondary steps that may cause problems.  This command enables SSH root logins, and prompts you for a new root password.

sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/sshd/sshd_config
service ssh restart
sudo passwd root

Switch to the Root User

THIS IS IMPORTANT!  You must run the entire process as root. Attempting to use 'sudo' later on will not work. Please don't ignore this. You must run this command to switch to an interactive root shell.

sudo -i

Update Your System

apt-get update && apt-get upgrade -y 

Install Required Dependencies

apt-get install -y build-essential linux-headers-`uname -r` openssh-server apache2 mysql-server\
  mysql-client bison flex php5 php5-curl php5-cli php5-mysql php-pear php5-gd curl sox\
  libncurses5-dev libssl-dev libmysqlclient-dev mpg123 libxml2-dev libnewt-dev sqlite3\
  libsqlite3-dev pkg-config automake libtool autoconf git unixodbc-dev uuid uuid-dev\
  libasound2-dev libogg-dev libvorbis-dev libcurl4-openssl-dev libical-dev libneon27-dev libsrtp0-dev\
  libspandsp-dev libmyodbc
 

Reboot server

reboot

After the Reboot

Ensure that you re-run 'sudo -i', or log in as the root user. As mentioned above, the entire install process must be run as 'root', and failure to do so will cause unexpected problems.

Ensure mod_rewrite is enabled in apache

This is used to avoid potential attacks, and needs to be enabled.

a2enmod rewrite
service apache2 restart

Install Legacy pear requirements

pear install Console_Getopt

Install Dependencies for Google Voice (if required)

You may skip this section if you do not require Google Voice support.

Install iksemel

cd /usr/src
wget https://iksemel.googlecode.com/files/iksemel-1.4.tar.gz
tar xf iksemel-1.4.tar.gz
cd iksemel-*
./configure
make
make install

Install and Configure Asterisk

Download Asterisk source files.

cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.7.tar.gz
wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2

Compile and install DAHDI.

If you don't have any physical PSTN hardware attached to this machine, you don't need to install DAHDI (For example, a T1 or E1 card, or a USB device). Most smaller setups will not have DAHDI hardware, and this step can be safely skipped.

cd /usr/src
tar xvfz dahdi-linux-complete-current.tar.gz
rm -f dahdi-linux-complete-current.tar.gz
cd dahdi-linux-complete-*
make all
make install
make config
cd /usr/src
tar xvfz libpri-current.tar.gz
rm -f libpri-current.tar.gz
cd libpri-*
make
make install

Compile and install pjproject

cd /usr/src
tar -xjvf pjproject-2.4.tar.bz2
rm -f pjproject-2.4.tar.bz2
cd pjproject-2.4
CFLAGS='-DPJ_HAS_IPV6=1' ./configure --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr
make dep
make
make install

Compile and Install jansson

cd /usr/src
tar vxfz jansson.tar.gz
rm -f jansson.tar.gz
cd jansson-*
autoreconf -i
./configure
make
make install

Compile and install Asterisk

cd /usr/src
tar xvfz asterisk-13-current.tar.gz
rm -f asterisk-13-current.tar.gz
cd asterisk-*
contrib/scripts/install_prereq install
./configure
contrib/scripts/get_mp3_source.sh
make menuselect

You will be prompted at the point to pick which modules to build. Most of them will already be enabled, but if you want to have MP3 support (eg, for Music on Hold), you need to manually turn on 'format_mp3' on the first page.

After selecting 'Save & Exit' you can then continue

make
make install
make config
ldconfig
update-rc.d -f asterisk remove

Install Asterisk Soundfiles.

The 'make install' above installs a standard low-quality base sound file by default. This is suitable if you are on a small, underpowered system (such as a Rasberry Pi), but on a larger system you should install higher quality soundfiles.  Note that this installs the (8khz) 'wav' soundfiles and G722 (High Definition 'Wideband') audio.

cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
tar xvf asterisk-core-sounds-en-wav-current.tar.gz
rm -f asterisk-core-sounds-en-wav-current.tar.gz
tar xfz asterisk-extra-sounds-en-wav-current.tar.gz
rm -f asterisk-extra-sounds-en-wav-current.tar.gz
# Wideband Audio download 
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-g722-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gz
tar xfz asterisk-extra-sounds-en-g722-current.tar.gz
rm -f asterisk-extra-sounds-en-g722-current.tar.gz
tar xfz asterisk-core-sounds-en-g722-current.tar.gz
rm -f asterisk-core-sounds-en-g722-current.tar.gz

Install and Configure FreePBX

Create the Asterisk user and set base file permissions.

useradd -m asterisk
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib/asterisk
rm -rf /var/www/html

A few small modifications to Apache.

sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php5/apache2/php.ini
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
service apache2 restart

Configure ODBC

Edit /etc/odbcinst.ini and add the following. Note that this command assumes you are installing to a new machine, and that the file is empty. If this is not a freshly installed machine, please manually verify the contents of the file, rather than just copying and pasting the lines below. The 'EOF' does no go in the file, it simply signals to the 'cat' command that you have finished pasting.

cat >> /etc/odbcinst.ini << EOF
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1
 
EOF

You may need to verify these paths, if you're not on a x86_64 machine. You can use the command `find / -name libmyodbc.so` to verify the location

Edit or create /etc/odbc.ini and add the following section. Note that, again, this command assumes you are installing to a new machine, and the file is empty. Please manually verify the contents of the files if this is not the case.

cat >> /etc/odbc.ini << EOF
[MySQL-asteriskcdrdb]
Description=MySQL connection to 'asteriskcdrdb' database
driver=MySQL
server=localhost
database=asteriskcdrdb
Port=3306
Socket=/var/run/mysqld/mysqld.sock
option=3
 
EOF

Download and install FreePBX.

cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-13.0-latest.tgz
tar vxfz freepbx-13.0-latest.tgz
rm -f freepbx-13.0-latest.tgz
cd freepbx
./start_asterisk start
./install -n

That's it!

You can now start using FreePBX.  Open up your web browser and connect to the IP address or hostname of your new FreePBX server.  You will see the Admin setup page, which is where you set your  'admin' account password, and configure an email address to receive update notifications. 

We hope you enjoy using FreePBX 13!

  • No labels

7 Comments

  1. when you install mysql do not set a root password otherwise you have to

    dpkg-reconfigure mysql-server-5.5

    mysql -u root -p

    SET PASSWORD FOR root@localhost=PASSWORD('');

    exit;

     

  2. THANK YOU for these instructions.  Also, after downloading the Ubuntu Server 14.04.4 LTS today:

    To enable root access via ssh, I had to use:

    sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

     

    For those who are cutting & pasting sections of the scripting above (like I did), be aware that the following command in the "Compile and install Asterisk" section might prompt you for your international dialing code (I think it defaulted to 61, which I changed to 1 for the US).

    contrib/scripts/install_prereq install

    The side-effect of the prompt for dialing code above is that I had to re-paste the commands-below (no big deal - just FYI):

    ./configure
    contrib/scripts/get_mp3_source.sh
    make menuselect
  3. Excellent instructions, how do we get Asterisk to start automatically after a reboot?  Thanks.

  4. i followed this very clear install instruction and when i log on to my gui i am having lots of issues. It seems no modules were installed during installation and i tried to install them from Module Admin with no luck. Also Freepbx Framework is saying it has been tempered with i have to reinstall and when i try this i dont if my file amportal is wrong somewhere as i did not edited it

    amportal a ma upgrade freawork

    /usr/sbin/amportal: line 50: unexpected EOF while looking for matching ``'
    /usr/sbin/amportal: line 80: syntax error: unexpected end of file

    this is my amportal file 

     

    1 #!/usr/bin/env bash
    2 # License for all code of this FreePBX module can be found in the license file inside the module directory
    3 # Copyright 2013 Schmooze Com Inc.
    4 #
    5 ROOT_UID=0 # root uid is 0
    6 E_NOTROOT=67 # Non-root exit error
    7
    8 # define freepbx config file if not already set
    9 if [ -z "$FREEPBX_CONF" ]; then
    10 FREEPBX_CONF="/etc/freepbx.conf"
    11 if [ -e "/etc/asterisk/freepbx.conf" ]; then
    12 FREEPBX_CONF="/etc/asterisk/freepbx.conf"
    13 fi
    14 fi
    15 export FREEPBX_CONF
    16
    17 echo
    18 # check to see if we are root
    19 if [ "$UID" -ne "$ROOT_UID" ]; then
    20 echo "Sorry, you must be root to run this script."
    21 echo
    22 exit $E_NOTROOT
    23 fi
    24
    25 # get settings from db/config file
    26 if [[ -e $FREEPBX_CONF && -w "/etc/amportal.conf" && -z "$FORCE_AMPORTAL_CONF" ]]; then # Check if file exists.
    27
    28 php -v > /dev/null 2>&1
    29 if [ $? -eq 0 ]; then
    30 echo "Please wait..."
    31 `php -r '
    32 $bootstrap_settings["freepbx_auth"] = false;
    33 $bootstrap_settings["skip_astman"] = true;
    34 $restrict_mods = true;
    35 include_once(getenv("FREEPBX_CONF"));
    36 foreach($amp_conf as $key => $val) {
    37 $val = str_replace(array("\r", "\n", "\r\n"), ",", $val);
    38 if (is_bool($val)) {
    39 echo "export " . trim($key) . "=" . ($val?"TRUE":"FALSE") ."\n";
    40 } else {
    41 echo "export " . trim($key) . "=" . escapeshellcmd(trim($val)) ."\n";
    42 }
    43 }
    44 '
    45 elif [ -e "/var/lib/asterisk/bin/gen_amp_conf.php" ]; then
    46 echo "Fetching FreePBX settings with gen_amp_conf.php..."
    47 `/var/lib/asterisk/bin/gen_amp_conf.php`
    48 elif [ -e "/usr/local/freepbx/bin/gen_amp_conf.php" ]; then
    49 echo "Fetching FreePBX settings with gen_amp_conf.php..."
    50 `/usr/local/freepbx/bin/gen_amp_conf.php`
    51 elif [ -e "/etc/amportal.conf" ]; then # Check if file exists.
    52 echo "Fetching settings from amportal.conf file..."
    53 . /etc/amportal.conf
    54 else
    55 echo
    56 echo "FreePBX settings could not be fetched and no backup config file found!"
    57 echo "Have you installed FreePBX?"
    58 exit
    59 fi
    60 elif [ -e "/etc/amportal.conf" ]; then # Check if file exists.

    . /etc/amportal.conf
    62 else
    63 echo
    64 echo "FreePBX config file not found!"
    65 echo "Have you installed FreePBX?"
    66 exit
    67 fi
    68
    69 for dir in ${AMPBIN} ${ASTVARLIBDIR}/bin /var/lib/asterisk/bin /usr/local/freepbx/bin
    70 do
    71 # exec the first one we find
    72 if [ -x "$dir"/freepbx_engine ]; then
    73 exec "$dir"/freepbx_engine $@
    74 fi
    75 done
    76
    77 # if we got here, we could not find a freepbx_engine to run
    78 echo "FATAL: can not find freepbx_engine to start Asterisk"
    79 exit 1

  5. Please can someone help, now i am getting this error when i try to apply config

    exit: 126
    sh: 1: /var/lib/asterisk/bin/retrieve_conf: Permission denied

     

    what permissions do i need here on this file 

  6. Hi!

    I installed asterisk and freepbx today at my ubuntu server 16.04._x64

    Now I have following problem:

    sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php5/apache2/php.ini
    file not found
    I watched with winSCP.
    I have only /etc/apache2
    I don't have /etc/php5/apache2
    mkdir php5 doesn't work.
    thank you in advance.
    greetings, Mathias
  7. Hello, I am trying to install FreePBX on Ubuntu 16.04, but I have had several problems with the version since I use php7 and I think it is not compatible with this version of frepbx