How To Install Asterisk 16 LTS on Debian 11.3
To Install Asterisk 16 LTS On Debian 11.3
Introduction:
Asterisk is a complete telephony server that provides Private Branch Exchange (PBX), Interactive Voice Response (IVR), Automated Call Distribution (ACD), Voice over IP (VoIP) gatewaying, Conferencing, and a wide variety of other telephony applications to a broad range of telephony devices including packet voice devices.
Installation Procedure:
Step 1: Check the OS version by using the below command
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Step 2: Change the directory by using the below command
root@linuxhelp:~# cd /usr/src/
Step 3: Download the Asterisk by using the below command
root@linuxhelp:/usr/src# curl -O http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 26.7M 100 26.7M 0 0 153k 0 0:02:57 0:02:57 --:--:-- 104k
Step 4: Extract the downloaded file by using the below command
root@linuxhelp:/usr/src# tar xvf asterisk-16-current.tar.gz
asterisk-16.27.0/
asterisk-16.27.0/.cleancount
asterisk-16.27.0/.gitignore
asterisk-16.27.0/.gitreview
asterisk-16.27.0/.lastclean
asterisk-16.27.0/.version
asterisk-16.27.0/BSDmakefile
asterisk-16.27.0/BUGS
asterisk-16.27.0/CHANGES
asterisk-16.27.0/COPYING
asterisk-16.27.0/CREDITS
asterisk-16.27.0/ChangeLog
asterisk-16.27.0/LICENSE
asterisk-16.27.0/Makefile
asterisk-16.27.0/Makefile.moddir_rules
asterisk-16.27.0/Makefile.rules
asterisk-16.27.0/README-SERIOUSLY.bestpractices.md
asterisk-16.27.0/README-addons.txt
asterisk-16.27.0/README.md
asterisk-16.27.0/UPGRADE.txt
asterisk-16.27.0/Zaptel-to-DAHDI.txt
asterisk-16.27.0/addons/
asterisk-16.27.0/addons/.gitignore
Step 5: Change the directory to the “asterisk-16.27.0” by using the below command
root@linuxhelp:/usr/src# cd asterisk-16.27.0/
Step 6: Next long list the directory by using the below command
root@linuxhelp:/usr/src# ls -la
total 27372
drwxr-xr-x 3 root root 4096 Jul 25 16:31 .
drwxr-xr-x 14 root root 4096 Jul 14 12:43 ..
drwxr-xr-x 31 root root 4096 Jun 23 20:52 asterisk-16.27.0
-rw-r--r-- 1 root root 28014649 Jul 25 16:31 asterisk-16-current.tar.gz
Step 7: Update the apt source list by using the below command
root@linuxhelp:~# apt update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Hit:2 http://deb.debian.org/debian bullseye InRelease
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Hit:4 https://packages.sury.org/php bullseye InRelease
Hit:5 http://repo.mysql.com/apt/debian bullseye InRelease
Get:6 http://security.debian.org/debian-security bullseye-security/main Sources [131 kB]
Fetched 215 kB in 2s (115 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Step 8: Install the dependencies by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# contrib/scripts/install_prereq install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
aptitude-common libcwidget4
Suggested packages:
apt-xapian-index aptitude-doc-en | aptitude-doc debtags libcwidget-dev
The following NEW packages will be installed:
aptitude aptitude-common libcwidget4
0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded.
Need to get 3,441 kB of archives.
After this operation, 15.9 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 aptitude-common all 0.8.13-3 [1,776 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 libcwidget4 amd64 0.5.18-5 [315 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 aptitude amd64 0.8.13-3 [1,349 kB]
Fetched 3,441 kB in 1s (4,821 kB/s)
Selecting previously unselected package aptitude-common.
(Reading database ... 148822 files and directories currently installed.)
Preparing to unpack .../aptitude-common_0.8.13-3_all.deb ...
Unpacking aptitude-common (0.8.13-3) ...
Selecting previously unselected package libcwidget4:amd64.
Current status: 0 (-2) upgradable.
#############################################
## install completed successfully
#############################################
Step 9: Download the mp3 decoder library into the source tree by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# contrib/scripts/get_mp3_source.sh
A addons/mp3
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
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
Exported revision 202.
Step 10: Run the configure script to build the dependencies by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
[pjproject] Configuring with --prefix=/opt/pjproject --disable-speex-codec --disable-speex-aec --disable-bcg729 --disable-gsm-codec --disable-ilbc-codec --disable-l16-codec --disable-g722-codec --disable-g7221-codec --disable-opencore-amr --disable-silk --disable-opus --disable-video --disable-v4l2 --disable-sound --disable-ext-sound --disable-sdl --disable-libyuv --disable-ffmpeg --disable-openh264 --disable-ipp --disable-libwebrtc --without-external-pa --without-external-srtp --disable-resample --disable-g711-codec --enable-epoll
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 :
Step 11: Setup the Menu option by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# make menuselect
CC="cc" CXX="g++" LD="" AR="" RANLIB="" CFLAGS="" LDFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" cmenuselect
make[1]: Entering directory '/usr/src/asterisk-16.23.0/menuselect'
gcc -g -D_GNU_SOURCE -Wall -Wno-deprecated-declarations -DHAVE_NCURSES -I/usr/include/libxml2 -c -o menuselect.o menuselect.c
gcc -g -D_GNU_SOURCE -Wall -Wno-deprecated-declarations -DHAVE_NCURSES -c -o strcompat.o strcompat.c
gcc -g -D_GNU_SOURCE -Wall -Wno-deprecated-declarations -DHAVE_NCURSES -c -o menuselect_curses.o menuselect_curses.c
gcc -o cmenuselect menuselect.o strcompat.o menuselect_curses.o -lncurses -ltinfo -lxml2
make[1]: Leaving directory '/usr/src/asterisk-16.23.0/menuselect'
CC="cc" CXX="g++" LD="" AR="" RANLIB="" CFLAGS="" LDFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" nmenuselect
make[1]: Entering directory '/usr/src/asterisk-16.23.0/menuselect'
gcc -g -D_GNU_SOURCE -Wall -Wno-deprecated-declarations -DHAVE_NCURSES -c -o menuselect_newt.o menuselect_newt.c
gcc -o nmenuselect menuselect.o strcompat.o menuselect_newt.o -lnewt -lxml2
make[1]: Leaving directory '/usr/src/asterisk-16.23.0/menuselect'
CC="cc" CXX="g++" LD="" AR="" RANLIB="" CFLAGS="" LDFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" gmenuselect
make[1]: Entering directory '/usr/src/asterisk-16.23.0/menuselect'
make[1]: Nothing to be done for 'gmenuselect'.
make[1]: Leaving directory '/usr/src/asterisk-16.23.0/menuselect'
make[1]: Entering directory '/usr/src/asterisk-16.23.0'
Step 12: Mark the chan_ooh and format_mp3 on ADD-ons as shown in the below image
Step 13: Select the Audio format packages on core sound packages as shown in the below image
Step 14: Select the Minimal Modules on Music on Hold as shown in the below image
Step 15: Select the following packages on Extra sound packages as shown in the below image
Step 16: Select the app_macro on Applications as shown in the below image
Step 17: Build Asterisk by running make by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# make
[CC] astcanary.c -> astcanary.o
[LD] astcanary.o -> astcanary
[CC] astdb2sqlite3.c -> astdb2sqlite3.o
[CC] hash/hash.c -> hash/hash.o
[CC] hash/hash_bigkey.c -> hash/hash_bigkey.o
[CC] hash/hash_buf.c -> hash/hash_buf.o
[CC] hash/hash_func.c -> hash/hash_func.o
[CC] hash/hash_log2.c -> hash/hash_log2.o
[CC] hash/hash_page.c -> hash/hash_page.o
[CC] hash/ndbm.c -> hash/ndbm.o
[CC] btree/bt_search.c -> btree/bt_search.o
[CC] btree/bt_seq.c -> btree/bt_seq.o
[LD] format_mp3.o mp3/common.o mp3/dct64_i386.o mp3/decode_ntom.o mp3/layer3.o mp3/tabinit.o mp3/interface.o -> format_mp3.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 +
+-------------------------------------------+
Step 18: After build run make to install Asterisk by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# make install
Installing modules from channels...
Installing modules from pbx...
Installing modules from apps...
Installing modules from codecs...
Installing modules from formats...
Installing modules from cdr...
Installing modules from cel...
Installing modules from bridges...
Installing modules from funcs...
Installing modules from tests...
Installing modules from main...
Installing modules from res...
Installing modules from addons...
/usr/bin/install -c -d "/usr/include/asterisk/doxygen"
/usr/bin/install -c -m 644 include/asterisk.h "/usr/include"
/usr/bin/install -c -m 644 include/asterisk/*.h "/usr/include/asterisk"
/usr/bin/install -c -m 644 include/asterisk/doxygen/*.h "/usr/include/asterisk/doxygen"
if [ -n "" ]; then \
for h in ; do rm -f "/usr/include/asterisk/$h"; done \
fi
/usr/bin/install -c -m 755 contrib/scripts/astversion "/usr/sbin/"
/usr/bin/install -c -m 755 contrib/scripts/astgenkey "/usr/sbin/"
/usr/bin/install -c -m 755 contrib/scripts/autosupport "/usr/sbin/"
if [ ! -f /sbin/launchd ]; then \
./build_tools/install_subst contrib/scripts/safe_asterisk "/usr/sbin/safe_asterisk"; \
fi
/usr/bin/install -c -m 644 doc/core-*.xml "/var/lib/asterisk/documentation"
/usr/bin/install -c -m 644 doc/appdocsxml.xslt "/var/lib/asterisk/documentation"
/usr/bin/install -c -m 644 doc/appdocsxml.dtd "/var/lib/asterisk/documentation"
/usr/bin/install -c -m 644 doc/asterisk.8 "/usr/share/man/man8"
/usr/bin/install -c -m 644 doc/astdb*.8 "/usr/share/man/man8"
/usr/bin/install -c -m 644 contrib/scripts/astgenkey.8 "/usr/share/man/man8"
/usr/bin/install -c -m 644 contrib/scripts/autosupport.8 "/usr/share/man/man8"
/usr/bin/install -c -m 644 contrib/scripts/safe_asterisk.8 "/usr/share/man/man8"
if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
/usr/bin/install -c -m 644 contrib/firmware/iax/iaxy.bin "/var/lib/asterisk/firmware/iax/iaxy.bin"; \
fi
CFLAGS=" -I/usr/include/libxml2 -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 " build_tools/mkpkgconfig "/usr/lib/pkgconfig";
find static-http | while read x; do \
if test -d $x; then \
/usr/bin/install -c -m 755 -d "/var/lib/asterisk/$x"; \
else \
/usr/bin/install -c -m 644 $x "/var/lib/asterisk/$x" ; \
fi \
done
/usr/bin/install -c -m 644 doc/core-en_US.xml "/var/lib/asterisk/static-http";
/usr/bin/install -c -m 644 doc/appdocsxml.xslt "/var/lib/asterisk/static-http";
if [ -d doc/tex/asterisk ] ; then \
/usr/bin/install -c -d "/var/lib/asterisk/static-http/docs" ; \
for n in doc/tex/asterisk/* ; do \
/usr/bin/install -c -m 644 $n "/var/lib/asterisk/static-http/docs" ; \
done \
fi
for x in images/*.jpg; do \
/usr/bin/install -c -m 644 $x "/var/lib/asterisk/images" ; \
Done
make -C sounds install
make[1]: Entering directory '/usr/src/asterisk-16.23.0/sounds'
HTTP request sent, awaiting response... 200 OK
Length: 1777967 (1.7M) [application/x-gzip]
Saving to: ‘asterisk-moh-opsound-gsm-2.03.tar.gz’
asterisk-moh-opsound-gsm-2.03 100%[===============================================>] 1.70M 10.7MB/s in 0.2s
2022-01-19 04:30:57 (10.7 MB/s) - ‘asterisk-moh-opsound-gsm-2.03.tar.gz’ saved [1777967/1777967]
make[1]: Leaving directory '/usr/src/asterisk-16.23.0/sounds'
find rest-api -name "*.json" | while read x; do \
/usr/bin/install -c -m 644 $x "/var/lib/asterisk/rest-api" ; \
done
+---- 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 +
+-------------------------------------------+
Step 19: Install the samples by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# make samples
Installing adsi config files...
/usr/bin/install -c -d "/etc/asterisk"
Installing configs/samples/asterisk.adsi
Installing configs/samples/telcordia-1.adsi
Installing other config files...
Installing file configs/samples/acl.conf.sample
Installing file configs/samples/adsi.conf.sample
Installing file configs/samples/agents.conf.sample
Installing file configs/samples/alarmreceiver.conf.sample
Installing file configs/samples/alsa.conf.sample
Installing file configs/samples/amd.conf.sample
Installing file configs/samples/app_mysql.conf.sample
Installing file configs/samples/app_skel.conf.sample
Installing file configs/samples/ari.conf.sample
Installing file configs/samples/ast_debug_tools.conf.sample
Installing file configs/samples/asterisk.conf.sample
Installing file configs/samples/calendar.conf.sample
Installing file configs/samples/ccss.conf.sample
Installing file configs/samples/indications.conf.sample
Installing file configs/samples/logger.conf.sample
Installing file configs/samples/manager.conf.sample
Installing file configs/samples/vpb.conf.sample
Installing file configs/samples/xmpp.conf.sample
Updating asterisk.conf
/usr/bin/install -c -d "/var/spool/asterisk/voicemail/default/1234/INBOX"
build_tools/make_sample_voicemail "//var/lib/asterisk" "//var/spool/asterisk"
Installing file phoneprov/000000000000.cfg
Installing file phoneprov/000000000000-directory.xml
Installing file phoneprov/000000000000-phone.cfg
Installing file phoneprov/polycom_line.xml
Installing file phoneprov/polycom.xml
Installing file phoneprov/snom-mac.xml
Step 20: Install the configs by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# make config
Step 21: ldconfig creates the necessary links and cache to the most recent shared libraries found
root@linuxhelp:/usr/src/asterisk-16.27.0# ldconfig
Step 22: Create a group as asterisk by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# sudo groupadd asterisk
Step 23: Create a user as asterisk and adding to the group asterisk by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# sudo useradd -r -d /var/lib/asterisk -g asterisk asterisk
Step 24: Add asterisk user to the some more groups by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# sudo usermod -aG audio,dialout asterisk
Step 25: Change the ownership as asterisk for the following directories
root@linuxhelp:/usr/src/asterisk-16.27.0# chown -R asterisk.asterisk /etc/asterisk
root@linuxhelp:/usr/src/asterisk-16.27.0# chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
root@linuxhelp:/usr/src/asterisk-16.27.0# chown -R asterisk.asterisk /usr/lib/asterisk
Step 26: Set default user as asterisk by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# vim /etc/default/asterisk
Step 27: Set the Asterisk conf will run as asterisk user by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# vim /etc/asterisk/asterisk.conf
Step 28: Restart the Asterisk service by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# systemctl restart asterisk
Step 29: Enable the Asterisk service to start on boot by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# systemctl enable asterisk
asterisk.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable asterisk
Step 30: Check the status of the Asterisk service by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/init.d/asterisk; generated)
Active: active (running) since Wed 2022-01-19 04:44:40 IST; 29s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 77 (limit: 2254)
Memory: 114.7M
CGroup: /system.slice/asterisk.service
└─50939 /usr/sbin/asterisk -U asterisk -G asterisk
Step 31: Login to the Asterisk CLI by using the below command
root@linuxhelp:/usr/src/asterisk-16.27.0# asterisk -rvv
Asterisk 16.23.0, Copyright (C) 1999 - 2021, Sangoma Technologies Corporation 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.23.0 currently running on linuxhelp (pid = 50939)
linuxhelp*CLI>
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to install Asterisk 16 LTS on Debian 11.3. Your feedback is much welcome.