How To Install Asterisk On Ubuntu 20.04 - Linuxize
How To Install Asterisk On Ubuntu 20.04 - Linuxize
04 | Linuxize
Asterisk features include voicemail, music on hold, conference calling, call queuing, call
recording, interactive voice response, SMS messaging, and more.
Ubuntu repositories include an older Asterisk version. We’ll install the latest Asterisk from the
source code.
Prerequisites
Install the following packages that are necessary to download and build Asterisk:
https://linuxize.com/post/how-to-install-asterisk-on-ubuntu-20-04/ 1/9
6/16/2021 How to Install Asterisk on Ubuntu 20.04 | Linuxize
$ cd /usr/src/
$ sudo git clone -b next git://git.asterisk.org/dahdi/linux dahdi-lin
$ cd dahdi-linux
$ sudo make
$ sudo make install
$ cd /usr/src/
$ sudo git clone -b next git://git.asterisk.org/dahdi/tools dahdi-too
$ cd dahdi-tools
$ sudo autoreconf -i
$ sudo ./configure
$ sudo make install
$ sudo make install-config
$ sudo dahdi_genconf modules
$ cd /usr/src/
$ sudo git clone https://gerrit.asterisk.org/libpri libpri
$ cd libpri
$ sudo make
$ sudo make install
Installing Asterisk
Clone the Asterisk source in the /usr/src directory:
$ cd /usr/src/
$ sudo git clone -b 18 https://gerrit.asterisk.org/asterisk asterisk-
https://linuxize.com/post/how-to-install-asterisk-on-ubuntu-20-04/ 2/9
6/16/2021 How to Install Asterisk on Ubuntu 20.04 | Linuxize
At the time of writing, the latest version of Asterisk is 18.x. If there is a new version available,
change the branch number in the command above.
Before continuing with the next steps, change to the Asterisk source directory:
$ cd asterisk-18/
Download the MP3 sources which are required to build the MP3 module and use MP3 files on
Asterisk:
$ sudo contrib/scripts/get_mp3_source.sh
The configure script performs several checks to make sure all of the dependencies on
your system are present. Run the script by typing:
$ sudo ./configure
The next step is to select the modules you want to compile and install. Access menuselect, by
typing:
Select the “format_mp3” option to tell Asterisk to build the MP3 module:
https://linuxize.com/post/how-to-install-asterisk-on-ubuntu-20-04/ 3/9
6/16/2021 How to Install Asterisk on Ubuntu 20.04 | Linuxize
Once you are finished, switch to the “Save and Exit” button and press “Enter”.
The compilation may take some time, depending on your system. You can modify the -j flag
according to the number of cores in your processor.
You can install either the generic configuration files with reference documentation by typing:
It is also a good idea to run ldconfig to update the shared libraries cache:
Copy
$ sudo ldconfig
https://linuxize.com/post/how-to-install-asterisk-on-ubuntu-20-04/ 4/9
6/16/2021 How to Install Asterisk on Ubuntu 20.04 | Linuxize
By default, Asterisk runs as the root user. We’ll create a new system user and configure
Asterisk to run as the newly created user for security reasons.
Run the following command to create a new system user named asterisk :
/etc/default/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"
Starting Asterisk
Now that you are all set up, start the Asterisk service with the following command:
To verify that Asterisk is running, connect to the Asterisk command-line interface (CLI) by
typing:
https://linuxize.com/post/how-to-install-asterisk-on-ubuntu-20-04/ 5/9
6/16/2021 How to Install Asterisk on Ubuntu 20.04 | Linuxize
Output
Configuring Firewall
The firewall will secure your server against unwanted traffic.
If you don’t have a firewall configured on your server, you can check our guide about how to set
up a firewall with ufw on ubuntu
By default, SIP uses the UDP port 5060, to open the port run:
If you enabled the Real Time Protocol (RTP) then you also need to open the following port
range:
Conclusion
We’ve shown you how to install the latest Asterisk version from the source on Ubuntu 20.04.
To learn more about how to configure and use Asterisk check the official documentation
and
https://linuxize.com/post/how-to-install-asterisk-on-ubuntu-20-04/ 6/9
6/16/2021 How to Install Asterisk on Ubuntu 20.04 | Linuxize
ubuntu asterisk
BUY ME A COFFEE
Sign up to our newsletter and get our latest tutorials and news straight
to your mailbox.
Your email...
Subscribe
Related Articles
JUL 18, 2018
https://linuxize.com/post/how-to-install-asterisk-on-ubuntu-20-04/ 7/9
6/16/2021 How to Install Asterisk on Ubuntu 20.04 | Linuxize
MAY 7, 2021
https://linuxize.com/post/how-to-install-asterisk-on-ubuntu-20-04/ 8/9
6/16/2021 How to Install Asterisk on Ubuntu 20.04 | Linuxize
Write a comment
© 2021 Linuxize.com
Privacy Policy
Terms
Contact
Advertise on Linuxize
https://linuxize.com/post/how-to-install-asterisk-on-ubuntu-20-04/ 9/9