Kannel SMPP server on Ubuntu

In this guide I’ll go through the steps to set up a Kannel SMPP server.

View the Kannel documentation.

Update packages
sudo apt update
sudo apt upgrade

Install Firewalld
sudo apt install firewalld

Start FirewallD service
sudo systemctl unmask firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld

Check status
sudo systemctl status firewalld

Install Nginx
sudo apt install nginx

Enable Nginx
sudo systemctl enable nginx
sudo systemctl start nginx

Check status
sudo systemctl status nginx

Open port 80 — the HTTP port — on your system’s firewall.
FirewallD is the front end typically used to manage firewall rules on AlmaLinux.
You can use the following commands to open port 80 and reload the rules so they take effect.
sudo firewall-cmd –zone=public –add-service=http
sudo firewall-cmd –zone=public –add-service=http –permanent
sudo firewall-cmd –reload

Install MySQL Server
sudo apt install mysql-server-8.0

Start the server
sudo systemctl enable mysql.service
sudo systemctl start mysql.service

Secure installation
sudo mysql_secure_installation

Open port 3306
sudo firewall-cmd –zone=public –add-service=mysql –permanent
sudo firewall-cmd –reload

Install PHP
sudo apt-get install php

Check Installed PHP Version
php -v

Install Dependencies for Kannel
sudo apt install curl git-core zip unzip flex debhelper docbook-xsl nano wget

sudo apt install build-essential libpcre3 libpcre3-dev libc6-dev g++ gcc autotools-dev bison libncurses5-dev m4 autoconf automake libtool pkg-config libpam0g-dev intltool

sudo apt install libxml2-dev openssl libssl-dev software-properties-common axel mysql-client libmysqlclient-dev php-fpm php-cli php-mysql php-gd php-imap php-curl php-xml php-mbstring tex-common texi2html texinfo texlive-base texlive-base-bin texlive-latex-base

sudo apt-get install subversion

Create kannel folder
sudo mkdir /usr/local/src/kannel
cd /usr/local/src/kannel

Download Kannel
sudo svn co https://svn.kannel.org/gateway/trunk

Rename gateway folder
sudo mv trunk gateway
cd gateway

Configure kannel
sudo ./bootstrap.sh
sudo ./configure –prefix=/usr/local/kannel –with-mysql –with-mysql-dir=/usr/lib/mysql/ –enable-debug –enable-assertions –with-defaults=speed –disable-localtime –enable-start-stop-daemon –enable-pam
sudo touch .depend
— sudo make depend
sudo make

Create dir for kannel
sudo mkdir /usr/local/kannel
sudo make bindir=/usr/local/kannel install

Change dir to root

Create directory to install Kannel SQLBox
sudo mkdir /usr/local/src/kannel/sqlbox
cd /usr/local/src/kannel/sqlbox
sudo cp -r /usr/local/src/kannel/gateway/addons/sqlbox/* ./
sudo ./configure –prefix=/usr/local/kannel –with-kannel-dir=/usr/local/kannel
sudo make
sudo make bindir=/usr/local/kannel/sqlbox install

Change dir to root

Create directory for Kannel SMPP box
sudo mkdir /usr/local/src/kannel/smppbox
cd /usr/local/src/kannel/smppbox
sudo cp -r /usr/local/src/kannel/gateway/addons/opensmppbox/* ./
sudo ./configure –prefix=/usr/local/kannel –with-kannel-dir=/usr/local/src/kannel/gateway/
sudo make bindir=/usr/local/kannel/smppbox install

Change dir to root

Install Kanenel SMPP box
sudo mkdir /etc/kannel
sudo mkdir /var/log/kannel
cd /var/log/kannel
sudo mkdir gateway smsbox wapbox smsc sqlbox smppbox
sudo chmod 755 /var/log/kannel
sudo cp /usr/local/src/kannel/gateway/gw/smskannel.conf /etc/kannel/kannel.conf
sudo cp /usr/local/src/kannel/gateway/debian/kannel.default /etc/default/kannel
sudo cp /usr/local/src/kannel/gateway/debian/kannel.init /etc/init.d/kannel
sudo cp /usr/local/src/kannel/sqlbox/example/sqlbox.conf.example /etc/kannel/sqlbox.conf
sudo cp /usr/local/src/kannel/smppbox/example/opensmppbox.conf.example /etc/kannel/opensmppbox.conf
sudo cp /usr/local/src/kannel/smppbox/example/smpplogins.txt.example /etc/kannel/smpplogins.txt
sudo chmod 777 /etc/init.d/kannel
sudo update-rc.d kannel defaults

Check port and password in conf
sudo nano /etc/kannel/kannel.conf

Open Port 13000
sudo firewall-cmd –zone=public –add-port=13000/tcp –permanent
sudo firewall-cmd –reload

Run Kannel bearer box
/usr/local/kannel/sbin/bearerbox -v 0 /etc/kannel/kannel.conf

Check in browser

Shutdown server