How to Install Asterisk on a Raspberry Pi?

Asterisk is a free and open source PBX to manage your calls automatically (perfect for a small business).
In this tutorial, I’ll show you how to install it on Raspberry Pi.

How to install Asterisk on Raspberry Pi?
Asterisk is an open-source software, so its source code is available directly.
The installation can be done like with any other software built from source.

The official website gives you the full documentation for everything, but in this post I will give you the short version, specifically for Raspberry Pi.


  • A Raspberry Pi: if possible a Raspberry Pi 4. The compilation is a very long process on an older model, and more power can be useful depending on what you’ll do with it.
  • Raspberry Pi OS: if you don’t have it yet on a SD card. The lite version is fine, as there is no graphical interface for Asterisk. (download here).
  • A basic SD card: if needed, you don’t need something expensive, Asterisk doesn’t require so much space. SanDisk basic model has excellent results for a cheap price (link here)

Asterisk installation

Raspbian installation

If you use a new SD card for Asterisk, you firstly need to install Raspberry Pi OS on it. As I already told you, the Lite version is perfect.
If you need a step-by-step tutorial on how to do this, you can check this one.

Once done, don’t forget to enable SSH and update your system before going further:
sudo apt update
sudo apt upgrade

As I will give you many commands to install and configure Asterisk, it’s better to copy and paste them from your computer directly.

Raspberry Pi Bootcamp
Sale: 10% off today.
Take it to the next level.
I'm here to help you get started on Raspberry Pi.
Learn all the skills you need in the correct order.

Download Asterisk

Note: Asterisk is available in the Raspberry Pi OS repository (sudo apt install asterisk), but it’s an older version.
It’s OK for a quick try, but I don’t recommend it in production.

All Asterisk downloads are available on this page.
The first link is for FreePBX, it’s a built-in Asterisk system with an interface to manage Asterisk, but there is no image for Raspberry Pi.
Then you have an offer for Switchvox, and finally the source code just under (Asterisk Communications Framework).
You can download a tarball or use git to download the latest version.

I’ll show you how to do this with Git, this way it will always be the latest version, but you can download the archive if you prefer:

  • Install git:
    sudo apt install git
  • The documentation recommends to build Asterisk from /usr/local/src, so we will do this:
    cd /usr/local/src
  • Then download the git repository files:
    sudo git clone asterisk

If you wonder what are DAHDI and LIBPRI on the official documentation, they are not required on Raspberry Pi.
DAHDI is an interface to manage interface cards (includes many drivers), but you probably don’t need it on Raspberry Pi.
LIBPRI is also not required, as it’s for ISDN interfaces.
As most of us will use asterisk as an IPBX with SIP and Internet, we don’t need them.

Asterisk installation

As for most software built from source, the first step is to check that you have all the Asterisk requirements installed

  • Go to the asterisk folder:
    cd /usr/local/src/asterisk
  • Install the prerequisites:
    sudo apt install libedit-dev sqlite3 libsqlite3-dev libjansson-dev libxml2-dev uuid-dev
  • Run the configure script, to check that you have all the requirements installed:
    sudo ./configure
    If there is any error, there is probably a package missing on your system.
    Use “apt search” to find the corresponding package and install it (feel free to leave a comment below if you find a package missing in my previous command on Raspberry Pi OS)
  • Then, you need to choose the features you want to use with menuselect:
    sudo make menuselect
  • A window like this shows up:

    Verify in each submenu that everything you need is checked.
    Press SPACE to select/unselect any option. Some of them are not unavailable if the corresponding package is not installed.

    If you don’t really know what you need, you can leave the default configuration.
    Press ESC and S once done to save and exit.
  • You can now run make to compile Asterisk:
    sudo make
    It may take more or less time depending on your Raspberry Pi model and the features you chose (15-20min on a Raspberry Pi 4 with the default configuration)
  • You can now use the following command to install all the files:
    sudo make install

That’s it, then you have a few commands that are not mandatory but recommended if you are new on Asterisk:

  • Installing sample files:
    sudo make samples
    The goal here is to start with a default configuration
    It will create all the files in the Asterisk folder for you (with many comments in it), so you don’t start from scratch
  • Installing initialization scripts:
    sudo make config
    I recommend doing this, it will add an initscript, to automatically start Asterisk on boot.
    It’s also useful to start or stop the server if needed.
  • Rotate log files:
    sudo make install-logrotate
    As we are on Raspberry Pi (so small disk space in general), it’s probably a good idea to do this.
    It will install a script that manages the log rotation.

At this step, the installation is done, and you can continue with the configuration part.

Asterisk service

Just in case you need it (probably), here are the commands you can use if you installed the initialization script:

  • Start Asterisk:
    sudo /etc/init.d/asterisk start
  • Stop Asterisk:
    sudo /etc/init.d/asterisk stop
  • Check the status:
    sudo /etc/init.d/asterisk status

I recommend checking the status before going further (and start the service if needed).
If it doesn’t work at this point with the default configuration, it’ll probably not work after your changes 🙂

If you don’t have the initialization script, you can start asterisk with:
sudo asterisk -gcv

Asterisk stops when you close your window or SSH connection (you can use a screen to keep it running in background)

Asterisk configuration

Files location

The asterisk configuration is located in /etc/asterisk
There are many files (119 in my test), so it’s difficult to explain in a few lines, but I will give you the more important later.

Just a quick note here, if you want to use or upload sounds in your configuration, they are located under /var/lib/asterisk/sounds.
By default, you’ll get only sounds in English, but many languages are available in menuselect if you need another one.

Master your Raspberry Pi in 30 days
Sale: 10% off today.
Download the eBook.
Uncover the secrets of the Raspberry Pi in a 30 days challenge.
Learn useful Linux skills and practice multiples projects.

Main configuration files

As I told you, you don’t need all the configuration files, so I give you here the more important ones and what they are:

  • sip.conf: In this file you need to configure your SIP accounts. SIP is a protocol to manage calls over the Internet. You need to find a provider (some are available for free like LinPhone), and see with them how to configure it on Asterisk.
  • users.conf: It’s the same thing for each user (=phone or softphone). If you use a softphone on your computer, you need to define the SIP account in this file (number and password at least). Check the file sample for an example.
  • extensions.conf: It’s the Asterisk’s brain. In this file, you manage what should happen when you receive or make a call. You can do a really short configuration that just make your phone ring when someone calls. Or do something more complicated, with opening hours, welcome message or several phones. It’s probably the most complicated file to understand when you start.

Basically, you don’t need to edit another file if you want a basic configuration.

Going further

I will not explain in details all the configuration here (let me know if you are interested, I can do a specific tutorial about this).
But you’ll find some help on this website:

And you’ll also find much help on other websites and forums, Asterisk is a really well-known product, with lots of users over the world.



That’s it, you now know how to install Asterisk on a Raspberry Pi.
It seems to work correctly on a Raspberry Pi 4, so it could be a good idea at home or in a small business.

I’m using it for years at work, with 70 people answering calls for our customer service. Not on a Raspberry Pi, but the load average stays very low, even with that number of simultaneous calls.
You can do everything you want with it, and once you understand how it works, it’s powerful and not so complicated, but the learning curve may take some times.
Let me know if you want more details about Asterisk, I really like this topic and will be pleased to great other tutorials on it (even if the configuration part is not really specific to the Raspberry Pi).

This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Patrick Fromaget

I'm the lead author and owner of My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with a web developer experience.

Recent Posts

Raspberry Pi Bootcamp - 10% off