How to install Asterisk 16 LTS no Ubuntu 18.04 / 16.04 / Debian 9

Reading time: less than 1 minute


Asterisk Logo

Hello! In this article we will show you step by step to install Asterisk 16. Asterisk is a complete PBX system, open source, with the features of the PBX systems sold. It supports conference calls, SOME, call park, call queuing and many other features.

 

Instalando Asterisk 16 LTS no Ubuntu 18.04 / 16.04 / Debian 9

Step 1: Update system

Start the installation by a system update, to avoid any problems with dependencies.

sudo apt update && sudo apt -y upgrade
sudo reboot

Step 2: Install dependencies Asterisk 16

 

When the system is connected and updated, install all the Asterisk package dependencies.

sudo apt -y install git curl wget libnewt-dev libssl-dev libncurses5-dev subversion  libsqlite3-dev build-essential libjansson-dev libxml2-dev  uuid-dev

If you get an error for the package subversion no Ubuntu, as below:

E: Package 'subversion' has no installation candidate

Then, add the universal repository and install subversion from it:

sudo add-apt-repository universe sudo apt update && sudo apt -y install subversion

 

Step 3: Download Asterisk 16 LTS tarball

As Asterisk 16 It is not available in Debian and Ubuntu repositories, the installation will be made from the source.

$ sudo apt policy asterisk asterisk: Installed: (none) Candidate: 1:13.14.1~dfsg-2+deb9u3 Version table: 1:13.14.1~dfsg-2+deb9u3 500 ... $ sudo apt policy asterisk asterisk: Installed: (none) Candidate: 1:13.18.3~dfsg-1ubuntu4

Download the latest version of Asterisk 16 to your local system for installation.

cd /usr/src/
curl -O http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz

Then, extract the archive:

tar xvf asterisk-16-current.tar.gz
cd asterisk-16*/

Run the following command to download the mp3 decoder library in the source tree.

$ sudo contrib/scripts/get_mp3_source.sh
A addons/mp3/decode_ntom.c
A addons/mp3/interface.c
A addons/mp3/MPGLIB_README
A addons/mp3/common.c
A addons/mp3/huffman.h
A addons/mp3/tabinit.c
A addons/mp3/Makefile
A addons/mp3/README
A addons/mp3/decode_i386.c
A addons/mp3/dct64_i386.c
A addons/mp3/MPGLIB_TODO
A addons/mp3/mpg123.h
A addons/mp3/layer3.c
A addons/mp3/mpglib.h
Exported revision 202.

Make sure that all the dependencies are resolved:

sudo contrib/scripts/install_prereq install

You should receive a success message at the end.

#############################################
## install completed successfully
#############################################

Step 4: Build and install Asterisk 16 no Ubuntu 18.04 / 16.04 / Debian 9

After downloading Asterisk 16 tarball and install dependencies required, you should be ready to build Asterisk.

Run the configuration script to satisfy build dependencies.

./configure

A successful must have an output like below:

..................
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:the: x86_64 : pc : linux-gnu :
configure: host-cpu:vendor:the: x86_64 : pc : linux-gnu :

Set the options menu by running the following command:

make menuselect

Use the arrow keys to navigate and the Enter key to select.

In Add-ons, select chan_ooh323 e format_mp3 as shown below

install asterisk ubuntu 18.04 01 min

In Core Sound Packages, select the audio packet formats as below

install asterisk ubuntu 18.04 02 min

For Music On Hold, select the following minimum modules

install asterisk ubuntu 18.04 03 min

In Extra Sound Packages, select as shown below:

install asterisk ubuntu 18.04 04 min

Ative app_macro no menu Applications.

asterisk enable app macro menuselect

You can change other settings to find appropriate. when finished, save and exit and install the Asterisk with the selected modules.

Then, build Asterisk running:

make

Sample Output:

Building Documentation For: third-party channels pbx apps codecs formats cdr cel bridges funcs tests main res addons
+--------- Asterisk Build Complete ---------+
+ Asterisk has successfully been built, and +
+ can be installed by running: +
+ +
+ make install +
+-------------------------------------------+

When ready, install Asterisk running the command:

make install

Sample Output:

+---- 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 +
+-------------------------------------------+

You can optionally install the documentation:

make progdocs

Finally, install settings and examples.

make samples
make config
ldconfig

A service systemd unit file will be created for Asterisk.

Create Asterisk User

 

Create a user and group separately to run Asterisk services, and assign the correct permissions.

sudo groupadd asterisk
sudo useradd -r -d /var/lib/asterisk -g asterisk asterisk
sudo usermod -aG audio,dialout asterisk
sudo chown -R asterisk.asterisk /etc/asterisk
sudo chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
sudo chown -R asterisk.asterisk /usr/lib/asterisk

 
Place the default user as Asterisk asterisk.

$ sudo vim /etc/default/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"
$ sudo vim /etc/asterisk/asterisk.conf
runuser = asterisk ; The user to run as.
rungroup = asterisk ; The group to run as.

Restart the asterisk service after saving changes.

sudo systemctl restart asterisk

Enable asterisk service to start at system boot.

sudo systemctl enable asterisk

Test if you can connect to the Asterisk CLI:

# asterisk -rvv
Asterisk 16.0.1, Copyright (C) 1999 - 2018, Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Running as user 'asterisk'
Running under group 'asterisk'
Connected to Asterisk 16.0.1 currently running on ubuntu-01 (pid = 10154)
ubuntu-01*CLI> core show channels
Channel Location State Application(Data)
0 active channels
0 active calls
0 calls processed
ubuntu-01*CLI> exit
Asterisk cleanly ending (0).
Executing last minute cleanups

If you have a firewall active ufw, Open HTTP ports and ports 5060, 5061

sudo ufw allow proto tcp from any to any port 5060,5061

It's ready! You now have Asterisk 16 LTS installed on your Ubuntu server 18.04 / 16.04 / Debian 9

Source: https://computingforgeeks.com/how-to-install-asterisk-16-lts-on-ubuntu-18-04-16-04-debian-9/

2 Comments


  1. Hello everything is fine?
    I don't even know if anyone is still going to read this message, it costs nothing to try, please, how do I reset my user password??
    if you can help me be very grateful.
    edmarrf@hotmail.com

    Reply

    1. Hello,

      Try to login with the wrong password 5 times and send, Attached to comment, a photo of the error message that will appear.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *