Skip to main content
Insights

Complete Guide for FreePBX: A Step-by-Step Guide to Getting Started 2025

Table of Contents <strong>What is FreePBX?</strong> <strong>Key Features of FreePBX</strong> <strong>Installing FreePBX</strong> <strong>Configuring FreePBX for First-Time Use</strong> <strong>Installing FreePBX 17 on CentOS 9 with Asterisk 21</strong> <strong>Advanced Features and Customization</strong> <strong>Benefits of Using FreePBX</strong> <strong>Conclusion</strong>In today’s digital world, communication plays a vital role in business success. Companies are looking for cost-effective, reliable, and scalable telephony […]

Shiva 7 min read Updated Feb 16, 2025
Complete Guide for FreePBX A Step-by-Step Guide to Getting Started
Apps 1,325 words
Technical article

In today’s digital world, communication plays a vital role in business success. Companies are looking for cost-effective, reliable, and scalable telephony solutions. Enter FreePBX—an open-source Private Branch Exchange (PBX) system that enables businesses to manage their communication efficiently without breaking the bank.

This guide is designed to help beginners set up their first FreePBX system. Whether you’re a small business owner or an IT enthusiast, you’ll learn the basics of FreePBX, its installation, configuration, and key features.

What is FreePBX?

Understanding FreePBX and Asterisk

FreePBX is a Graphical User Interface (GUI) for managing Asterisk, the most widely used open-source PBX software. Asterisk serves as the core engine that enables VoIP calling, while FreePBX simplifies the process with a user-friendly interface.

How it works:

  • Connects multiple phone lines within a business.
  • Routes internal and external calls efficiently.
  • Integrates with VoIP services for cost-effective communication.

What is FreePBX

Key Features of FreePBX

FreePBX offers a host of features that make it a powerful alternative to traditional phone systems:

  • Web-Based Administration: Easy-to-use dashboard for managing extensions, call routing, and settings.
  • IVR (Interactive Voice Response): Automate customer interactions with pre-recorded messages and menu options.
  • Voicemail-to-Email: Receive voicemail messages directly in your inbox.
  • Call Recording: Monitor and analyze calls for training or compliance.
  • Call Routing & Queues: Handle calls efficiently by directing them to the right departments.
  • Firewall & Security Features: Protect your phone system from unauthorized access.

Installing FreePBX

System Requirements

Before installing FreePBX, ensure your system meets the following requirements:

  • Server Requirements: Dual-core processor, 2GB RAM, 30GB storage.
  • Operating System: CentOS-based FreePBX Distro (recommended).
  • Internet Connection: Required for updates and VoIP setup.

Step-by-Step Installation Guide

  1. Download FreePBX Distro from the official website.
  2. Create a Bootable USB Drive using software like Rufus.
  3. Boot from USB & Install FreePBX following on-screen instructions.
  4. Configure Network Settings to assign a static IP.
  5. Access Web Interface by navigating to http://your-server-ip.
  6. Create Admin Account and log into the FreePBX dashboard.

Configuring FreePBX for First-Time Use

Setting Up Extensions

  1. Navigate to Applications > Extensions.
  2. Click Add Extension and select SIP.
  3. Assign a unique extension number and set a password.
  4. Save and apply changes.

Configuring VoIP Trunks

  1. Go to Connectivity > Trunks.
  2. Add a new SIP Trunk.
  3. Enter provider details (username, password, domain).
  4. Save and apply configuration.

Setting Up Call Routing

  1. Go to Connectivity > Inbound Routes.
  2. Define DID and Caller ID settings.
  3. Set destination (e.g., IVR or extension).
  4. Save and apply changes.

Installing FreePBX 17 on CentOS 9 with Asterisk 21

This comprehensive guide covers all steps from prerequisites to setting up extensions and SIP trunks on FreePBX 17 with Asterisk 21 on CentOS 9.

Prerequisites

First, update your system and install required packages:

dnf update -y

dnf groupinstall "Development Tools" -y

dnf install epel-release -y

dnf install wget vim git unzip net-tools -y

dnf install firewalld -y

dnf install mariadb mariadb-server mariadb-devel -y

dnf install httpd -y
  1. dnf install nodejs -y

    1. Installing PHP 8.2

dnf module reset php -y

dnf module enable php:8.2 -y

dnf install php php-cli php-mysqlnd php-xml php-mbstring php-json \

    php-process php-posix php-pecl-imagick php-pdo php-opcache \

    php-curl php-pear php-bcmath -y

php -v

Expected output should show PHP 8.2.x.

  1. Firewall Configuration

systemctl start firewalld

systemctl enable firewalld

firewall-cmd --permanent --add-service={http,https}

firewall-cmd --permanent --add-port={5060,5061,5160,5161,10000-20000}/udp

firewall-cmd --permanent --add-port={5038,5039}/tcp

firewall-cmd --reload
  1. Database Setup (MariaDB)

Enable and secure MariaDB:

systemctl enable mariadb --now

mysql_secure_installation

During the security configuration:

  • Set root password when prompted
  • Answer ‘Y’ to all security questions

Create databases and user for FreePBX:

mysql -u root -p

CREATE DATABASE asterisk CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE DATABASE asteriskcdrdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE USER 'asterisk'@'localhost' IDENTIFIED BY 'YourStrongPassword';

GRANT ALL PRIVILEGES ON asterisk.* TO 'asterisk'@'localhost';

GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO 'asterisk'@'localhost';

FLUSH PRIVILEGES;

EXIT;

Replace ‘YourStrongPassword’ with a secure password.

  1. Installing Asterisk 21

cd /usr/src

wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-21-current.tar.gz

tar xvf asterisk-21-current.tar.gz

cd asterisk-21*/

contrib/scripts/get_mp3_source.sh

contrib/scripts/install_prereq install

./configure --libdir=/usr/lib64 --with-pjproject-bundled --with-jansson-bundled

make menuselect

In menuselect, ensure these essential modules are selected:

  • format_mp3
  • codec_opus
  • codec_g722
  • app_voicemail
  • app_queue
  • chan_pjsip
  • res_pjsip
  • cdr_mysql
  • res_http_websocket
  • app_confbridge
  • res_parking
  • res_timing_timerfd

Save with ‘s’ and exit with ‘q’.

Continue installation:

make -j$(nproc)

make install

make samples

make config

ldconfig
  1. User and Permissions Setup

groupadd asterisk

useradd -r -d /var/lib/asterisk -g asterisk asterisk

usermod -aG audio,dialout asterisk

chown -R asterisk:asterisk /etc/asterisk

chown -R asterisk:asterisk /var/{lib,log,spool}/asterisk

chown -R asterisk:asterisk /usr/lib64/asterisk

echo "/usr/lib64" >> /etc/ld.so.conf.d/x86_64-linux-gnu.conf

ldconfig
  1. ODBC Configuration for CDR

Create ODBC configuration files:

cat <<EOF > /etc/odbcinst.ini

[MySQL]

Description = ODBC for MySQL (MariaDB)

Driver = /usr/lib64/libmyodbc.so

FileUsage = 1

EOF

 

cat <<EOF > /etc/odbc.ini

[MySQL-asteriskcdrdb]

Description = MySQL connection to 'asteriskcdrdb' database

Driver = MySQL

Server = localhost

Database = asteriskcdrdb

Port = 3306

Socket = /var/lib/mysql/mysql.sock

Option = 3

EOF
  1. Installing FreePBX 17

cd /usr/src

wget https://mirror.freepbx.org/modules/packages/freepbx/freepbx-17.0-latest.tgz

tar xvf freepbx-17.0-latest.tgz

cd freepbx

./start_asterisk start

./install -n

Set permissions:

chown -R asterisk:asterisk /var/www/html

chown -R asterisk:asterisk /etc/freepbx

chown -R asterisk:asterisk /var/lib/asterisk

chown -R asterisk:asterisk /var/spool/asterisk

chown -R asterisk:asterisk /usr/lib64/asterisk
  1. Apache and PHP Configuration

sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini

sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php.ini

sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf

sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf

systemctl restart httpd
  1. Installing FreePBX Modules

fwconsole ma installall

fwconsole reload

fwconsole restart
  1. Setting up FreePBX Service

Create systemd service file:

cat <<EOF > /etc/systemd/system/freepbx.service

[Unit]

Description=FreePBX VoIP Server

After=mariadb.service

[Service]

Type=oneshot

RemainAfterExit=yes

ExecStart=/usr/sbin/fwconsole start -q

ExecStop=/usr/sbin/fwconsole stop -q

[Install]

WantedBy=multi-user.target

EOF

 

systemctl enable freepbx

systemctl start freepbx

Additional Security Recommendations

  1. Change default SIP ports
  2. Implement fail2ban for SIP protection
  3. Use strong passwords for extensions
  4. Enable firewall rate limiting
  5. Use TLS for SIP connections
  6. Regularly update system and FreePBX

Troubleshooting Tips

  1. Check logs at /var/log/asterisk/full
  2. Verify SIP registration status with asterisk -rx ‘pjsip show registrations’
  3. Monitor real-time calls with asterisk -rx ‘core show channels’
  4. Check FreePBX module status with fwconsole ma list

Installation Complete!

✅ FreePBX 17 + Asterisk 21 is now installed on CentOS 9 ✅ SIP, extensions, call recording, voicemail, and call queues are ready ✅ Access the FreePBX admin interface at http://YOUR_IP/

Remember to:

  1. Change the default admin password
  2. Configure system backup
  3. Set up proper NTP synchronization
  4. Configure email settings for voicemail
  5. Test all features before production use

Advanced Features and Customization

Implementing IVR (Interactive Voice Response)

  • Navigate to Applications > IVR.
  • Create a new IVR with menu options (e.g., Press 1 for Sales, 2 for Support).
  • Define actions for each option.
  • Save and test.

Enhancing Security

  • Enable Fail2Ban to prevent brute-force attacks.
  • Use strong passwords for SIP accounts.
  • Regularly update FreePBX and Asterisk.

Benefits of Using FreePBX

Cost Savings

With FreePBX, businesses can significantly reduce communication costs by using VoIP services instead of traditional phone lines.

Scalability

FreePBX supports unlimited extensions, allowing businesses to scale as they grow.

Flexibility

It integrates with third-party applications like CRM software, making it an adaptable solution for different industries.

Conclusion

FreePBX is a robust and flexible VoIP PBX system that offers businesses a cost-effective alternative to traditional telephony. With its user-friendly interface and powerful features, it’s an excellent choice for companies looking to improve their communication infrastructure. Start your FreePBX journey today and experience the power of open-source telephony!

Ready to set up your own FreePBX system? Start today and streamline your business communications!

Questions answered

Frequently asked questions.

Answers connected directly to this article and its subject.

01 Is FreePBX free to use?

Yes, FreePBX is open-source, but certain commercial modules are available for additional features.

02 Can FreePBX work with traditional phone lines?

Yes, by using analog or digital gateway devices.

03 Is FreePBX secure?

Yes, but it requires proper configuration, including firewall rules and strong passwords.

04 What’s the difference between FreePBX and Asterisk?

Asterisk is the telephony engine, while FreePBX provides a GUI for easier management.

05 Can I use FreePBX on the cloud?

Yes, FreePBX can be deployed on cloud services like AWS or DigitalOcean.

Shiva
Written by

Shiva

Engineering context

Research is useful when it survives contact with the system.

Explore implementation work, production systems and case studies from FireXCore.