In this tutorial we are using the 64 bit deb package
Step 1: Download ejabberd
Download the deb package from https://www.process-one.net/en/ejabberd/downloads/
OR alternatively, use wget to download
wget https://www.process-one.net/downloads/downloads-action.php?file=/ejabberd/17.01/ejabberd_17.01-0_amd64.deb
Now rename the package as follows:
mv downloads-action.php?file=%2Fejabberd%2F17.01%2Fejabberd_17.01-0_amd64.deb ejabberd_17.01-0_amd64.deb
Step 2: Backup ejabberd
If you are doing a fresh install, you can jump to Step 3. If you are upgrading ejabberd, take a backup of your database using the following command:
/opt/ejabberd-xx.xx/bin/ejabberdctl backup ejabberd.backup
where xx.xx is your current ejabberd version.
- Make a copy of the backup file and the conf folder. They will be located in /opt/ejabberd-xx.xx/database/ and /opt/ejabberd-xx.xx/conf respectively.
- Stop ejabberd node
When upgrading, also check the upgrade process from https://docs.ejabberd.im/admin/upgrade/
Note: Make sure you have the necessary backups before installing the new version.
Step 3: Install ejabberd
Install ejabberd using the following command:
dpkg -i ejabberd_17.01-0_amd64.deb
Ejabberd will be installed in the /opt folder, so change your directory to this folder.
cd /opt/ejabberd-17.01
To check if installation was successful, you should have the following folders
bin, conf, database, doc, lib and logs.
Step 4: Installing SSL Certificates
If you are using a server for production, you will need to install SSL certificates.
- Generating a Certificate Signing Request with key. This will generate two files, the csr file and the server key. Using openssl command, you can generate the two files. This will prompt you to enter information that will be incorporated into your certificate request.
openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr
- Submit your CSR file to a any CA. You use any CA for this.
- After you receive the certificates from your CA, you need to create a pem file for ejabberd. You will have to follow concatenate according to the following order:
- Your domain certificate
- The ca certificate
- Your private key file
We do this using cat command as follows, in the order mentioned above:
cat yourdomain.crt > server.pem cat ca_intermediate.crt >> server.pem cat server.key >> server.pem
- Copy the server.pem file to ejabberd conf folder
Step 5: Edit the configuration file
Configure your server using a text editor. Some of the configurations are pre-configured, however you will need to make some changes which are relevant to your requirements.
Lets configure our server:
vi /opt/ejabberd-17.01/conf/ejabberd.yml
a) Configure hosts (domain names served by ejabberd not to be confused with the ejabberd node name)
hosts:
... - "yourhostname" ...
b) Configure your admin user, For e.g, In the ACL section, you configure your admin user
... admin: user: - "admin@yourhostname" ...
For a complete list of configurations, check the documentation at https://docs.ejabberd.im/admin/configuration/
Step 6: Start the server
Start ejabberd using the following command:
/opt/ejabberd-17.01/bin/ejabberdctl start
You can check the status of ejabberd using the following command:
/opt/ejabberd-17.01/bin/ejabberdctl/ejabberdctl status
Step 7: Add users
Now that you have configured your server, you will need to add some users to the server.
For e.g, we will create the admin user, using the following command:
/opt/ejabberd-17.01/bin/ejabberdctl register admin yourhostname adminpassword
replacing yourhostname and adminpassword with yours
Step 8: Open web console
Open web admin console in browser
http://yourip:5280/admin/
or
https://yourip:5281/admin/
Note: For https you will also need to configure the listener in the configuration file.
Enter your credentials using username admin@yourhostname and the password you entered while creating the admin user
If everything went fine, you should see the web console. If your server does not start you can check the logs in the log folder within the ejabberd installation folder.
You can use the following command to check if you have any errors while starting the server.
ejabberdctl debug
P.S:
If you opt for a different database other than mnesia
Follow the steps in https://docs.ejabberd.im/admin/guide/databases/mysql/
Hi,
How to change the default mnesia db to mysql?
LikeLike
Just add the database details in your configuration file. Should look something like:
sql_type: mysql
sql_server: “server.company.com”
sql_port: 3306 # the default
sql_database: “mydb”
sql_username: “user1”
sql_password: “**********”
You can add the module option db_type: sql or set default_db: sql globally if you want to use SQL for all modules.
You can check the details here
LikeLike
Hi, What must be the configuration changes to run ejabberd on my local host on 127.0.0.1? Please help.
LikeLike
For a single instance (node), you can you use the default configuration. However, keep in mind that XMPP provides virtual hosting. So you can have different virtual hosts on the same instance. For e.g, in the hosts config you can provide your domain as follows:
hosts:
- "xmpp.yourdomain.org"
and for the admin account of that domain as follows:
...
acl:
##
## The 'admin' ACL grants administrative privileges to XMPP accounts.
## You can put here as many accounts as you want.
##
admin:
user:
- "admin@xmpp.yourdomain.org"
...
If you have a cluster, then you may want to explicitly provide a name different instances (ejabberd node) as ejabberd@node1, ejabberd@node2, etc. By default your local single instance will be on a single node (localhost) as ejabberd@localhost. You can configure this in ejabberdctl.cfg. You will find an option as follows:
#...
#' ERLANG_NODE: Erlang node name
#...
# Default: ejabberd@localhost
#
#ERLANG_NODE=ejabberd@localhost
...
Here you can change the default node name.
You can find more in this documentation.
LikeLike