Install Asterisk 18 LTS on Debian 11 / Debian 10

ComputingPost
7 min readNov 3, 2022

--

Hello our good people!. In this guide, we shall be focusing on the installation of Asterisk 18 LTS on Debian 11 / Debian 10. 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:

  • 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 11 / Debian 10 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 on Debian 10 is lower as compared to one in Debian 11.

Step 1: Update system packages

Ensure all packages are updated in the system before we can install Asterisk 18 LTS on Debian 11 / Debian 10.

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 Asterisk 18 LTS build dependencies

Since we’re buildingAsterisk 18 LTS on Debian 11 / Debian 10 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

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:~$

debian@debian-bullseye-01:~$ gcc --version

gcc (Debian 10.2.1-6) 10.2.1 20210110

Copyright (C) 2020 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.



$ gcc --version

gcc (Debian 10.2.1-6) 10.2.1 20210110

Copyright (C) 2020 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 tarball

Download the latest release ofAsterisk 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 odbcinst (2.3.6-0.1+b1) ...

Setting up odbcinst1debian2:amd64 (2.3.6-0.1+b1) ...

Setting up unixodbc-dev:amd64 (2.3.6-0.1+b1) ...

Processing triggers for initramfs-tools (0.140) ...

update-initramfs: Generating /boot/initrd.img-5.10.0-8-amd64

Processing triggers for libglib2.0-0:amd64 (2.66.8-1) ...

No schema files found: doing nothing.

Processing triggers for libc-bin (2.31-13) ...

Processing triggers for man-db (2.9.4-2) ...

Setting up libgmime-3.0-dev:amd64 (3.2.7-1) ...



#############################################

## install completed successfully

#############################################

Step 4: Build and Install Asterisk 18 LTS on Debian 11 / Debian 10

After installation of dependencies and we are good to initiate build and installation ofAsterisk 18 LTS on Debian 11 / Debian 10.

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 (1)

Example on adding extra Core Sound Packages to build.

install-asterisk-ubuntu-18.04-02-min (1)

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-1024x517

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 11 / Debian 10 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 the installation

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 Wed 2021-12-08 11:20:08 UTC; 1min 24s 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.11.1, Copyright (C) 1999 - 2021, Sangoma Technologies Corporation and others.

Created by Mark Spencer

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.11.1 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 11 / Debian 10 Linux machine. A detailed configuration guide and complete documentation is available on the official Asterisk website.

https://www.computingpost.com/install-asterisk-18-lts-on-debian-11-debian-10/?feed_id=17642&_unique_id=6363fa26dba6f

--

--

ComputingPost

ComputingPost — Linux Howtos, Tutorials, Guides, News, Tips and Tricks.