Learn how to – Install Ejabberd XMPP Server on CentOS 8 | RHEL 8.
How to install Ejabberd on CentOS 8 | RHEL 8?. Ejabberd is a free and open source XMPP server written in Erlang. Ejabberd has been designed for scalability and fault-tolerance. It has a small resource footprint and can run on any Unix like Operating system – Linux, FreeBSD, Solaris, macOS, OpenBSD, and others.
The default data store used by Ejabberd is Mnesia (the distributed internal Erlang database) but you can use SQL or NoSQL database server.
Features of Ejabberd XMPP Server
Ejabberd has a modular architecture which allows for high customisability and easy access to the required features, which includes:
- Store-and-forward (offline messages)
- Contact list (roster) and presence
- One-to-one messaging
- User presence extension: Personal Event Protocol (PEP) and typing indicator
- User profile with vCards
- Group chat: MUC (Multi-User Chat)
- Messaging archiving with Message Archive Management (MAM)
- Message Delivery Receipts (aka XEP-184)
- Privacy settings, through privacy list and simple blocking extensions
- Last activity
- Metrics and full command-line administration
- Full feature web support, with BOSH and web sockets
- Stream management for message reliability on mobile (aka XEP-0198)
and many many more.
Install Ejabberd XMPP Server on CentOS 8 | RHEL 8
Ejabberd is packaged as RPM file which can be easily downloaded and installed with rpm
package manager. If you have an ardor of compiling from source, do it.
Step 1: Update system
As usual, you need to work on updated system:
sudo yum -y update
Step 2: Download and Install Ejabberd RPM package
After the update, download the Ejabberd RPM package. You’ll need to check for the latest release before doing the actual download.
Install wget:
sudo yum -y install wget
Download ejabberd:
EJ_VERSION=23.01
wget https://static.process-one.net/ejabberd/downloads/${EJ_VERSION}/ejabberd-${EJ_VERSION}-1.x86_64.rpm
Install Downloaded RPM package by running the command:
sudo yum localinstall ejabberd-${EJ_VERSION}-1.x86_64.rpm
Agree to installation prompt.
Dependencies resolved.
=====================================================================================================================================================================================================
Package Architecture Version Repository Size
=====================================================================================================================================================================================================
Installing:
ejabberd x86_64 23.01-1 @commandline 18 M
Transaction Summary
=====================================================================================================================================================================================================
Install 1 Package
Total size: 18 M
Installed size: 29 M
Is this ok [y/N]: y
This will place ejabberd init script under /etc/init.d/ejabberd
- A system user called ‘ejabberd‘ is created
- ejabberd application directory is
/opt/ejabberd
. This is a home for the ejabberd user. - When ejabberd is started, the processes that are started in the system are
beam
orbeam.smp
, and alsoepmd
.
Step 3: Start Ejabberd service on CentOS 8 | RHEL 8
Now that we have done the installation, we need to start the service and enable it to start automatically when the server is rebooted.
Locate ejabberd.service
and copy it to /etc/systemd/system
sudo yum -y install mlocate
sudo updatedb
sudo cp $(locate ejabberd.service) /etc/systemd/system
Then reload systemd:
sudo systemctl daemon-reload
Once the new ejabberd service is detected, start it:
sudo systemctl enable --now ejabberd
You can confirm that the service is in running state.
$ systemctl status ejabberd
● ejabberd.service - XMPP Server
Loaded: loaded (/etc/systemd/system/ejabberd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-01-20 00:54:48 EAT; 4s ago
Process: 28813 ExecStart=/bin/sh -c /opt/ejabberd-21.12/bin/ejabberdctl start && /opt/ejabberd-21.12/bin/ejabberdctl started (code=exited, status=0/SUCCESS)
Tasks: 23 (limit: 4991)
Memory: 67.6M
CGroup: /system.slice/ejabberd.service
├─28842 /opt/ejabberd-21.12/bin/epmd -daemon
├─28843 /opt/ejabberd-21.12/bin/beam.smp -K true -P 250000 -- -root /opt/ejabberd-21.12 -progname /opt/ejabberd-21.12/bin/erl -- -home /opt/ejabberd -- -sname ejabberd@localhost -smp en>
├─28853 erl_child_setup 65536
└─28882 /opt/ejabberd-21.12/lib/os_mon-2.4.7/priv/bin/memsup
Jul 20 00:54:46 localhost.localdomain systemd[1]: Starting XMPP Server...
Jul 20 00:54:48 localhost.localdomain systemd[1]: Started XMPP Server.
Step 4: Create ejabberd XMPP admin account.
You need an admin XMPP account for accessing the Web Admin dashboard.
Change your working directory to cd /opt/ejabberd-${VER}/bin
cd /opt/ejabberd-*/bin
Add admin account:
Save username and password in variables.
username="myadmin"
password="mystrongPassword"
Create admin user.
$ sudo ./ejabberdctl register ${username} localhost ${password}
User myadmin@localhost successfully registered
You may need to replace localhost
with your actual server hostname. Other user accounts should be added in a similar manner.
# ./ejabberdctl register testuser localhost testuserpassword
Edit the ejabberd configuration file to give administration rights to the XMPP account you created /opt/ejabberd/conf/ejabberd.yml
$ sudo vi /opt/ejabberd/conf/ejabberd.yml
acl:
local:
user_regexp: ""
loopback:
ip:
- "127.0.0.0/8"
- "::1/128"
- "::FFFF:127.0.0.1/128"
admin:
user:
- "admin@localhost"
- "myadmin@localhost"
Restart ejabberd
service.
sudo systemctl restart ejabberd
Step 5: Configure firewall and Access UI
Allow Ejabberd UI port on the firewall.
sudo firewall-cmd --add-port=5280/tcp --permanent
sudo firewall-cmd --reload
The Web Admin should be accessible on http://ip-address:5280/admin/. Open the URL using your favorite browser. Login with myadmin@localhost
.
For further reading on Ejabberd administration, refer to the official documentation.
For Ubuntu/Debian users, you can install Ejabberd XMPP server using the guide:
Leave a Reply
You must be logged in to post a comment.