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.
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
| Port | What breaks without it |
|---|---|
| 9090 / 9091 | You cannot reach the admin panel |
| 5222 / 5223 | No client can log in at all |
| 7777 | File and image sending fails |
| 5269 | Users cannot chat with other XMPP servers |
Step 5: Run the setup wizard
Open http://yourdomain.com:9090. The wizard has five screens:
- Language
- 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. - Database — choose Standard Database Connection, MySQL, then:
jdbc:mysql://localhost:3306/openfire?useSSL=false&serverTimezone=UTC
with the username and password from Step 2. - Profile settings — Default, unless you are connecting to an existing LDAP directory.
- 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:
| Plugin | Gives you |
|---|---|
| Registration | Users can sign up from the client |
| HTTP File Upload | Sending images and files |
| MUC Service | Group chat rooms |
| Monitoring Service | Message history and statistics |
| Jingle Nodes | Voice and video calls |
| STUN Server | Helps calls connect through routers |
| Presence Service | Online and offline status |
| Content Filter | Blocks bad words |
| Avatar Resizer | Profile 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
- Build an Android chat app that connects to this server
- Add a browser-based chat room on the same back end
- Secure it with a real certificate