How to Install Metronome IM on OpenBSD

Metronome IM is an open-source instant messaging platform that provides real-time communication capabilities for individuals and organizations. It is a great tool for those who prefer self-hosted solutions and enhances privacy, security, and flexibility. In this tutorial, we will go through the installation process of Metronome IM on OpenBSD.

Prerequisites

  • A server running OpenBSD
  • Root access to the server
  • An internet connection

Step 1: Install Dependencies

The first step is to install the dependencies that are required for Metronome IM to run:

$ doas pkg_add lua \
    lua-cjson \
    lua-filesystem \
    lua-expat \
    lua-sec \
    lua-socket \
    lua-zlib \
    lua51 \
    readline

Step 2: Download and Install Metronome IM

Next, let's download and install Metronome IM:

$ doas mkdir /usr/local/metronome
$ doas cd /usr/local/metronome
$ doas ftp https://downloads.metronome.im/source/metronome-3.14.2.tar.gz
$ doas tar xvfz metronome-3.14.2.tar.gz
$ doas rm metronome-3.14.2.tar.gz
$ doas ln -fs /usr/local/metronome/metronome-3.14.2 /usr/local/metronome/current

Step 3: Create a Metronome User

Create a dedicated Metronome user for running the Metronome process:

$ doas useradd -mU metronome
$ doas usermod -L metronome

Step 4: Configure Metronome

Create the Metronome configuration file /usr/local/metronome/current/etc/metronome.cfg.lua:

$ doas cp /usr/local/metronome/current/etc/metronome.example.cfg.lua /usr/local/metronome/current/etc/metronome.cfg.lua

Change the configuration file /usr/local/metronome/current/etc/metronome.cfg.lua to reflect your environment:

admins = { "[email protected]" }

daemonize = true

network_backend = "poll"

pidfile = "/var/run/metronome/metronome.pid"

data_path = "/var/lib/metronome"

log_path = "/var/log/metronome"

ssl = {
  certificate = "/etc/ssl/private/fullchain.pem",
  key = "/etc/ssl/private/privkey.pem"
}

modules_enabled = {
    "roster";
    "saslauth";
    "tls";
}

c2s_require_encryption = true

s2s_secure_auth = false

s2s_secure_domains = {}

authentication = "internal_hashed"

storage = "internal"

allow_registration = false

Step 5: Enable Metronome Service

Create the systemd service file /etc/systemd/system/metronome.service:

$ doas vim /etc/systemd/system/metronome.service

Copy and paste the following service file content:

[Unit]
Description=Metronome XMPP Server
After=network.target

[Service]
ExecStart=/usr/local/metronome/current/bin/metronome
User=metronome
Group=metronome
Restart=always

[Install]
WantedBy=multi-user.target

Start the Metronome service:

$ doas systemctl enable metronome
$ doas systemctl start metronome

Step 6: Verify the Installation

Check the status of the Metronome service and verify that it is running successfully:

$ doas systemctl status metronome

You should see the following output:

● metronome.service - Metronome XMPP Server
   Loaded: loaded (/etc/systemd/system/metronome.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-11-10 14:30:17 CST; 5s ago
 Main PID: 71060 (metronome)
    Tasks: 11 (limit: 44436)
   Memory: 8.0M
   CGroup: /system.slice/metronome.service
           └─71060 /usr/local/metronome/current/bin/metronome

Nov 10 14:30:17 openbsd systemd[1]: Started Metronome XMPP Server.

Conclusion

Congratulations, you have successfully installed and configured Metronome IM on OpenBSD. You can now start using it to communicate with your peers and colleagues.