install asterisk on raspberry pi

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.

Asterisk can be installed on Raspberry Pi OS with the package manager (or “sudo apt install asterisk”), but the latest version is only available with the source archive from

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.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.


  • 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

Here are the required steps to install Asterisk on a Raspberry Pi :

  • Install and update Raspberry Pi OS.
  • Download the Asterisk tarball from the official website.
  • Extract the files and compile the source code.
  • Install Asterisk with the default configuration files.

I’ll explain each step in the next sections.

Raspberry Pi OS 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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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.

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.

Join Our Community!

Connect, learn, and grow with other Raspberry Pi enthusiasts. Support RaspberryTips and enjoy an ad-free reading experience. Get exclusive monthly video tutorials and many other benefits.

Learn more

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.

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.

Asterisk installation

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

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
  • 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 in the community 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.

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.
    Asterisk is compatible with any SIP phone, I have used a lot of this brand in the past with great results if you are looking for one (Amazon).
  • 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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now


Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.


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 time.
Let me know if you want more details about Asterisk, I really like this topic and will be pleased to do other tutorials on it (even if the configuration part is not really specific to the Raspberry Pi).

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts


  1. OK, I guess this software is supposed to answer phone calls but how?
    What hardware is needed? That should have been part of your article for those of us who never heard of Asterisk before.

    1. Hi,

      As explained in the tutorial, the goal was to try installing Asterisk on a Raspberry, not to explain the whole thing.
      But to give you an idea, you don’t need any hardware.
      You need two things once installed:
      – a SIP provider
      – a softphone to answer calls on your PC or smartphone (3CX, Zoiper, …). You can also use an IP phone if you prefer (examples on Amazon:

  2. Hi Patrick
    Thank for the article.
    My main use for a RasPBX would be to take messages and record calls automatically on my home POTS.
    I have a USR5367 voice modem intended for this purpose.
    Is this project doable, and if so can you offer advice?

  3. Hi!, sorry Sr. but can i ask you what the specs of your server when you say that your system was supporting that 70 people on calls ? , just for me to take an example of the hardware needed.

    1. Hi,
      It’s a small virtual machine.
      2vCPU/2Go RAM, load average near 0 almost all the time, doesn’t require so much.

  4. Congratulations. beautiful article.
    When I run this “sudo /etc/init.d/asterisk start” command I get this “ERROR: /usr/sbin/asterisk not found” error message

    1. Try “sudo service asterisk start” maybe.
      If it doesn’t work, make sure you have done all the commands after the installation.

Comments are closed.