Debian

How To Install Asterisk 18 LTS on Debian 12/11/10

Hello our good people!. In this guide, we shall be focusing on the installation of Asterisk 18 LTS on a Debian Linux machine. Asterisk is an opensource and free to use PBX system with a number of useful features mostly available in commercial PBX systems. Asterisk is used by different kinds of organizations all over the world. Below are the standard features shipped with Asterisk PBX system:

Original content from computingforgeeks.com - post 604
  • Conference calling
  • Call Monitoring
  • Call Recording
  • Distributed Universal Number Discovery
  • SMS Messaging
  • Trunking
  • Transcoding
  • Voicemail
  • Caller ID on Call Waiting
  • Direct Inward System Access
  • Call Parking
  • Music on Hold
  • Music on Transfer
  • Caller ID Blocking
  • Database Store / Retrieve
  • Direct Inward System Access
  • Automated Attendant
  • Blacklists
  • Call Detail Records
  • Call Forward on Busy
  • Call Forward on No Answer
  • Call Forward Variable
  • Call Snooping
  • Among many other features

We will perform an installation of Asterisk 18 LTS on Debian Linux by building the software from source. The default version of asterisk package available in the OS upstream repositories is a bit old as can be seen by running the commands below:

$ sudo apt update
$ apt policy asterisk
# Debian 11
asterisk:
  Installed: (none)
  Candidate: 1:16.16.1~dfsg-1+deb11u1
  Version table:
     1:16.16.1~dfsg-1+deb11u1 500
        500 http://security.debian.org/debian-security bullseye-security/main amd64 Packages
     1:16.16.1~dfsg-1 500
        500 http://deb.debian.org/debian bullseye/main amd64 Packages

# Debian 10
$ apt policy asterisk
asterisk:
  Installed: (none)
  Candidate: 1:16.2.1~dfsg-1+deb10u2
  Version table:
     1:16.2.1~dfsg-1+deb10u2 500
        500 http://deb.debian.org/debian buster/main amd64 Packages

As seen from the output, the version of Asterisk is older.

Step 1: Update system packages

Ensure all packages are updated in the system before we can install the package.

sudo apt update && sudo apt full-upgrade -y

You can do a system power cycle after a successful upgrade if required.

[ -f /var/run/reboot-required ] && sudo reboot -f

Step 2: Install build dependencies

Since we’re building Asterisk 18 LTS on Debian from source files. Let’s install all the required software dependencies:

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

Validate that GCC and CMAKE are installed and working on our local system

$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

debian@debian-bullseye-01:~$ gcc --version
gcc (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Step 3: Download Asterisk 18 LTS

Download the latest release of Asterisk 18 LTS in tarball format

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

Extract Asterisk 18 tarball after the download:

sudo tar xvf asterisk-18-current.tar.gz
cd asterisk-18*/

Download the mp3 decoder library into the source tree by running below commands:

$ sudo contrib/scripts/get_mp3_source.sh
A    addons/mp3
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
A    addons/mp3/decode_ntom.c
A    addons/mp3/interface.c
Exported revision 202.

Confirm all dependencies are installed using install_prereq script.

sudo contrib/scripts/install_prereq install

Message output from successful installation:

.....
Setting up libsrtp2-dev (2.5.0-3) ...
Setting up libxmu6:amd64 (2:1.1.3-3) ...
Setting up libxaw7:amd64 (2:1.0.14-1) ...
Setting up libical-dev:amd64 (3.0.16-1+b1) ...
Setting up libgvc6 (2.42.2-7+b3) ...
Setting up graphviz (2.42.2-7+b3) ...
Processing triggers for libglib2.0-0:amd64 (2.74.6-2) ...
No schema files found: doing nothing.
Processing triggers for libc-bin (2.36-9+deb12u4) ...
Processing triggers for man-db (2.11.2-2) ...
Setting up libgmime-3.0-dev:amd64 (3.2.13+dfsg-2) ...

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

Step 4: Build and Install Asterisk 18 LTS

After installation of dependencies and we are good to initiate build and installation of Asterisk 18 LTS.

Run the configure script to satisfy build dependencies.

sudo ./configure

Sample output of successful execution:

.....
configure: creating ./config.status
config.status: creating makeopts
config.status: creating autoconfig.h
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 :

Customize your Asterisk installation using the menu options.

sudo make menuselect

Use the arrow keys in your keyboard to navigate through the menus, and Enter key to select.

Example selecting Add-ons to install in Asterisk 18:

install asterisk ubuntu 18.04 01 min

Example on adding extra Core Sound Packages to build.

install asterisk ubuntu 18.04 02 min

For Music On Hold, select the following minimal modules

install asterisk ubuntu 18.04 03 min

On Extra Sound Packages select as shown below:

install asterisk ubuntu 18.04 04 min

Enable app_macro under Applications menu.

asterisk enable app macro menuselect

Feel free to enable or disable any modules as you see fit. After all the configurations, use the “Save and Exit” button to update.

To build Asterisk 18 LTS on Debian Linux by running the command below:

sudo make

The build process should complete in the next few minutes or seconds depending on your compute power:

.....
   [LD] res_pjsip_publish_asterisk.o -> res_pjsip_publish_asterisk.so
   [CC] res_calendar_exchange.c -> res_calendar_exchange.o
   [LD] res_calendar_exchange.o -> res_calendar_exchange.so
   [CC] res_pjsip_registrar.c -> res_pjsip_registrar.o
   [LD] res_pjsip_registrar.o -> res_pjsip_registrar.so
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               +
 +-------------------------------------------+

The final step is installation of Asterisk on Debian using the make install command:

sudo make install

Step 5: Configure Asterisk 18 LTS

After a successful installation, you can install Asterisk documentation:

sudo make progdocs

Install default configurations for Asterisk and samples.

sudo make samples
sudo make config
sudo ldconfig

Create Asterisk User

Create a separate user and group to run asterisk services, and assign 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

Let’s confirm the id of Asterisk user:

$ id asterisk
uid=997(asterisk) gid=1001(asterisk) groups=1001(asterisk),20(dialout),29(audio)

Set the user and group that asterisk service will run as

$ sudo vim /etc/default/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"

The default configuration file used by asterisk is /etc/asterisk/asterisk.conf. You can open the file and see if any change is required.

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

Restart asterisk service after making the changes:

sudo systemctl restart asterisk

Also enable the service to start with the system boot

$ systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: active (running) since Thu 2024-04-11 10:18:07 UTC; 1min 6s ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 70 (limit: 2340)
     Memory: 46.0M
        CPU: 1.635s
     CGroup: /system.slice/asterisk.service
             └─48369 /usr/sbin/asterisk -U asterisk -G asterisk

Dec 08 11:20:08 debian-bullseye-01 systemd[1]: Starting LSB: Asterisk PBX...
Dec 08 11:20:08 debian-bullseye-01 asterisk[48355]: Starting Asterisk PBX: asterisk.
Dec 08 11:20:08 debian-bullseye-01 systemd[1]: Started LSB: Asterisk PBX.

To use Asterisk CLI, run:

$ sudo asterisk -rvv
Asterisk 18.22.0, Copyright (C) 1999 - 2022, Sangoma Technologies Corporation and others.
Created by Mark Spencer <[email protected]>
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.
=========================================================================
Connected to Asterisk 18.22.0 currently running on debian-bullseye-01 (pid = 48369)
debian-bullseye-01*CLI>

Running some asterisk commands to test the functionality.

debian-bullseye-01*CLI> core show  uptime
System uptime: 16 minutes, 29 seconds
Last reload: 16 minutes, 29 seconds

debian-bullseye-01*CLI> core show  sysinfo

System Statistics
-----------------
  System Uptime:             18 hours
  Total RAM:                 2030244 KiB
  Free RAM:                  160672 KiB
  Buffer RAM:                58964 KiB
  Total Swap Space:          0 KiB
  Free Swap Space:           0 KiB

  Number of Processes:       172

debian-bullseye-01*CLI> exit
Asterisk cleanly ending (0).
Executing last minute cleanups

We have now installed and configured Asterisk 18 LTS on Debian Linux machine. A detailed configuration guide and complete documentation is available on the official Asterisk website.

Related Articles

Containers Using Docker or Podman Compose on Debian 12 (Bookworm) Databases How To Install Apache CouchDB on Debian 11/10 Databases Install MariaDB on Ubuntu 24.04 / Debian 13 Databases Install and Configure Redis 7 on Debian 13/12

8 thoughts on “How To Install Asterisk 18 LTS on Debian 12/11/10”

  1. You miss a part aboun mysql_client prerequisite before ./configure. Need to install:

    apt-get install default-libmysqlclient-dev

    otherwise res_config_mysql cannot be selected.

    Reply
  2. When I run “”sudo apt -y install build-essential git curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev libjansson-dev libxml2-dev uuid-dev default-libmysqlclient-dev”” error: no installation candidate

    Reply
  3. Got an error :
    radcli: rc_read_config: rc_read_config: can’t open /etc/radiusclient-ng/radiusclient.conf: No such file or directory

    Fix :
    sed -i ‘s”;\[radius\]”\[radius\]”g’ /etc/asterisk/cdr.conf
    sed -i ‘s”;radiuscfg => /usr/local/etc/radiusclient-ng/radiusclient.conf”radiuscfg => /etc/radcli/radiusclient.conf”g’ /etc/asterisk/cdr.conf
    sed -i ‘s”;radiuscfg => /usr/local/etc/radiusclient-ng/radiusclient.conf”radiuscfg => /etc/radcli/radiusclient.conf”g’ /etc/asterisk/cel.conf

    Reply
  4. Hi guys
    After Instalation script I have this trouble code : Doxygen is not installed. Please install and re-run the configuration script.
    Any help ?

    Thanks Raduz

    Reply

Leave a Comment

Press ESC to close