How to Install and Configure ZNC on AlmaLinux 9 or Rocky Linux 9
Install ZNC from EPEL on the RHEL 9 family, generate the configuration, run it as a systemd service, open the firewall and connect an IRC client.
ZNC is an IRC bouncer: it stays connected to your IRC networks around the clock, keeps a buffer of what was said while you were away, and replays it when your client reconnects. This guide installs ZNC from the EPEL repository on AlmaLinux 9, Rocky Linux 9 or CentOS Stream 9, creates the first user, runs ZNC as a systemd service and connects an IRC client to it.
CentOS 7 reached end of life in June 2024. The steps below are for its successors in the RHEL 9 family; the package, service name and data directory are the same ones the ZNC wiki documents for Fedora and RHEL-compatible systems.
Requirements
- A server running AlmaLinux 9, Rocky Linux 9 or CentOS Stream 9 with a
sudouser. - One free TCP port for ZNC. IRC clients and the web administration page share it.
- The address, port and (if any) password of the IRC network you want to join.
Step 1: Enable EPEL and install ZNC
ZNC is not in the base repositories of the RHEL family. It is packaged in EPEL (Extra Packages for Enterprise Linux), and EPEL packages may depend on the CRB repository, so enable both:
sudo dnf install dnf-plugins-core
sudo dnf config-manager --set-enabled crb
sudo dnf install epel-release
sudo dnf install znc
Check what you got:
znc --version
At the time of writing EPEL 9 carries the 1.8 series, while the upstream project has moved on to 1.10. If you need a newer release than your distribution packages, the ZNC wiki describes building from the source tarball with CMake; for most users the packaged version with distribution security updates is the easier one to maintain.
The package creates a system user named znc with the home directory /var/lib/znc and installs a znc.service unit that runs the bouncer as that user. Never run ZNC as root.
Step 2: Create the configuration
Run the interactive configuration generator as the znc user:
sudo -u znc znc --makeconf
It writes its files to /var/lib/znc/.znc. Answer the questions as follows:
| Prompt | What to enter |
|---|---|
| Listen on port | A port between 1025 and 65534, for example 7443. Avoid 6667 and 6697: browsers refuse to open web pages on well-known IRC ports, which locks you out of the web interface. |
| Listen using SSL | yes. Without it your password and conversations cross the internet in clear text. ZNC generates a self-signed certificate (znc.pem) on first use. |
| Listen using both IPv4 and IPv6 | yes, unless the server has no IPv6. |
| Username, password | The administrator account you will log in with. Choose a long, unique password. |
| Nick, alternate nick, ident, real name | Your IRC identity. The defaults are derived from the username. |
| Bind host | Leave empty unless the server has several addresses and you want ZNC to connect out from a specific one. |
| Set up a network? | yes, then enter a name for the network, the server host, whether it uses SSL, the port (usually 6697 with SSL), an optional server password and the channels to join, for example #example. |
| Launch ZNC now? | no. systemd will start it in the next step. |
If you answered yes to the last question by accident, stop that copy with sudo pkill -u znc znc before continuing, otherwise the service cannot bind the port.
Step 3: Start ZNC and open the firewall
Enable the service so that ZNC starts now and after every reboot:
sudo systemctl enable --now znc
sudo systemctl status znc
firewalld blocks incoming connections to unlisted ports, even if your provider's network firewall allows them. Open the port you chose:
sudo firewall-cmd --permanent --add-port=7443/tcp
sudo firewall-cmd --reload
Confirm that ZNC is listening:
sudo ss -tlnp | grep znc
Step 4: Use the web interface
The webadmin module is served on the same port as IRC. Because you enabled SSL, open https://203.0.113.10:7443/ (your server's address and port) in a browser. The browser will warn about the self-signed certificate; accept it after checking that you are really talking to your own server, then log in with the administrator account.
From here you can add more networks and channels, create further users, change buffer sizes and load modules. Everything you change is written back to /var/lib/znc/.znc/configs/znc.conf. Do not edit that file by hand while ZNC is running, because ZNC overwrites it when it saves.
Step 5: Connect your IRC client
In your IRC client, add a new server with these settings:
- Server: your server's address or hostname, port
7443, SSL/TLS enabled. - Server password:
username:password. If you have more than one network, useusername/network:passwordto choose which one this connection attaches to. - Accept the self-signed certificate when the client asks, or pin its fingerprint if the client supports that.
Many clients accept a one-line command of this form (the plus sign in front of the port means SSL):
/server 203.0.113.10 +7443 deploy:your-password
Once connected, ZNC joins your channels and replays the buffered lines. You can talk to ZNC itself by messaging *status, for example /msg *status help, or use the shorter /znc help.
Maintenance and troubleshooting
- Updates:
sudo dnf upgrade znc, followed bysudo systemctl restart znc. Clients are disconnected for a moment and reconnect on their own. - Logs:
sudo journalctl -u znc -eshows why the service failed to start, typically a port already in use or a syntax error inznc.conf. - Backups: everything ZNC knows (users, networks, buffers, the certificate) lives under
/var/lib/znc/.znc. Stop the service or accept a slightly stale buffer, then copy that directory. - Cannot connect: check the port in
ss -tlnp, the firewalld rule, any firewall in your hosting control panel, and that the client really uses SSL on an SSL port. - Lost the admin password: stop ZNC, run
sudo -u znc znc --makepassto generate a new password block, and replace the<Pass>block of your user inznc.confwith it.
Frequently asked questions
Can I use a trusted certificate instead of the self-signed one?
Yes. ZNC reads the certificate and private key from znc.pem in its data directory, so you can replace the generated file with a certificate issued for your hostname. The ZNC wiki has a page on signed certificates that describes the file layout and how to renew it; remember that the znc user must be able to read the file.
Can several people share one ZNC?
Yes. Create one ZNC user per person in the web interface; each user has separate networks, buffers and a separate password. Only give administrator rights to people you trust, since admins can load modules and see other users' settings.
How many networks can one user connect to?
A single user can have several networks. Each IRC client connection attaches to one of them, selected with the username/network:password form of the server password, so you add one server entry per network in your client.
Is the package available for Debian or Ubuntu too?
Both ship a znc package, installed with sudo apt install znc. According to the ZNC wiki the Debian package does not include a service unit, so there you run znc --makeconf under a dedicated account and arrange the automatic start yourself. See the ZNC installation page for all platforms.