Asterisk Installation & Setup on Ubuntu (Beginner-Friendly Tutorial)

Published On: July 27, 2025
Follow Us
Asterisk

✅ Requirements:

  • Ubuntu 20.04 or 22.04 (works on most recent LTS versions)
  • Root or sudo access
  • Basic Linux command-line knowledge

🥇 Step 1: Update the System

sudo apt update && sudo apt upgrade -y

🥈 Step 2: Install Dependencies

sudo apt install -y build-essential git wget subversion \
libxml2-dev libncurses5-dev uuid-dev libjansson-dev \
libssl-dev libsqlite3-dev

🥉 Step 3: Download and Compile Asterisk

cd /usr/src
sudo git clone -b 20 https://github.com/asterisk/asterisk.git
cd asterisk
sudo contrib/scripts/install_prereq install
sudo ./configure
sudo make menuselect
  • In menuselect, you can choose modules like res_srtp, chan_sip, pjproject, etc.
  • Press Save & Exit

Then compile and install:

sudo make -j$(nproc)
sudo make install
sudo make samples
sudo make config
sudo ldconfig

🏁 Step 4: Start Asterisk

sudo systemctl start asterisk
sudo systemctl enable asterisk

Test the CLI:

sudo asterisk -rvvv

📁 Key Configuration Files

FileDescription
/etc/asterisk/sip.confSIP user/peer configuration
/etc/asterisk/extensions.confDialplan logic
/etc/asterisk/voicemail.confVoicemail settings
/var/log/asterisk/Log files
/var/lib/asterisk/sounds/Default sounds

☎️ Simple Example: Adding Two SIP Extensions

sip.conf

[general]
context=default
bindport=5060
bindaddr=0.0.0.0

[1000]
type=friend
secret=pass1000
host=dynamic
context=internal

[1001]
type=friend
secret=pass1001
host=dynamic
context=internal

extensions.conf

[internal]
exten => 1000,1,Dial(SIP/1000)
exten => 1001,1,Dial(SIP/1001)

🧪 Test It

  1. Use Zoiper, Linphone, or MicroSIP on two PCs/phones.
  2. Register accounts 1000 and 1001.
  3. Call from one to the other.

📚 Further Learning Resources


Would you like a tutorial for:

  • 🧱 FreePBX (GUI for Asterisk)?
  • 📞 Asterisk with WebRTC?
  • ☁️ Hosting on a cloud VPS?

sapan singh

Sapan Singh is the founder of bluelog.in, where he combines his passion for web development with his love for sharing knowledge. With a strong academic background in BCA and MCA, Sapan specializes in creating dynamic, user-friendly websites and applications that cater to the unique needs of clients and their audiences. Beyond development, Sapan is dedicated to staying ahead of the curve by constantly learning new technologies and trends. As a blogger, he shares his insights and experiences, helping others navigate the ever-evolving world of web development. His journey is one of continuous innovation, learning, and contributing to the tech community

Join WhatsApp

Join Now

Join Telegram

Join Now

Related Posts

Leave a Comment