Search

Installing Asterisk 21 on AlmaLinux 9.3

Installing Asterisk 21 on AlmaLinux 9.3

Using Asterisk to build telecommunications systems can bring many benefits.

Asterisk is available under an open source license, which means you can use, modify and adapt it to your needs without incurring licensing costs.

Asterisk supports various communication protocols such as SIP, IAX, H.323 and many others. This makes it flexible and can be used in a variety of telecommunications scenarios. Asterisk is often used to build IP telephone exchange systems. It perfectly supports VoIP technology, offers advanced functions such as conferences, call recording, interfaces for CRM systems and many others. Asterisk can be easily integrated with other systems, such as databases, websites, CRM systems, etc.

You can install Asterisk on one of the popular free Linux distributions such as AlmaLinux described here. If you prefer a different Linux distribution, you can also see our articles about installing Asterisk on Amazon Linux 2023, Rocky, Debian, Ubuntu, CentOS 7, CentOS Stream 8. Click on one of these links to see how to install on other Linux systems.

Table of Contents

1) AlmaLinux installation

The ISO image with the operating system could be downloaded from the manufacturer’s official website.  After creating the machine, mounting the image and starting it, we can choose the installation language. Then click continue and a window with installation options will open.

First, we create a root password and, of course, remember it well. We also select the Allow root  SSH login with password. It will then be more convenient for us to work with the system. Click Done

Then we click Installation Destination. In the pop-up window, select our disk and click Done. We won’t need a graphical interface, so let’s click on Software Selection and select Minimal install

Just make sure that the your time zone is selected in the Time & Date field and that in the Network & Host Name field we have the information  Connected: name of the network interface. If we need to make changes to these fields, we do it now. Next, click Begin Installation. After a few minutes, the installation is completed and we can select the button: Restart your computer.

2) System preparation

After restarting the system, we update it and install the necessary software, such as the convenient nano text editor, the wget software downloader, and other applications and required dependencies.

				
					dnf -y update
dnf -y install nano wget tar epel-release chkconfig libedit-devel
				
			

3) Disabling SELinux

You should also disable SELinux. It is not enough to make changes to the configuration file, but you must also restart the system.

				
					sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
reboot

				
			
HINT

You can also hold off on restarting and temporarily disable SELinux with the command:

				
					setenforce 0
				
			

4) Configuring software dependencies

First, download the Asterisk sources. The /usr/src directory is a convenient place to store all your installations. We download the software from the official Asterisk website.

				
					cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-21-current.tar.gz
tar zxvf asterisk-21-current.tar.gz
rm -rf asterisk-21-current.tar.gz
cd asterisk-21*/
				
			

Now we will install the necessary Asterisk dependencies

				
					contrib/scripts/install_prereq install
				
			

Then we will configure the Asterisk.

Due to the fact that chan_pjsip requires some additional libraries, we also add the --with-jansson-bundled option

So our configurator command will be:

				
					./configure --with-jansson-bundled
				
			

ATTENTION!

If we do not add the --with-jansson-bundled option, the configuration will stop with the following error:

				
					configure: *** Asterisk requires libjansson >= 2.11 and no system copy was found
				
			

This stage should end with displaying a nice logo of our system.

5) Asterisk compilation and installation

Now we can select additional components to install, for example additional sound packs from the Core Sound Packages, Music on Hold and Extra Sound sections

				
					make menuselect
				
			

ATTENTION!

In the current configuration, there are no chan_sip or odbc modules installed. (you can’t select them, they have XXX) If you want to use them, you need to install them first.

After selecting the appropriate options and dependencies, execute the make command itself to prepare the Asterisks for proper installation. This and the next process may take a little longer.

				
					make
				
			

Calling make install  will finally install Asterisk on your server

				
					make install
				
			

Then we will create sample documentation files and create a basic Asterisk configuration.

				
					make samples
mkdir /etc/asterisk/samples
mv /etc/asterisk/*.* /etc/asterisk/samples/
make basic-pbx
				
			

Asterisk is now ready. Unfortunately, there are no startup files yet. On CentoOS, Debian, Ubuntu you can do make config, but AlmaLinux, Amazon Linux 2023 or Rocky don’t understand it. We need to use systemd to manage the asterisk service. I invite you to read the article devoted to this topic. To do this, we will create an asterisk.service file and enter the necessary information into it.

				
					touch /usr/lib/systemd/system/asterisk.service
cat <<'EOF' >/usr/lib/systemd/system/asterisk.service
[Unit]
Description=Asterisk PBX and telephony daemon.
#After=network.target
#include these if Asterisk need to bind to a specific IP (other than 0.0.0.0)
Wants=network-online.target
After=network-online.target network.target

[Service]
Type=simple
Environment=HOME=/var/lib/asterisk
WorkingDirectory=/var/lib/asterisk
ExecStart=/usr/sbin/asterisk -mqf -C /etc/asterisk/asterisk.conf
ExecReload=/usr/sbin/asterisk -rx 'core reload'
ExecStop=/usr/sbin/asterisk -rx 'core stop now'

LimitCORE=infinity
Restart=always
RestartSec=4

# Prevent duplication of logs with color codes to /var/log/messages
StandardOutput=null

PrivateTmp=true

[Install]
WantedBy=multi-user.target
EOF
				
			

6) Launch of Asterisk

Now we will add the asterisk service to the startup, start it and check its status. If you see the word active (running), you have just started Asterisk!

				
					systemctl enable asterisk.service
systemctl start asterisk
systemctl status asterisk
				
			
WARNING

However, if out of habit you executed the make config command and tried to start the asterisk service, you will unfortunately receive the error: "Job for asterisk.service failed because the control process exited with error code." and "Active: failed (Result: exit-code)" and further messages like:

asterisk.service: Control process exited, code=exited, status=1/FAILURE

asterisk.service: Failed with result 'exit-code'.

Failed to start LSB: Asterisk PBX.

This is because AlmaLinux does not create startup files using make config. You should use the systemd described earlier

Before doing this, you need to remove the incorrectly created connections.

				
					systemctl disable asterisk.service
				
			

You can then run the switchboard with the command asterisk -r and start working.

				
					asterisk -r
				
			

If you would like to monitor everything that is happening on your switchboard, try our proprietary VOIPERO software

Installation and configuration takes a few minutes and the system is currently available completely free of charge.

Read what our VOIPERO system can do in terms of live monitoring and reporting of VoIP systems based on Asterisk.

Share this post

Do you have questions or you need an offer?

Contact us!

Most popular

Related Posts

We Have Launched

Monitoring & Reporting of Your VoIP Server