The last version of Rocky Linux that this procedure was tested on was version 8.5. Because the bulk of this procedure relies on source builds directly from Asterisk and a simple set of Development Tools from Rocky Linux, it should work on all versions. If you run into a problem, please let us know!
Asterisk is an open source framework for building communications applications. Additionally, Asterisk turns an ordinary computer into a communications server, as well as powering IP PBX systems, VoIP gateways, conference servers and other custom solutions. It is used by small businesses, large businesses, call centers, carriers, and government agencies worldwide.
Asterisk is free and open source and is sponsored by Sangoma. Sangoma also offers commercial products that use Asterisk under the hood, and depending on your experience and budget, using these products may be more beneficial than rolling your own. Only you and your organization know that answer.
It should be noted that this guide requires the administrator to do a fair amount of research on their own. Installing a communications server is not a difficult process, but running one can be quite complicated. While this guide will get your server up and running, it will not be fully ready for you to use in production.
At minimum, you will need the following skills and tools to complete this guide:
A machine running Rocky Linux
A comfort level with modifying configuration files and issuing commands from the command-line
Knowledge of how to use a command line editor (We are using vi here, but feel free to substitute in your favorite editor.)
You will need root access, and ideally be signed in as the root user in your terminal
The EPEL repositories from Fedora
The ability to login as root or run root commands with sudo. All commands here assume a user that has sudo rights, however the configuration and build processes are run with sudo -s.
To grab the latest build of Asterisk, you will need to either use curl or wget. This guide uses wget, but feel free to substitute in the appropriate curl string if you want to use that.
Before you download this script, make sure you have the latest version. To do so, navigate to the Asterisk download link here and look for the latest build of Asterisk. Then copy the link location. As of the writing of this document, the following was the latest build:
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-20-current.tar.gz
tar xvfz asterisk-20-current.tar.gz
cd asterisk-20.0.0/
Before running the install_prereq below (and the remaining commands), you are going to need to be the superuser or root. It's much easier at this point to get into sudo permanently for a while. We will exit back out of sudo later in the process:
sudo -s
contrib/scripts/install_prereq install
You should see the following when the script completes:
This is one of the steps where the administrator is going to need to do his homework. There are a lot of menu options that you may or may not need. Running the following command:
make menuselect
will bring you to a menu select screen:
Look through these options carefully and make selections based on your requirements. As stated earlier, this may take some additional homework.
To build, we want to execute the following commands in succession:
make
make install
Installing the documentation isn't required, but unless you are a communications server expert, you'll want them installed:
make progdocs
Next install the basic PBX and make the config. The basic PBX is just that, very basic! You will probably need to make changes going forward to get your PBX to function as you want it to.
Now that the bulk of our work is completed, go ahead and exit out of the sudo -s command. This will require that most of the remaining commands use sudo again:
This example uses firewalld for the firewall, which is the default in Rocky Linux. The goal here is to open SIP ports to the world and to open RTP (Realtime Transport Protocol) to the world on ports 10000-20000 as recommended by the Asterisk documentation.
Keep in mind that you will almost certainly need other firewall rules for other forward-facing services (HTTP/HTTPS) which you will probably want to limit to your own IP addresses. That is beyond the scope of this document:
The above will get you up and running with the server, but finishing out the configuration, connecting devices, and further troubleshooting is up to you.
Running an Asterisk communications server takes a lot of time and effort and will require a lot of research by any administrator. For more information on how to configure and use Asterisk, take a look at the Asterisk Wiki here.