Step 1: Update Ubuntu System
zaman@zaman:~$ sudo apt update -y
zaman@zaman:~$ sudo apt -y upgrade
Reboot your system
zaman@zaman:~$ sudo systemctl reboot
Step 2: Install Build Dependencies
zaman@zaman:~$ sudo apt update
zaman@zaman:~$ sudo add-apt-repository universe
zaman@zaman:~$ sudo apt -y install git curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev
Step 3: Download Asterisk 18 tarball
zaman@zaman:~$ sudo apt policy asterisk
Visit https://www.asterisk.org/ to download the asterisk source code
zaman@zaman:~$ cd ~
zaman@zaman:~$ wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz
Extract the file with tar
zaman@zaman:~$ tar xvf asterisk-18-current.tar.gz
Run the command to download the mp3 decoder library into the source tree
zaman@zaman:~$ cd asterisk-18*/
zaman@zaman:~$ contrib/scripts/get_mp3_source.sh
Ensure all dependencies are resolved
zaman@zaman:~$ sudo contrib/scripts/install_prereq install
Step 4: Build and Install Asterisk on Ubuntu
Run the configure script to satisfy build dependencies
zaman@zaman:~$ ./configure
Setup menu options by running the following command
Use arrow keys to navigate, and Enter key to select
Select Add-ons to enable:
Enable Core sound modules you want to use:
You can also add additional MOH packages you want to use:
Do the same for Extra Sound Packages:
You can also go through the other menus and select options you see fit for your use case.
When done run the command to build Asterisk on Ubuntu
Run the command to install Asterisk on Ubuntu
You can optionally install documentation
zaman@zaman:~$ sudo make progdocs
Finally, install configs and samples
zaman@zaman:~$ sudo make samples
zaman@zaman:~$ sudo make config
zaman@zaman:~$ sudo ldconfig
Step 5: Start Asterisk Service on Ubuntu
Create a separate user and group to run asterisk services, and assign correct permissions
zaman@zaman:~$ sudo groupadd asterisk
zaman@zaman:~$ sudo useradd -r -d /var/lib/asterisk -g asterisk asterisk
zaman@zaman:~$ sudo usermod -aG audio,dialout asterisk
zaman@zaman:~$ sudo chown -R asterisk.asterisk /etc/asterisk
zaman@zaman:~$ sudo chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
zaman@zaman:~$ sudo chown -R asterisk.asterisk /usr/lib/asterisk
Set Asterisk default user to asterisk
zaman@zaman:~$ sudo vim /etc/default/asterisk
zaman@zaman:~$ sudo vim /etc/asterisk/asterisk.conf
Restart asterisk service after making the changes
zaman@zaman:~$ sudo systemctl restart asterisk
Enable asterisk service to start on system boot
zaman@zaman:~$ sudo systemctl enable asterisk
Check service status to see if it is running
zaman@zaman:~$ systemctl status asterisk
Verify you can connect to Asterisk Command Line interface
zaman@zaman:~$ sudo asterisk -rvv
If you have an active ufw firewall, open http ports and ports 5060,5061
zaman@zaman:~$ sudo ufw allow proto tcp from any to any port 5060,5061
You now have Asterisk installed and working on Ubuntu Linux server.
0 Comments