Asterisk is an open-source software implementation of a telephone private branch exchange (PBX). It allows users to make phone calls over IP networks, and also supports traditional telephone lines.
In this tutorial, we will show you how to install Asterisk on Ubuntu Server. We will assume you are logged into your Ubuntu Server instance as a user with sudo privileges.
Before we begin installing Asterisk, it's always good practice to make sure that our Ubuntu Server instance is up to date. To do so, run the following command:
sudo apt update && sudo apt upgrade -y
Now that we have updated our Ubuntu Server instance, we need to install the packages required for Asterisk to run. To do so, run the following command:
sudo apt install -y autoconf automake build-essential libncurses5-dev libxml2-dev libsqlite3-dev libssl-dev libjansson-dev uuid-dev
These packages include tools and libraries required to build and run the Asterisk software.
Next, we need to download the Asterisk source code from the official website. Run the following command to download and extract the latest version of Asterisk:
cd ~ && wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz && tar -zxvf asterisk-18-current.tar.gz && cd asterisk-18.*
Navigate into the extracted directory, and run the following commands to configure and compile Asterisk:
./configure && make && sudo make install && sudo make samples
The make samples
command creates sample configuration files in the /etc/asterisk/
directory.
To ensure that Asterisk starts automatically when our Ubuntu Server instance boots up, we need to create a systemd service for it. Run the following command to create the asterisk.service
file:
sudo nano /etc/systemd/system/asterisk.service
Insert the following contents into the file:
[Unit]
Description=Asterisk PBX
After=syslog.target network.target
Wants=network-online.target
[Service]
User=root
ExecStart=/usr/sbin/asterisk -f
ExecReload=/usr/sbin/asterisk -rx 'core reload'
ExecStop=/usr/sbin/asterisk -rx 'core stop now'
Restart=on-failure
Type=simple
[Install]
WantedBy=multi-user.target
Save and close the file. Then, run the following commands to reload the systemd daemon and start the Asterisk service:
sudo systemctl daemon-reload
sudo systemctl start asterisk.service
sudo systemctl enable asterisk.service
To verify that Asterisk is running correctly, run the following command:
sudo asterisk -rvvv
This will start the Asterisk command-line interface (CLI). If you see a prompt that looks like *CLI>
, then Asterisk is running correctly.
To exit the CLI, type exit
.
Congratulations! You have successfully installed Asterisk on your Ubuntu Server instance. From here, you can configure Asterisk to suit your needs and start making phone calls.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!