How to install FreePBX on Arch Linux
This manual-install method builds a FreePBX system on a recent Arch Linux installation with the following specifications:
FreePBX 15
Asterisk compiled from AUR
Parts of these instructions are shared with How to Install FreePBX 15 on Debian 10 with Asterisk 16, PHP 7.3 .
Update system
pacman --noconfirm -SyuInstall required packages
pacman --noconfirm -Sy apache sudo nodejs wget base-devel git cmake unixodbc \ alsa-lib speex libvorbis jansson libxslt opus gsm \ ffmpeg libsamplerate libsrtp portaudio python swig dd \ mariadb cron sox
Create a user that will be used for compilation, set password and switch to this user
As a good security practice you will use the user until end of this manual. Commands that require root permissions are prepended with sudo.
useradd -s /bin/bash -m instuserecho "instuser ALL=(ALL) ALL" >>/etc/sudoers# set password for the userpasswd instusersu - instuser# make sure sudo workssudo -l# enter password for instuser# the output should be similar to this:
User instuser may run the following commands on YOURHOST: (ALL : ALL) ALL
Initialize and enable mariadb
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysqlsudo systemctl enable --now mysqld
Create a temporary helper function to compile and install package from AUR
function aur_install() { cd ~instuser/src rm "$1.tar.gz" wget "https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz" tar xvf "$1.tar.gz" cd $1 makepkg -i --noconfirm}
Install a supported PHP version
While installing current PHP from repositories may work but it's more likely that you'll start getting depreciation errors or other issues and will be force to install an older version - one option is to use AUR (if the PKGBUILD is available there):aur_install php73
Another way is to pull the older PKGBUILD from official repositories.# x86_64 archsudo pacman --noconfirm -S aspell c-client enchant gd net-snmp postgresql-libs tidy postfix freetds libsodiumcd ~instuser/srcmkdir php73 && cd php73git initgit config core.sparseCheckout truegit remote add -f origin git://git.archlinux.org/svntogit/packages.gitgit checkout $(git log --all --grep='php 7.3' --oneline -1 | awk '{print $1}')cd trunk/makepkg -i
# armsudo pacman --noconfirm -S aspell c-client enchant gd net-snmp postgresql-libs tidy postfix freetds libsodiumvisit https://archlinuxarm.org/packages/armv7h/php/log and get the PKGBUILD and patches manually of the supported PHP version. Then install usingmakepkg --skipinteg -i
Install more dependencies from AUR
aur_install mariadb-connector-odbcaur_install a2enmod-git
# pjproject requires approximately 2 GB of RAM to compile# so on light systems you may want to create temporary 4GB swap# file beforehand (otherwise compiler may get killed by OOM killer):# sudo dd if=/dev/zero of=swapfile bs=1024000 count=4096# sudo chmod 600 /swapfile# sudo mkswap /swapfile# sudo swapon /swapfileaur_install pjproject# if you had swapfile created, remove it now:# sudo swapoff /swapfile# sudo rm /swapfile
Compile and install asterisk
aur_install asterisk
Pay attention to Asterisk version matrix. If you need older asterisk: cd asterisk edit PKGBUILD (line with pkgver) makepkg -i --skipinteg
Configure and enable PHP and apache
echo "extension=pdo" | sudo tee -a /etc/php/conf.d/freepbx.iniecho "extension=pdo_mysql.so" | sudo tee -a /etc/php/conf.d/freepbx.iniecho "extension=gettext" | sudo tee -a /etc/php/conf.d/freepbx.iniecho "extension=sysvsem" | sudo tee -a /etc/php/conf.d/freepbx.inisudo sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/php.inisudo sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/php.inisudo sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.confsudo sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf# enable PHP in Apache per https://wiki.archlinux.org/index.php/Apache_HTTP_Server#Using_libphpsudo a2enmod rewritesudo systemctl enable --now httpd
Configure ODBC
cat <<EOF | sudo tee /etc/odbcinst.ini[MariaDB]Description = ODBC Driver for MariaDBDriver = /usr/lib/libmaodbc.soFileUsage = 1EOF
cat <<EOF | sudo tee /etc/odbc.ini[MySQL-asteriskcdrdb]Description = MySQL connection to 'asteriskcdrdb' databaseDriver = MySQLServer = localhostDatabase = asteriskcdrdbPort = 3306Socket = /run/mysqld/mysqld.sockOption = 3EOF
Install FreePBX
cd ~instuser/srcwget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgztar xvf freepbx-15.0-latest.tgzcd freepbx/sudo ./start_asterisk startps -ef | grep safe_asteris[k]sudo ./install -n --webroot=/srv/http
If you get a somewhat illogical error like: Checking if Asterisk is running and we can talk to it as the 'asterisk' user...Error! Unsupported Version of 17.0.0 Supported Asterisk versions: 13, 14, 15, 16, 17
edit install.php and installlib/installcommand.class.php files:
change: if (version_compare($engine_info['version'], "13", "lt") || version_compare($engine_info['version'], "17", "ge")) {
to if (version_compare($engine_info['version'], "13", "lt") || version_compare($engine_info['version'], "18", "ge")) {
and run sudo ./install -- again
You may need to do this change once more after installation in:/srv/http/admin/libraries/Console/Reload.class.php
Fix permissions
chown -R asterisk:asterisk /srv/http/chown -R asterisk:asterisk /var/log/asterisk/chmod 644 /srv/http
Get the rest of the modules
Only a very basic system is installed at this point. You will probably want to install all the modules. Alternatively, you can skip this and pick-and-choose the individual modules you want later.
sudo fwconsole ma installallsudo fwconsole ma delete firewallsudo fwconsole ma delete digium_phonessudo fwconsole r
Apply the current configuration
sudo fwconsole reload
Perform a restart to load all Asterisk modules that had not yet been configured
sudo fwconsole restart
Set up systemd (startup script)
cat <<EOF | sudo tee /etc/systemd/system/freepbx.service[Unit]Description=FreePBX VoIP ServerAfter=mariadb.service[Service]Type=oneshotRemainAfterExit=yesExecStart=/usr/sbin/fwconsole start -qExecStop=/usr/sbin/fwconsole stop -q[Install]WantedBy=multi-user.targetEOF
systemctl daemon-reloadsystemctl enable --now freepbx
Return to Documentation Home | Sangoma Support