Knowledgebase

Question About Servers

Asterisk 22 LTS Installation Runbook Print

  • 0

Asterisk 22 LTS Installation Runbook

Target OS: Ubuntu 24.04 LTS
Target Asterisk Version: 22 LTS (current, uses chan_pjsip)
Context: Custom Asterisk install for clients requesting current LTS with PJSIP. Ubuntu's apt repo ships Asterisk 20 on 24.04, so we build from source.


Prerequisites

Before starting, confirm:

  1. VPS is freshly provisioned on Ubuntu 24.04 LTS
  2. You have root access (via soladrive user + sudo -i)
  3. The client's requested Asterisk version has been confirmed in the ticket
  4. Any special client instructions in the order notes have been reviewed

Phase 1: System Preparation and Security Hardening

1.1 Update system

apt update && apt upgrade -y

If prompted about modified config files (e.g., sshd_config), select "keep the local version currently installed".

1.2 Install essential tools

apt install -y wget curl git nano htop net-tools ufw fail2ban build-essential

1.3 Run SolaDrive security hardening

Use the current internal path for solasecurity. Confirm the correct URL in our internal docs before running. The hardening should apply:

  • SSH port changed to 2323
  • Root SSH login disabled
  • fail2ban configured
  • Standard soladrive user created with sudo access
  • UFW baseline rules applied

Verify SSH is on 2323 and you can connect from a second session BEFORE closing your existing session.

1.4 Reboot to load new kernel

reboot

Wait for the VPS to come back up, then reconnect via SSH on port 2323 as the soladrive user and sudo -i to root.


Phase 2: Install Asterisk Build Dependencies

2.1 Enable universe repo

add-apt-repository universe -y
apt update

2.2 Install build dependencies

apt install -y autoconf automake libtool pkg-config subversion unzip \
    libncurses5-dev libssl-dev libxml2-dev libsqlite3-dev uuid-dev \
    libjansson-dev libedit-dev libsrtp2-dev libspeex-dev libspeexdsp-dev \
    libogg-dev libvorbis-dev libasound2-dev portaudio19-dev \
    libcurl4-openssl-dev xmlstarlet bison flex python3-dev libnewt-dev \
    libusb-dev zlib1g-dev libresample1-dev libgsm1-dev libopenr2-dev \
    libradcli-dev freetds-dev libjack-jackd2-dev libbluetooth-dev \
    libbfd-dev libical-dev libneon27-dev liburiparser-dev libmariadb-dev \
    libmariadb-dev-compat libpq-dev unixodbc-dev libicu-dev libcap-dev \
    libcodec2-dev libfftw3-dev libsnmp-dev libcorosync-common-dev \
    libcpg-dev libcfg-dev

If any package fails to install, don't worry, the install_prereq script in Phase 3 will catch the remainder.


Phase 3: Build and Install Asterisk 22 LTS

3.1 Download the latest Asterisk 22 source

cd /usr/src
wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-22-current.tar.gz
tar -xzf asterisk-22-current.tar.gz
cd asterisk-22.*

3.2 Get MP3 source (for music on hold)

contrib/scripts/get_mp3_source.sh

3.3 Run install_prereq to catch remaining deps

contrib/scripts/install_prereq install

When prompted for country code for libvpb (telephony hardware), just accept the default (it's not used for SIP-only deployments).

3.4 Configure the build

./configure --with-pjproject-bundled --with-jansson-bundled

Confirm the configure step ends with the "Asterisk Build Complete" banner before continuing.

3.5 Run menuselect to disable chan_sip and enable PJSIP

make menuselect.makeopts

menuselect/menuselect --disable chan_sip menuselect.makeopts
menuselect/menuselect --enable chan_pjsip menuselect.makeopts
menuselect/menuselect --enable res_pjsip menuselect.makeopts
menuselect/menuselect --enable res_pjsip_session menuselect.makeopts
menuselect/menuselect --enable app_voicemail menuselect.makeopts
menuselect/menuselect --enable format_mp3 menuselect.makeopts

menuselect/menuselect --enable CORE-SOUNDS-EN-WAV menuselect.makeopts
menuselect/menuselect --enable CORE-SOUNDS-EN-GSM menuselect.makeopts
menuselect/menuselect --enable MOH-OPSOUND-WAV menuselect.makeopts
menuselect/menuselect --enable EXTRA-SOUNDS-EN-WAV menuselect.makeopts
menuselect/menuselect --enable EXTRA-SOUNDS-EN-GSM menuselect.makeopts

3.6 Build and install

# Use -j matching CPU count (SD-4 = 4 cores, SD-8 = 8 cores)
make -j$(nproc)
make install
make samples
make config
ldconfig

Expected compile time: 10 to 15 minutes on SD-4, 5 to 8 minutes on SD-8.


Phase 4: Create Asterisk User and Set Permissions

4.1 Create asterisk user and group

groupadd asterisk
useradd -r -d /var/lib/asterisk -g asterisk asterisk
usermod -aG audio,dialout asterisk

4.2 Set ownership on Asterisk directories

chown -R asterisk:asterisk /etc/asterisk
chown -R asterisk:asterisk /var/lib/asterisk
chown -R asterisk:asterisk /var/log/asterisk
chown -R asterisk:asterisk /var/spool/asterisk
chown -R asterisk:asterisk /usr/lib/asterisk

4.3 Configure Asterisk to run as the asterisk user

sed -i 's/#AST_USER="asterisk"/AST_USER="asterisk"/g' /etc/default/asterisk
sed -i 's/#AST_GROUP="asterisk"/AST_GROUP="asterisk"/g' /etc/default/asterisk

sed -i 's/;runuser = asterisk/runuser = asterisk/g' /etc/asterisk/asterisk.conf
sed -i 's/;rungroup = asterisk/rungroup = asterisk/g' /etc/asterisk/asterisk.conf

Phase 5: Firewall Rules for SIP/RTP

5.1 Configure UFW

# SSH on 2323 (should already be allowed from solasecurity)
ufw allow 2323/tcp

# SIP signaling
ufw allow 5060/udp
ufw allow 5060/tcp
ufw allow 5061/tcp

# RTP media (default Asterisk range)
ufw allow 10000:20000/udp

# Enable if not already enabled
ufw --force enable
ufw status verbose

Phase 6: Start Asterisk and Verify

6.1 Enable and start the service

systemctl enable asterisk
systemctl restart asterisk
systemctl status asterisk

6.2 Verify the installation

# Check version, should report 22.x.x
asterisk -rx "core show version"

# Confirm chan_pjsip is loaded
asterisk -rx "module show like chan_pjsip"
asterisk -rx "module show like res_pjsip"

# Confirm chan_sip is NOT loaded
asterisk -rx "module show like chan_sip"

# Show available channel types
asterisk -rx "core show channeltypes"

Expected result: chan_pjsip.so shows as "Running", res_pjsip.so shows as "Running", and chan_sip returns no loaded modules.

6.3 Final system checks

# Confirm Asterisk is listening on SIP ports
ss -tulnp | grep -E '5060|5061'

# Confirm Asterisk running as correct user
ps aux | grep asterisk | grep -v grep

# Check logs for errors
tail -50 /var/log/asterisk/full

Phase 7: Update Ticket and Hand Off

Update the client ticket with the following information:

  1. Asterisk version installed (from asterisk -rx "core show version")
  2. Confirmation that chan_pjsip is loaded and chan_sip is not
  3. SSH login details (IP, port 2323, soladrive user, password)
  4. Note that root is accessible via sudo -i
  5. Firewall ports that have been opened for SIP/RTP
  6. Confirmation that the server is ready for their dialplan and endpoint configuration

Update the client's service area in WHMCS with the updated login credentials.


Troubleshooting Quick Reference

Issue Check
make fails with missing header Rerun contrib/scripts/install_prereq install
PJSIP not loading Confirm build was configured with --with-pjproject-bundled
Asterisk won't start Check /var/log/asterisk/full and systemctl status asterisk
SIP port binding fails Check for port conflicts with ss -tulnp \| grep 5060
High CPU on calls Check codec settings, G.711 passthrough uses minimal CPU

Notes for Future Installs

 

  • Asterisk 20 LTS is also acceptable for clients who want a more conservative LTS. Same build process, just swap asterisk-22-current.tar.gz for asterisk-20-current.tar.gz.
  • Asterisk 23 is the current standard release as of April 2026 but not recommended for production.
  • Certified Asterisk (Sangoma commercial) is only available against 18 and 20 LTS codebases, not relevant for our self-managed installs.
  • Ubuntu 22.04 apt ships Asterisk 18, Ubuntu 24.04 apt ships Asterisk 20. For anything newer than 20, build from source.

Was this answer helpful?

« Back

Enterprise-Grade Hardware

  • Samsung
  • Juniper
  • Western Digital
  • Supermicro
  • LSI
  • Intel
  • R1Soft Backups
  • cPanel
  • MySQL
  • Parallels
  • HP Partner