Skip to content

Instantly share code, notes, and snippets.

@LinuxPlaner
Last active September 12, 2022 18:12
Show Gist options
  • Save LinuxPlaner/08e7b642b47e5c44e11a211e3ebc1e74 to your computer and use it in GitHub Desktop.
Save LinuxPlaner/08e7b642b47e5c44e11a211e3ebc1e74 to your computer and use it in GitHub Desktop.
Install Asterisk on Ubuntu 20.04
Ping Me For Asterisk installing related service:
SMS: +8801610932753
IMO: +8801610932753
BiP: +8801610932753
Viber: +8801610932753
Signal: +8801610932753
Discord: supanta saha#3868
Telegram: https://t.me/LinuxPlaner
WhatsApp: https://wa.link/njuw4c
Skype: https://join.skype.com/weW8UDI0u7o5
Email: [email protected]
#Prerequisites
sudo apt update && sudo apt -y upgrade
sudo apt-get install git curl wget \
libnewt-dev libssl-dev libncurses5-dev \
#Download the latest release of Asterisk 15 to your local system for installation.
sudo su -
cd /usr/src/
tar xvf asterisk-16-current.tar.gz
cd asterisk-16*/
#Run the following command to download the mp3 decoder library into the source tree.
sudo contrib/scripts/get_mp3_source.sh
#Ensure all dependencies are resolved:
sudo contrib/scripts/install_prereq install
#Build and Install Asterisk from source
./configure
#Setup menu options by running the following command: Use arrow keys to navigate, and Enter key to select. On Add-ons select chan_ooh323 and format_mp3. 2nd On Core Sound Packages, select the formats of Audio packets. For Music On Hold, select the following minimal modules. On Extra Sound Packages select first 4.
make menuselect
#You can change other configurations you see fit. When done, save and exit then install Asterisk with selected modules:
make
make install
make samples
make config
ldconfig
#Create separate user and group to run asterisk services, and assign correct permissions:
sudo groupadd asterisk
sudo useradd -r -d /var/lib/asterisk -g asterisk asterisk
sudo chown -R asterisk.asterisk /usr/lib/asterisk
#Troubleshooting
#Test to see if you can connect to Asterisk CLI:
sudo asterisk -rvv
#Install FreePBX 15 on Ubuntu
#Or Install Apache, mariadb and php7.3
sudo apt install software-properties-commonsudo add-apt-repository ppa:ondrej/php
apt-get install apach
e2 mariadb-server libapache2-mod-php7.4 php7.4 php-pear php7.4-cgi php7.4-common php7.4-curl php7.4-mbstring php7.4-gd php7.4-mysql php7.4-bcmath php7.4-zip php7.4-xml php7.4-imap php7.4-json php7.4-snmp
#Then set options below:
sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig
sudo sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
sudo sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
#Change PHP maximum file upload size: For Ubuntu 20.04:
sudo sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/apache2/php.ini
sudo sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/cli/php.ini
#Download and Install FreePBX
cd /usr/src
sudo wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-16.0-latest.tgz
sudo tar xfz freepbx-16.0-latest.tgz
sudo rm -f freepbx-16.0-latest.tgz
cd freepbx
#Enable Apache Rewrite engine and restart apache2.
sudo a2enmod rewrite
sudo systemctl restart apache2
#If you have an active ufw firewall, open http ports and ports 5060,5061
sudo ufw enable
sudo ufw allow 5060
sudo ufw allow 5061
#That’s it!. You have a ready Asterisk 15 with FreePBX 15 on your Ubuntu server. Open up your web browser and connect to the ip_address_or_hostname/admin of your new FreePBX server.
Visit: http://ip_address_or_hostname/admin
@LinuxPlaner
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment