How to install asterisk on ubuntu 22. 04

How to Install Asterisk on Ubuntu 22.04

Asterisk is a freely available open-source PBX platform that is utilized for creating communication software such as VoIP gateways and conference servers. It is primarily used by governments, major corporations, small businesses, and individuals. SMS messaging, music on hold, call recording, call queuing, voicemail, interactive voice response, and conference calling are some of the fantastic features of Asterisk.

This blog will demonstrate the procedure of installing Asterisk on Ubuntu 22.04. Let’s get started.

How to install Asterisk on Ubuntu 22.04

For the purpose of installing Asterisk on Ubuntu 22.04, follow the given instructions.

Step 1: Update system packages
First

Sponsored
of all, hit “CTRL+ALT+T” and update the system packages:

$ sudo apt update

All packages are updated:

How to install asterisk on ubuntu 22. 04 1

Step 2: Packages installation
Next, move towards the essential packages installation:

$ sudo apt -y install git curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev

How to install asterisk on ubuntu 22. 04 2

How to install asterisk on ubuntu 22. 04 3

All the essential packages are installed, let’s move to the next step.

Step 3: Download Asterisk archive file
Move to the “/usr/src/” for downloading the Asterisk file on the local system:

$ cd /usr/src/

How to install asterisk on ubuntu 22. 04 4

Next, execute the provided “curl” command to download Asterisk archive file:

$ sudo curl -O http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz

How to install asterisk on ubuntu 22. 04 5

Step 4: Extract Asterisk file
Extract the downloaded Asterisk file:

$ sudo tar xvf asterisk-16-current.tar.gz

How to install asterisk on ubuntu 22. 04 6

How to install asterisk on ubuntu 22. 04 7

Step 5: Move to Asterisk directory
Run the following command to move into the “asterisk-16*” directory:

$ cd asterisk-16*/

How to install asterisk on ubuntu 22. 04 8

Step 6: Download MP3 decoder library
In the next step, we will download the MP3 decoder library in the current Asterisk directory:

$ sudo contrib/scripts/get_mp3_source.sh

How to install asterisk on ubuntu 22. 04 9

Then, make sure all of the dependencies are resolved:

$ sudo contrib/scripts/install_prereq install

How to install asterisk on ubuntu 22. 04 10

Specify the “numeric code” of your region and hit “Enter”:

How to install asterisk on ubuntu 22. 04 11

The given output indicates that the dependencies are successfully resolved:

How to install asterisk on ubuntu 22. 04 12

Type “./configure” for satisfying build dependencies:

$ sudo ./configure

How to install asterisk on ubuntu 22. 04 13

How to install asterisk on ubuntu 22. 04 14

Step 7: Set up menu options
In the next step, we will set up some menu options by utilizing the provided command:

$ sudo make menuselect

For instance, we have selected “chan_ooh323” as “Add-ons”. Use the arrow keys and select other build options. After setting the options according to the requirements, hit the “Save & Exit” button:

How to install asterisk on ubuntu 22. 04 15

How to install asterisk on ubuntu 22. 04 16

Step 7: Build Asterisk
Next, type out “sudo make” in the Ubuntu 22.04 terminal for building Asterisk:

$ sudo make

How to install asterisk on ubuntu 22. 04 17

How to install asterisk on ubuntu 22. 04 18

Step 8: Install Asterisk
Then, install Asterisk on your Ubuntu 22.04 system with the help of the provided command:

$ sudo make install

How to install asterisk on ubuntu 22. 04 19

How to install asterisk on ubuntu 22. 04 20

Step 9: Install samples and configs
After installing Asterisk, move ahead and install “samples” and “configs” one by one:

$ sudo make samples

How to install asterisk on ubuntu 22. 04 21

How to install asterisk on ubuntu 22. 04 22

$ sudo make config

How to install asterisk on ubuntu 22. 04 23

$ sudo ldconfig

How to install asterisk on ubuntu 22. 04 24

Upon doing so, the Asterisk service unit file is created on your Ubuntu 22.04 system.

Step 10: Create Asterisk User
In order to run the Asterisk service, firstly create an “asterisk” user and group:

$ sudo groupadd asterisk

How to install asterisk on ubuntu 22. 04 25

Step 11: Set permissions
Next, set the correct permissions for the “asterisk” user:

$ sudo useradd -r -d /var/lib/asterisk -g asterisk asterisk

How to install asterisk on ubuntu 22. 04 26

$ sudo usermod -aG audio,dialout asterisk

How to install asterisk on ubuntu 22. 04 27

One by one, execute the below-given command:

$ sudo chown -R asterisk.asterisk /etc/asterisk

How to install asterisk on ubuntu 22. 04 28

The second command you need to run is:

$ sudo chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk

How to install asterisk on ubuntu 22. 04 29

Lastly, execute the given command:

$ sudo chown -R asterisk.asterisk /usr/lib/asterisk

How to install asterisk on ubuntu 22. 04 30

Step 12: Set Asterisk user
Now, we will set the created “asterisk” user as the default Asterisk user. To do so, open up the Asterisk configuration file in the “nano” editor:

$ sudo nano /etc/default/asterisk

How to install asterisk on ubuntu 22. 04 31

You Asterisk configuration file will somehow look like this:

How to install asterisk on ubuntu 22. 04 32

Now specify the default Asterisk user and its group as follows:

See also  How to manage packages in Ubuntu?
AST_USER=”asterisk”
AST_GROUP=”asterisk”

Then press “CTRL+O” to save the added lines and switch back to terminal:

How to install asterisk on ubuntu 22. 04 33

Step 13: Restart Asterisk service
After performing the previous operation, restart the Asterisk service on your system:

$ sudo systemctl restart asterisk

How to install asterisk on ubuntu 22. 04 34

Step 14: Enable Asterisk service
Next, enable the Asterisk service so that it can start on system boot:

$ sudo systemctl enable asterisk

How to install asterisk on ubuntu 22. 04 35

Step 15: Check Asterisk service status
Lastly verify if the Asterisk service is successfully running on your system:

$ systemctl status asterisk

How to install asterisk on ubuntu 22. 04 36

That was all about Asterisk installation. Now, let’s head towards the method of connecting to Asterisk CLI.

How to connect to Asterisk CLI on Ubuntu 22.04

Run the following command in Ubuntu 22.04 terminal for connecting to the Asterisk CLIU:

$ sudo asterisk -rvv

How to install asterisk on ubuntu 22. 04 37

The above-given output shows that we are successfully connected to the Asterisk CLI.

How to remove Asterisk from Ubuntu 22.04

On Ubuntu 22.04 terminal, run the provided command for removing Asterisk:

$ sudo rm -r /usr/src/asterisk-16.26.1

How to install asterisk on ubuntu 22. 04 38

We have compiled the easiest method to install Asterisk on Ubuntu 22.04 system.

Conclusion

To install Asterisk on Ubuntu 22.04, firstly install the required dependencies, download the Asterisk archive file and extract the downloaded package. Then, satisfy the build dependencies, set up menu options, build, and install Asterisk. To configure Asterisk, you can create a separate “asterisk” user and group and set their permissions. This blog demonstrated the procedure to install Asterisk on Ubuntu 22.04.

Leave a Comment

Only people in my network can comment.