How To Install Asterisk on Ubuntu 22.04 LTS
In this tutorial, we will show you how to install Asterisk on Ubuntu 22.04 LTS. For those of you who didn’t know, Asterisk, a powerful open-source PBX platform, has revolutionized the world of telecommunication. From small businesses to large enterprises, Asterisk is the go-to solution for IP PBX systems, VoIP gateways, and conference servers. With a plethora of features such as call queuing, interactive voice response, conference calling, music on hold, and voicemail, it offers a comprehensive solution for all telecommunication needs.
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 Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
Prerequisites
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Asterisk.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- 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 Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. Before diving into the installation process, it’s crucial to ensure your system is up-to-date. An updated system not only ensures smooth installation but also provides enhanced security and performance. Run the following commands to update your system packages:
sudo apt update sudo apt upgrade sudo apt install wget apt-transport-https gnupg2 software-properties-common
Step 2. Installing Necessary Dependencies
Next, install the necessary dependencies. These are essential for the successful compilation and installation of Asterisk:
sudo apt-get install build-essential sudo apt-get install git-core subversion wget libjansson-dev sqlite autoconf automake libxml2-dev libncurses5-dev libtool
Step 3. Installing Asterisk on Ubuntu 22.04.
With the system prepared, it’s time to download the Asterisk source. Use the following command to download the latest version of Asterisk:
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-20-current.tar.gz
Once the download is complete, extract the Asterisk file using the following command:
tar xvf asterisk-16-current.tar.gz
Navigate to the Asterisk directory:
cd asterisk-20*
Now, initiate the compilation process. This might take some time, depending on your system’s performance:
sudo make -j2
After the compilation process is complete, install Asterisk and its modules:
sudo make install
After successfully installing Asterisk, it’s time to create an Asterisk user and group. This enhances the security of your Asterisk installation:
sudo adduser --system --group --home /var/lib/asterisk --no-create-home --gecos "Asterisk PBX" asterisk
Set the correct permissions for the Asterisk user:
sudo chown -R asterisk: /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk sudo chmod -R 750 /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk
Restart the Asterisk service:
sudo systemctl restart asterisk
Enable the Asterisk service to start on system boot:
sudo systemctl enable asterisk
Step 4. Configuring Asterisk.
To make Asterisk functional, you need to configure it according to your needs. Start by editing the users.conf
file:
sudo nano /etc/asterisk/users.conf
Add users to the file:
[6001] fullname = Example Bob secret = 1234 hassip = yes context = users host = dynamic [6002] fullname = Example Joe secret = 1234 hassip = yes context = users host = dynamic
Save the file and reload the configuration:
sudo asterisk -rx 'core reload'
Step 5. Connecting to Asterisk CLI.
To manage your Asterisk server, you need to connect to the Asterisk CLI. Use the following command:
sudo asterisk -rvv
Congratulations! You have successfully installed Asterisk. Thanks for using this tutorial for installing the Asterisk open-source PBX platform on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official Asterisk website.