How To Install Asterisk on Rocky Linux 9
In this tutorial, we will show you how to install Asterisk on Rocky Linux 9. For those of you who didn’t know, Asterisk, a powerful open-source communications platform, has revolutionized the way organizations manage their phone systems. By setting up a Private Branch Exchange (PBX) system with Asterisk on the reliable and community-driven Rocky Linux 9, businesses can streamline their communications, reduce costs, and improve overall efficiency.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Asterisk on Rocky Linux 9 or RHEL-based.
Prerequisites
- A server running one of the following operating systems: Rocky Linux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Asterisk.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Asterisk on Rocky Linux 9
Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:
sudo dnf update
Step 2. Installing Required Dependencies.
To support Asterisk’s functionality, you’ll need to install specific packages and libraries:
sudo dnf install epel-release sudo dnf groupinstall "Development Tools" sudo dnf install wget openssl-devel ncurses-devel newt-devel libxml2-devel kernel-devel sqlite-devel libuuid-devel gtk2-devel jansson-devel binutils-devel
Step 3. Installing Asterisk on Rocky Linux 9.
With your system prepared, it’s time to download and compile Asterisk from the source code:
http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-20-current.tar.gz
Unpack the downloaded tarball using the following command:
tar -zxvf asterisk-20-current.tar.gz cd asterisk-20.*/
To optimize Asterisk for your needs, run the configuration script and choose the appropriate options:
./configure
With the configuration completed, compile Asterisk using the following command:
make sudo make install
Step 4. Setting up a Basic PBX.
Now that Asterisk is installed, let’s set up a basic PBX system to demonstrate its functionality:
sudo nano /etc/asterisk/sip.conf
In this file, you can define SIP users, passwords, and other parameters for devices to communicate via SIP.
Next, edit the extensions configuration file (extensions.conf
) to create extensions and a dial plan:
sudo nano /etc/asterisk/extensions.conf
In this file, you’ll define the dial plan, including how incoming and outgoing calls should be routed based on extensions.
To test the basic PBX functionality, use a SIP softphone application on your computer or mobile device. Configure the softphone with the SIP user credentials defined in sip.conf
, and make test calls to other SIP users/extensions.
Step 5. Securing Asterisk
A secure PBX is crucial to safeguarding sensitive communications and data. Here’s how you can enhance Asterisk’s security:
- Firewall Setup:
Configure a firewall (e.g., firewalld) to control incoming and outgoing network traffic:
sudo firewall-cmd --add-port=5060/udp --permanent sudo firewall-cmd --reload
- Fail2Ban Integration:
Protect your PBX from brute-force attacks by integrating Fail2Ban:
sudo dnf install fail2ban sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local sudo nano /etc/fail2ban/jail.local
In the jail.local
file, configure settings specific to Asterisk to ban malicious IPs.
Congratulations! You have successfully installed Asterisk. Thanks for using this tutorial for installing Asterisk on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Asterisk website.