How to Install Prosody IM on Ubuntu Server Latest?
In this tutorial, we will be installing Prosody IM on Ubuntu Server latest version. Prosody is a lightweight and powerful XMPP server written in Lua. It is easy to set up and manage, offers good security and performance, and provides a flexible and extensible platform for building XMPP-based applications.
Prerequisites
Before we begin with the installation process, make sure that you have a few things ready.
- A Server running Ubuntu 20.04 LTS
- A non-root user with sudo privileges
- A SSH Terminal Client like Putty, Secure CRT, etc.
Step 1: Update the System
Before installing any package or software, ensure that your system is updated. For that, run the following command:
sudo apt update && sudo apt upgrade -y
Step 2: Install Dependencies
To install dependencies, run the below command:
sudo apt-get install lua5.2 liblua5.2-dev lua-socket lua-sec luarocks
Step 3: Download and Install Prosody
To download Prosody IM:
wget https://prosody.im/files/prosody-0.11.9.tar.gz
Unpack the tarball with the following command:
tar -zxvf prosody-0.11.9.tar.gz
Change to the Prosody directory:
cd prosody-0.11.9
Then, compile and install with the following command:
./configure && make && sudo make install
Step 4: Configure Prosody
To configure Prosody, create a new file /etc/prosody/prosody.cfg.lua and add the following configuration:
admins = { "admin@your_domain.com" }
modules_enabled = {
"roster"; -- Allow users to have a roster. Recommended ;)
"saslauth"; -- Authentication for clients and servers. Recommended ;)
"tls"; -- Add support for secure TLS on c2s/s2s connections
"dialback"; -- s2s dialback support
"disco"; -- Service discovery
"posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
}
allow_registration = false -- Disable registration.
log = {
-- Log files (change 'info' to 'debug' for debug logs):
{ levels = {min = "info"}, to = "console" }; -- Log to the console
--{ levels = {min = "info"}, to = "syslog" }; -- Log to syslog
}
VirtualHost "your_domain.com"
ssl = {
key = "/etc/prosody/certs/your_domain.com.key";
certificate = "/etc/prosody/certs/your_domain.com.crt";
}
authentication = "internal_plain"
In this configuration:
- Change the
admin@your_domain.comto your own Jabber ID or email address. - In
keyandcertificatefields, update "your_domain.com" to match your own domain name. - If you want information to be logged to syslog, uncomment the second log line.
- If you want to enable user registration, set
allow_registrationtotrue.
Step 5: Create SSL certificates
To create SSL certificates, run the following command:
sudo mkdir /etc/prosody/certs
Then, generate a self-signed SSL certificate by running the following command:
sudo openssl req -new -x509 -nodes -newkey rsa:4096 -keyout /etc/prosody/certs/your_domain.com.key -out /etc/prosody/certs/your_domain.com.crt -days 365
Step 6: Start Prosody
To start Prosody, run the following command:
sudo prosodyctl start
Step 7: Test the Installation
To test the Prosody installation, open a web browser and go to https://your_domain.com:5281. A message will appear indicating that the server is running and is accessible from the web.
Congratulations! You have successfully installed Prosody on your Ubuntu Server. You can now start using Prosody to build XMPP-based applications.
Conclusion
In this tutorial, we learned how to install Prosody IM on Ubuntu Server latest. We also covered how to configure Prosody and create SSL certificates. Remember to keep your Ubuntu system updated and secure. Enjoy using Prosody for your XMPP-based applications.