Getting started with Asterisk – Asterisk 14 installation on Ubuntu 16.04 LTS

Run the following bash script as sudo

#!/bin/bash

# get deps
apt -y install build-essential libncurses5-dev libxml2-dev libsqlite3-dev libssl-dev libsrtp0-dev uuid-dev libjansson-dev

# download
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-14-current.tar.gz
tar -zxvf asterisk-14-current.tar.gz
rm asterisk-14-current.tar.gz
cd asterisk-14*

# Install pre-requisites
./contrib/scripts/install_prereq install
./contrib/scripts/install_prereq install-unpackaged
./contrib/scripts/get_mp3_source.sh

# Install
make clean
./configure
make menuselect
make
make install
make samples
make config

# Uncomment and edit the following lines to setup a snakeoil SSL cert
#mkdir /etc/asterisk/keys
#cd contrib/scripts/
# Change the following IP address to you server IP address 
#./ast_tls_cert -C 192.168.254.2 -O "My company name" -d /etc/asterisk/keys

# Edit the following to adjust locale of sounds
cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-wav-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-wav-current.tar.gz

tar -xzf asterisk-core-sounds-en_GB-wav-current.tar.gz
tar -xzf asterisk-extra-sounds-en_GB-wav-current.tar.gz
rm *.tar.gz

if you want to reproduce, please indicate the source:
Getting started with Asterisk – Asterisk 14 installation on Ubuntu 16.04 LTS - CodeDay