Installing Ejabberd

In this recipe, we will learn how to install the Ejabberd XMPP server. We will be using an integrated installation package that is available from the Ejabberd download site. You can also install Ejabberd from the Ubuntu package repository, but that will give you an older, and probably outdated, version.

Getting ready

You will need an Ubuntu server with root access or an account with sudo privileges.

How to do it…

The following are the steps to install Ejabberd:

  1. Download the Ejabberd installer with the following command. We will be downloading the 64-bit package for Debian-based systems.
  2. Make sure you get the updated link to download the latest available version:
    $ wget https://www.process-one.net/downloads/downloads-action.php?file=/ejabberd/15.11/ejabberd_15.11-0_amd64.deb -O ejabberd.deb
    
  3. Once the download completes, you will have an installer package with the .deb extension. Use the dpkg command to install Ejabberd from this package:
    $ sudo dpkg -i ejabberd.deb
    
  4. When installation completes, check the location of the Ejabberd executable:
    $ whereis ejabberd
    
    How to do it…
  5. Now you can start the Ejabberd server, as follows:
    $ sudo /opt/ejabberd-15.11/bin/ejabberdctl start
    
  6. The start command does not create any output. You can check the server status with the ejabberdctl status command:
    $ sudo /opt/ejabberd-15.11/bin/ejabberdctl status
    
    How to do it…
  7. Now your XMPP server is ready to use. Ejabberd includes a web-based admin panel. Once the server has started, you can access it at http://server_ip:5280/admin. It should ask you to log in, as shown in the following screenshot:
    How to do it…
  8. The admin panel is protected with a username and password. Ejabberd installation creates a default administrative user account with the username and password both set to admin.

    Tip

    In older versions of Ejabberd, you needed to create an admin account before logging in. The Ejabberd configuration file grants all admin rights to the username admin. The following command will help you to create a new admin account:

    $ sudo ejabberdctl register_user admin ubuntu password
    
  9. To log in, you need a JID (XMPP ID) as a username, which is a username and hostname combination. The hostname of my server is ubuntu and the admin JID is admin@ubuntu. Once you have entered the correct username and password, an admin console will be rendered as follows:
    How to do it…

How it works…

Ejabberd binaries are available as a Debian package. It includes a minimum Erlang runtime and all other dependencies. You can download the latest package from the Ejabberd download page.

The installer unpacks all the contents at the /opt/ejabberd-version directory. You can get an exact location of the installation with the whereis command. All executable files are generally located under the bin directory. We will mostly be working with ejabberdctl, which is a command line administrative tool. It provides various options to manage and monitor Ejabberd installation. You can see the full list of supported options by entering ejabberdctl without any options.

The following screenshot shows the partial output of executing ejabberdctl without any options:

How it works…

Note

If the server is not running, you will only see options to start the server or launch a debug console.

If you have noticed, I am using sudo with each ejabberdctl command. You can avoid the use of the sudo command by switching to the ejabberd user, which is created at the time of Ejabberd installation. The installer creates a system user account, ejabberd, and sets its home directory to the Ejabberd installation directory, /opt/ejabberd-version. You will still need to use sudo to switch user accounts as the ejabberd user has no password set. Use the following command to log in as the ejabberd user:

$ sudo su ejabberd

In addition to creating the system user to run the Ejabberd process, the installer also creates an ejabberd admin account. The username and password for the administrator account is set to admin/admin. Make sure that you change this password before using your server in production. The installation process also creates a default XMPP host. The hostname is set to match your server hostname. It can be modified from the configuration file.

Once the server has started, you can access the handy web administrative console to manage most of the Ejabberd settings. You can add new users, create access control lists and set access rules, check the participating servers (node), and all hosted XMPP domains (host). Additionally, you can enable or disable Ejabberd modules separately for each domain. That means if you are using the same server to host xmpp1.example1.com and xmpp2.example2.com, you can enable a multi-user chat for xmpp1.example1.com and disable the same module for xmpp2.example2.com.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset