In this tutorial, we will show you how to install Asterisk on an Ubuntu 16.04 server. Asterisk is the most popular open source software implementation of a telephone private branch exchange (PBX). It includes many features such as: voicemail, conference calling, call recorder, automatic call distribution, interactive voice response, real time monitoring, debugging console and supports most of the standard voice over IP (VOIP) protocols including SIP, d H.323 and MGCP.
Login via SSH and update the OS
Make sure your server OS is fully up-to-date:
apt-get update apt-get upgrade
Install all required packages and dependencies
Install all required packages on your Asterisk VPS with the following commands:
apt-get install build-essential apt-get install git-core subversion libjansson-dev sqlite autoconf automake libxml2-dev libncurses5-dev libtool
Download Asterisk
At the time of the writing of this article the latest Asterisk version is 15.5.0, switch to the /usr/src/
directory with:
cd /usr/src/
and download the asterisk archive with the following wget command:
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-15-current.tar.gz
When the download is completed extract the asterisk-15-current.tar.gz file by typing the following command:
tar -zxvf asterisk-15-current.tar.gz
Compile Asterisk
Once the asterisk archive is extracted, switch to the asterisk-15.5.0
directory with:
cd /usr/src/asterisk-15.5.0
Install all of the missing dependencies with the help of the install_prereq
script:
./contrib/scripts/install_prereq install
Depending on the number of the missing packages the installation may take some time , once it is completed the output will look like this:
Current status: 7 (-2) upgradable. ############################################# ## install completed successfully #############################################
Next step is to run the ./configure
script which will check your system for missing libraries and dependencies and prepare the Asterisk code for the build process:
./configure
The output of the successful completion should look like this:
configure: Menuselect build configuration successfully completed .$$$$$$$$=.. .$7$7.. .7$7:. .$:. ,$7.7 .$7. 7$$ .$77 ..$. $$$ .$$7 ..7$ .?. $$$ .?. 7$$. $.$. .$$7. $$7 .7$$. .$$. .777. .$$$77$$77$$$7. $$, $$~ .7$$$$$$$7. .$$. .$7 .7$$$$7: ?$$. $$ ?7$$$$$I .$$7 $$ .7$$$$$$$$ :$$. $$ $$$7$$$$$$ .$$. $$ $$ 7$$7 .$$ .$$. $$ $$7 .$$. 7$$7 7$$ 7$$ $$$ $$ $$7. $ (TM) $$$$. .7$$$ $ $$$$$$7$$$$$.$$$ $$$$$$$$. configure: Package configured for: configure: OS type : linux-gnu configure: Host CPU : x86_64 configure: build-cpu:vendor:os: x86_64 : pc : linux-gnu : configure: host-cpu:vendor:os: x86_64 : pc : linux-gnu :
Once the configuration is completed start the compilation process using the make
command by typing:
make
The build process may take several minutes depending on your system speed and once it is completed you will see the following message which means that the Asterisk was successfully compiled:
+--------- Asterisk Build Complete ---------+ + Asterisk has successfully been built, and + + can be installed by running: + + + + make install + +-------------------------------------------+
The next step is to run the make install
command which will install Asterisk and all compiled Asterisk modules:
make install
Upon successful Asterisk installation you will see the following message on your screen:
+---- Asterisk Installation Complete -------+ + + + YOU MUST READ THE SECURITY DOCUMENT + + + + Asterisk has successfully been installed. + + If you would like to install the sample + + configuration files (overwriting any + + existing config files), run: + + + + For generic reference documentation: + + make samples + + + + For a sample basic PBX: + + make basic-pbx + + + + + +----------------- or ---------------------+ + + + You can go ahead and install the asterisk + + program documentation now or later run: + + + + make progdocs + + + + **Note** This requires that you have + + doxygen installed on your local system + +-------------------------------------------+
As the message above says run the make samples command to install the Asterisk sample configuration files:
make samples
Install the initialization script so that you can manage your Asterisk service using the systemctl command :
make config
The command above will show no output.
You can also install the logrotation script with:
make install-logrotate
You will see the following output indicating that the logrotation configuration has been successfully created:
if [ ! -d "/etc/asterisk/../logrotate.d" ]; then \ /usr/bin/install -c -d "/etc/asterisk/../logrotate.d" ; \ fi sed 's#__LOGDIR__#/var/log/asterisk#g' < contrib/scripts/asterisk.logrotate | sed 's#__SBINDIR__#/usr/sbin#g' > contrib/scripts/asterisk.logrotate.tmp /usr/bin/install -c -m 0644 contrib/scripts/asterisk.logrotate.tmp "/etc/asterisk/../logrotate.d/asterisk" rm -f contrib/scripts/asterisk.logrotate.
Start Asterisk
Now that you have Asterisk installed on your Ubuntu 16.04 VPS you can use the systemctl
to start the Asterisk service:
systemctl start asterisk
To check if the Asterisk service is started use the systemctl status
command:
systemctl status asterisk
If the service is running you will see the following message:
● asterisk.service - LSB: Asterisk PBX Loaded: loaded (/etc/init.d/asterisk; bad; vendor preset: enabled) Active: active (running) since Wed 2018-07-18 03:36:23 CDT; 5s ago Docs: man:systemd-sysv-generator(8) Process: 15427 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS) CGroup: /system.slice/asterisk.service └─15440 /usr/sbin/asterisk
To enable the asterisk service to start on system boot type the following command:
systemctl enable asterisk
That is it. The Asterisk installation is complete.
PS. If you liked this on how to install Asterisk on Ubuntu 16.04, post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.