Install Asterisk on Ubuntu 16.04

Install Asterisk on Ubuntu 16.04

There are two basic ways of installing Asterisk on Ubuntu. The first method is to download the software from http://www.asterisk.org/downloads/asterisk/all-asterisk-versions. Once downloaded on to the machine it will need to be built and installed. The second method is to download the software from Ubuntu’s repository. This is the method that this lesson will take to install Asterisk.

Installing Asterisk

Before installing any software, it is a good idea to have an up-to-date server. First the repository information needs to be updated to inform the operating system of new software changes. To do this use the command:
sudo apt update

Now that the operating system is aware of any changes available from the repository, it is time to apply the changes and upgrade any out-of-date software. To do this use the command:
sudo apt upgrade

After the operating system is up-to-date it is now time to install Asterisk. This can be done with a single command. This will install Asterisk and any dependencies it needs to run on Ubuntu. To do this use the command:
sudo apt install asterisk

Upgrading Asterisk

At the time of writing this lesson, the repository installs an early version of Asterisk 13.1.  An alternative to this would be to update Asterisk to the latest release of version 13. To do this, it can be installed from a ppa. To add the ppa use the following command:
sudo add-apt-repository ppa:alcacoop/asterisk

The operating system will again need to be made aware of any available software updates. Use the command:
sudo apt update

Now to upgrade the software run the upgrade command again and it will install the updated Asterisk 13. Use the command:
sudo apt upgrade

Fixing known issues

To check on the status of Asterisk use the command:
sudo service asterisk status

In an earlier version, version 13 there was an issue running a module called res_pjsip.so. In order to get this version to work properly in Ubuntu the line “noload => res_pjsip.so” (do not include quotes) must be added to the /etc/asterisk/modules.conf file.

Some of the newer versions appear to be an issue with locating the radiusclient.conf file. Asterisk is looking for it in the /etc/radiusclient-ng folder, when it is actually in the /etc/raidiusclient folder. This can be easliy remedied by create a soft link between the two. First create a folder named radiusclient-ng using the command:
sudo mkdir /etc/radiusclient-ng

And now create a soft link for the radiusclient.conf file. Use the command:
sudo ln -s /etc/radiusclient/radiusclient.conf /etc/radiusclient-ng/radiusclient.conf

To restart Asterisk use the command:
sudo service asterisk restart

Logging into Asterisk’s Command Line Interface

To login to the CLI interface of Asterisk use the command:
sudo asterisk -rvvv

To exit out of the CLI console interface use the command:
quit