NextGenSwitch Installation & Setup Guide


This guide explains how to install and configure NextGenSwitch. The process includes preparing your system, installing dependencies, setting up the web and database environment, configuring the application, and running the installer.

System Preparation

Before beginning the installation, ensure that

  • You have root user access or a user with sudo privileges.
  • The operating system is one of the supported distributions, such as RHEL, CentOS, Rocky Linux, AlmaLinux (version 8 or newer).

System Requirements

Operating System
  • A 64-bit version of Linux (RHEL/CentOS/Rocky/AlmaLinux – version 8 or newer).
Software Stack
  • Web Server: Apache (version 2.4 or newer)
  • Database Server: MariaDB (version 10.3 or newer)
  • PHP: Version 8.1 or higher
  • Composer: PHP dependency manager
  • Redis: For caching and queue processing
  • Supervisor: For managing background workers
  • Sox & LAME: For handling audio processing
Required PHP Extensions

Ensure the following PHP extensions are installed and enabled.

  • bcmath
  • cli
  • common
  • curl
  • intl
  • mbstring
  • pdo
  • zip
  • redis
  • xml

Install Required Packages

  • Web server software (such as Apache)
  • PHP and the necessary extensions
  • MariaDB (or MySQL) server
  • Redis server
  • Composer
  • Sox and LAME for audio file processing
  • Supervisor for managing Laravel queue workers

Use your operating system’s package manager to install these. Ensure all services (web server, database server, Redis, Supervisor) are started and enabled to run at boot.

Download NextGenSwitch project

Clone the NextGenSwitch source code from the official repository and place it in your web server’s root directory. You will also need to unzip the required storage files

cd /var/www/html
sudo git clone https://github.com/nextgenswitch/nextgenswitch.git easypbx
cd easypbx
unzip storage.zip

Install NextGenSwitch RPM Package

NextGenSwitch provides a pre-built package for system integration. Install it using your system’s package installer. The installation package can be found at the following location /var/www/html/easypbx/setup/nextgenswitch-1.0-1.el8.noarch.rpm

dnf install -y setup/nextgenswitch-1.0-1.el8.noarch.rpm

Set Up Permissions

  • Create a dedicated system user (nextgenswitch) for NextGenSwitch.
  • Assign ownership of the application directory to this user.
  • Ensure correct file and directory permissions are set to allow the web server and PHP to read/write as needed.
  • If your system uses SELinux, adjust the security contexts accordingly.
  • Create symbolic links for audio and storage directories to ensure proper access paths.

Configure the Firewall

  • Stop and disable the default firewall if necessary.
  • Install and configure iptables for rule-based access control.
  • Apply the provided iptables rule file (setup/iptables-rules) for the system to accept necessary connections (SIP, HTTP, etc.).

Application Environment Setup

  • Copy the .env.example to .env
  • Install application dependencies using Composer.
  • Generate the application encryption key.
composer install 
php artisan key:generate

Database Setup

Before installing NextGenSwitch, a properly configured database environment is required. This includes creating a dedicated database and a user with appropriate privileges

Create the Database

Begin by creating a new database that will be used exclusively by NextGenSwitch.

CREATE DATABASE easypbx CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Create a Database User

Next, create a dedicated database user that will be used by the application to interact with the database. This user should have a strong password and be granted only the necessary privileges on the NextGenSwitch database.

Example (for reference only)

  • Database Name: easypbx
  • Username: easypbx
  • Password: easypbx
CREATE USER 'easypbx'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON easypbx.* TO 'easypbx'@'localhost';
FLUSH PRIVILEGES;

Replace your_password with a secure password of your choice.

Run Installation Command

This command initializes the system, sets up the required configurations and prepares services like the web server and Supervisor for background job processing.

php artisan easypbx:install \
    --db-host=localhost \
    --db-port=3306 \
    --db-user=easypbx \
    --db-pass=easypbx \
    --db-name=easypbx
  • --db-host: The hostname or IP address of the database server (typically localhost).
  • --db-port: The port number used by the database server (default is 3306 for MySQL/MariaDB).
  • --db-user: The database username created for the application.
  • --db-pass: The corresponding password for the database user.
  • --db-name: The name of the database created for NextGenSwitch.

Please modify the database configuration parameters to match your specific database credentials and setup

Modify the nextgenswitch.conf Apache configuration file as needed, based on your server’s environment and operating system-specific directory structure.

Restart Services

Restart all necessary services to ensure the application runs properly and all components are loaded with the latest configurations.

Create Super Admin User

Use the built-in command to create a superadmin user for accessing the NextGenSwitch web interface.

php artisan easypbx:setup

Once the setup is complete

  • Open your browser and visit the server’s IP or domain name.
  • Log in using the superadmin credentials you created.