Installing and Configuring ZNC on CentOS 7

Updated on November 21, 2023
Installing and Configuring ZNC on CentOS 7 header image

ZNC is a free and open-source IRC bouncer that stays permanently connected to a network so clients can receive messages sent while they're offline.

This tutorial will walk you through the process of installing and configuring ZNC on CentOS 7. It is assumed that the user knows how to configure the firewall. On CentOS 7 it's FirewallD, which drops any incoming connections by default even if you have configured Vultr's web-based solution.

##Installing ZNC

Installation of ZNC is fairly straightforward, but needs you to enable Extra Packages for Enterprise Linux (EPEL).

Instructions for that can be found https://docs.vultr.com/enable-epel-on-centos.

Once that's done, run yum install znc to install ZNC.

##Configuring ZNC

You shouldn't run anything facing the internet using root, so it's generally recommended to create a new user specifically for applications that will be accessed remotely. Luckily, ZNC already does that when installing from the repository so we don't need to do that manually.

Now that it's installed, run sudo -u znc znc --makeconf to begin the configuration process.

The first prompt you will get asks you to select a listening port. This is the port you will access the bouncer from (including the web interface), so we will choose 6697, since that is the most common port for secure IRC servers.

Your console will look like the following.

[ ?? ] Listen on port (1025 to 65534): 6697

The second prompt asks you whether you'd like to use SSL for the bouncer. It's highly recommended to do this, as without it everything will be sent using plain-text, meaning anyone on the same network can read your chats.

[ ?? ] Listen using SSL (yes/no) [no]: yes

The third prompt asks you whether or not you would like to enable IPv6. There's no real downside to this, and as the world moves towards 100% IPv6 adoption it means you won't have to change anything later. Just press Enter to use the default option.

[ ?? ] Listen using both IPv4 and IPv6 (yes/no) [yes]:

If you haven't installed ZNC on this server before ZNC will alert you about a missing file. Don't worry, it's normal and ZNC will create it.

The next prompt asks for a username for the administrator's account, so choose anything you like. The only hard requirement is only using alphanumeric characters.

[ ?? ] Username (alphanumeric):

You will be asked to set a password. Again, choose anything you like. You will not see your password displayed when you type it for security reasons.

[ ?? ] Enter password:
[ ?? ] Confirm password:

You will then be prompted for a "nick". This is your display name on IRC, and it defaults to your username. Choose something you like, but don't worry about it since it can be changed later.

[ ?? ] Nick [example]:

It will also ask for an alternate nick, this is used when your primary one is in use. It defaults to your previous nick with an underscore at the end.

[ ?? ] Alternate nick [example_]:

The next prompt is for an "ident", which is referred to as your "username" in some IRC clients including HexChat. This is the part of your name that goes at the start of your hostname during a WHOIS prompt, so if your ident is example and your hostname is example.com it will return example@example.com. It defaults to your username set earlier.

[ ?? ] Ident [example]:

It will then ask for a real name. You don't have to set this as your real name, and it defaults to Got ZNC? Some IRC clients have the default as realname, you can choose that if you like.

[ ?? ] Real name [Got ZNC?]:

This next one is a bit more involved. It asks you for a "bind host", which is the IP address ZNC will use to connect to an IRC server. It's optional, but if you want to set it follow these steps:

  1. Go to https://my.vultr.com/.
  2. Click on the name of the server you're currently configuring.
  3. Look for an entry labelled IP Address under the server's country.
  4. Click the icon on the right-hand side of the numbers.
  5. Paste the IP address into the terminal. If you're using the console you will need to manually write it, some SSH clients let you paste by right-clicking, or with Shift + Insert.

You don't have to worry about this changing as Vultr assigns you a static IP.

[ ?? ] Bind host (optional):

##Configuring a network

The next thing you will be asked is whether or not you would like to set up a network right now, with the default as yes. Feel free to skip this if you've opted not to configure a network.

[ ?? ] Set up a network? (yes/no) [yes]:

This guide assumes you have opted to configure a network now.

You will be prompted for a name, this is the display name of the IRC network you're connecting to. The default is freenode, a large public IRC server.

[ ?? ] Name [freenode]:

After that, you need to enter a server host. This is just the hostname, not the port.

[ ?? ] Server host (host only):

You will then be asked whether the server uses SSL. You need to find this yourself as it varies between servers.

[ ?? ] Server uses SSL? (yes/no) [no]:

It will now ask for the port the server is on. If SSL is on, it defaults to 6697 and if not it defaults to 6667. This shows what it looks like when SSL is specified as enabled.

[ ?? ] Server port (1 to 65535) [6697]:

It now asks for a server password. If your server does not require one, you can leave it blank and press Enter to continue.

[ ?? ] Server password (probably empty):

The next prompt asks for initial channels that will be automatically joined when you have connected. Feel free to leave it blank to continue if you don't want any.

[ ?? ] Initial channels:

##Finishing up

You will get some instructions on how to connect to and configure ZNC after you have finished that section. It will look like this:

[ ** ] To connect to this ZNC you need to connect to it as your IRC server
[ ** ] using the port that you supplied.  You have to supply your login info
[ ** ] as the IRC server password like this: user/network:pass.
[ ** ]
[ ** ] Try something like this in your IRC client...
[ ** ] /server <znc_server_ip> +6697 example:<pass>
[ ** ]
[ ** ] To manage settings, users and networks, point your web browser to
[ ** ] https://<znc_server_ip>:6697/

The final prompt asks you whether or not you want to run ZNC now.

[ ?? ] Launch ZNC now? (yes/no) [yes]:

Congratulations, you have finished installing and configuring ZNC. Please remember that you can change options through the web configuration and do not have to manually edit config files.