Skip to content

Instantly share code, notes, and snippets.

@linuxbiekaisar
Created April 12, 2020 22:55
Show Gist options
  • Save linuxbiekaisar/38c2349a1deda1f2153f4f290b4a0ed8 to your computer and use it in GitHub Desktop.
Save linuxbiekaisar/38c2349a1deda1f2153f4f290b4a0ed8 to your computer and use it in GitHub Desktop.
How to install and configure Asterisk on Ubuntu 18.04 LTS
# Youtube:
# !/bin/sh
# Step-1: Download and Install Asterisk
# =====================================
# To install Asterrsk run run the commands below:
sudo apt update
sudo apt install wget build-essential subversion
cd /usr/src/
sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-17-current.tar.gz
# After downloading extract it and run the installation script
sudo tar zxf asterisk-17-current.tar.gz
cd asterisk-17.*/
sudo contrib/scripts/get_mp3_source.sh
sudo contrib/scripts/install_prereq install
# Now configure and perform some checks and validate that all is well.
sudo ./configure
# After that, you will need to select some modules to compile and install. Now select "format_mp3" from the appeared menu and press F12 for exiting:
sudo make menuselect
# When you’re all done, run the commands below to start compilation process.
sudo make -j2
# After compiling above, you can finally install Asterisk by running the commands below:
sudo make install
# You can now begin configuring your system.. First you may want to add some samples data to help you with configuring your platform. For that run the commands below:
sudo make samples
sudo make basic-pbx
# Finish the configuration by running the commands below:
sudo make config
sudo ldconfig
# Step 2: Creating Asterisk User
# ==============================
# For creating a dedicated user, run the follwoing commands.
sudo addgroup --quiet --system asterisk
sudo adduser --quiet --system --ingroup asterisk --no-create-home --disabled-password asterisk
# Now change two lines by uncommenting them:
sudo nano /etc/default/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"
# After that, add asterisk user to the dialout and audio groups:
sudo usermod -a -G dialout,audio asterisk
# Next, change permissions on all of Asterisk files and directory to make its users owner.
sudo chown -R asterisk: /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk
sudo chmod -R 750 /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk
# Step 3: Starting Asterisk
# ========================
# Run the commands below to enable and start Asterisk service
sudo systemctl enable asterisk
sudo systemctl start asterisk
# To verify that Asterisk is running, run the commands below:
sudo asterisk -vvvr
# Now Open the following port.
sudo ufw allow 5060/udp //SIP uses the UDP port 5060
sudo ufw allow 10000:20000/udp //For Real Time Protocol (RTP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment