VPS & Servers

How to Set Up an Openfire XMPP Server on Ubuntu

Install your own chat server on Ubuntu. Java, MySQL, the admin panel, SSL and the ports that have to be open — with the plugin list that makes it actually useful.

The Openfire admin console running on an Ubuntu server

Openfire is a chat server you run yourself. It speaks XMPP, the open messaging standard, which means any XMPP client can connect to it — desktop apps, web clients, and Android apps you build.

It is the back end behind building your own chat app. Install it once and it serves both your website and your mobile app from the same user list.

Why Openfire

  • You own the messages. They sit in your database, nowhere else.
  • It is genuinely light. A 2 GB server handles thousands of users chatting.
  • It has a real admin panel in the browser — users, groups, bans, statistics.
  • It is an open standard, so you are not locked into anyone's app.

What you need

  • Ubuntu 22.04 or 24.04 on a VPS with a public IP
  • 2 GB RAM. Openfire is Java, and 1 GB is tight once plugins load.
  • A domain pointing at the server
  • Root or sudo access

Step 1: Install Java

Openfire runs on Java and will not start without it:

sudo apt update
sudo apt install openjdk-17-jre-headless -y
java -version

The headless package is the right one for a server — it leaves out the graphical libraries you will never use.

Step 2: Install MySQL and create the database

Openfire can use its own embedded database, but do not. It struggles past a few hundred users and is painful to back up.

sudo apt install mysql-server -y
sudo mysql_secure_installation

Create the database and a user for it:

sudo mysql
CREATE DATABASE openfire CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'openfire'@'localhost' IDENTIFIED BY 'a-long-random-password';
GRANT ALL PRIVILEGES ON openfire.* TO 'openfire'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Write those details down — the setup wizard asks for them in a moment.

Step 3: Install Openfire

Download the current .deb from igniterealtime.org/downloads, then:

wget https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_4.9.2_all.deb -O openfire.deb
sudo dpkg -i openfire.deb
sudo apt install -f -y

Check the version number on the download page — it moves. Then start it:

sudo systemctl start openfire
sudo systemctl enable openfire
sudo systemctl status openfire

Step 4: Open the firewall

Openfire uses several ports and nothing works if they are closed:

sudo ufw allow 9090    # admin console (http)
sudo ufw allow 9091    # admin console (https)
sudo ufw allow 5222    # client connections
sudo ufw allow 5223    # client connections over SSL
sudo ufw allow 7777    # file transfer
sudo ufw allow 5269    # server-to-server
PortWhat breaks without it
9090 / 9091You cannot reach the admin panel
5222 / 5223No client can log in at all
7777File and image sending fails
5269Users cannot chat with other XMPP servers

Step 5: Run the setup wizard

Open http://yourdomain.com:9090. The wizard has five screens:

  1. Language
  2. Server settings — the domain is important. Use your real domain, because it becomes part of every username (ali@yourdomain.com). Changing it later means recreating accounts.
  3. Database — choose Standard Database Connection, MySQL, then:
    jdbc:mysql://localhost:3306/openfire?useSSL=false&serverTimezone=UTC
    with the username and password from Step 2.
  4. Profile settings — Default, unless you are connecting to an existing LDAP directory.
  5. Admin account — a real email and a strong password.

Openfire restarts, and you log in at the same address.

Step 6: Install the plugins

A bare Openfire only sends plain text. Everything else comes from plugins. Go to Plugins → Available Plugins and install:

PluginGives you
RegistrationUsers can sign up from the client
HTTP File UploadSending images and files
MUC ServiceGroup chat rooms
Monitoring ServiceMessage history and statistics
Jingle NodesVoice and video calls
STUN ServerHelps calls connect through routers
Presence ServiceOnline and offline status
Content FilterBlocks bad words
Avatar ResizerProfile pictures that do not break layouts

Install them one at a time and wait for each to finish. Clicking several quickly sometimes leaves one half-registered and it silently does nothing.

Step 7: Add SSL

Openfire generates a self-signed certificate at install. Clients warn about it or refuse to connect entirely.

Get a real certificate — see how to install a free SSL certificate on Ubuntu — then import it in Server → Server Settings → Server Certificates. Delete the self-signed one first, or Openfire may keep offering it.

Step 8: Test it

Install any XMPP client — Gajim on desktop, Conversations on Android — and log in with:

  • Username: yourname@yourdomain.com
  • Server: your domain
  • Port: 5222

Then test in this order: send a text message, send an image (proves HTTP File Upload works), create a group, and make a call from two devices on different networks.

Common problems

The admin console will not load

Port 9090 is closed, or Openfire is not running. Check sudo systemctl status openfire and the firewall.

Setup wizard fails at the database step

Usually the connection string. Use the exact form above including useSSL=false, and confirm the user can log in with mysql -u openfire -p openfire.

Clients cannot connect

Port 5222 is blocked, or the server domain does not match the domain users are typing. The domain set in the wizard must be the one in their username.

Images will not send

HTTP File Upload is missing, or its announced domain is wrong. Check the plugin settings and that port 7777 is open.

Openfire keeps stopping

Almost always memory. Java on a 1 GB server runs out once plugins load. Check with free -m and move to 2 GB.

Calls ring but never connect

Jingle Nodes alone is not enough for users behind mobile networks. You need a TURN server — the coturn setup in the chat app guide covers it.

Where to go next

Questions people ask

What is Openfire used for?
Openfire is a chat server you host yourself. It speaks XMPP, the open messaging standard, so any XMPP client can connect — desktop apps, web clients and Android apps you build. One server can power both a website chat and a mobile app from the same user list.
How much RAM does Openfire need?
Two gigabytes is the practical minimum because Openfire runs on Java. One gigabyte works until you install plugins, then the service starts stopping unexpectedly. A 2 GB server handles thousands of users chatting.
Should I use the embedded database or MySQL?
Use MySQL. The embedded database is fine for a quick test but struggles past a few hundred users and is awkward to back up. Setting up MySQL adds about five minutes and saves real trouble later.
Which ports does Openfire need open?
Ports 9090 and 9091 for the admin console, 5222 and 5223 for clients, 7777 for file transfer and 5269 for server-to-server. Without 5222 nobody can log in; without 7777 image sending fails.
Why can clients not connect to my Openfire server?
Either port 5222 is blocked in the firewall, or the server domain set in the wizard does not match the domain in the username people are typing. Both must agree.
Can I change the Openfire server domain later?
Technically yes, but every username contains the domain, so existing accounts break and effectively have to be recreated. Set the real domain during the setup wizard rather than fixing it afterwards.
Why will images not send in my chat?
The HTTP File Upload plugin is missing, or the domain it announces is wrong. Install it from Available Plugins, check its settings point at your real domain, and make sure port 7777 is open.
Does Openfire support voice and video calls?
Yes, through the Jingle Nodes plugin, but that alone is not enough for users on mobile networks. You also need a TURN server such as coturn, otherwise calls ring and never connect.
Why does Openfire keep stopping on its own?
Almost always memory. Java runs out on a 1 GB server once plugins load and the process gets killed. Check with free -m and move to a 2 GB plan.
Do I need a real SSL certificate?
Yes. Openfire creates a self-signed certificate during install, and most clients either warn loudly or refuse to connect. Install a free Let's Encrypt certificate and import it in Server Certificates, deleting the self-signed one.

Written by Habib Baloch

I build Android apps, websites and Ubuntu servers, and write down exactly how I did it.

Ask me about this guide →