ZNC is an advanced IRC network bouncer that is left connected all the time so that an IRC client can disconnect or reconnect without losing the chat session.
In this tutorial, we’ll compile ZNC with the web admin module installed.
First of all, and as always, we’ll update the package cache.
sudo apt-get update
Next, we’ll install some dependencies required to compile ZNC.
sudo apt-get install libssl-dev libperl-dev pkg-config build-essential
Download the latest release of ZNC:
cd /usr/local/src
sudo wget http://znc.in/releases/znc-latest.tar.gz
Extract ZNC from the tarball, and then enter the source directory:
sudo tar xf znc-latest.tar.gz
cd znc-*/
At this step, you can set ZNC’s installation directory by adding the --prefix=<yourdir>
option. But for now, we’ll install it system wide:
./configure
We’ll compile ZNC and install it with the following commands. To speed up the process, you may add -j n
to the first make
command, where n
is the number of cores / vCPUs on your server.
sudo make
sudo make install
This may take a few minutes, depends on your machine’s configuration.
It is important not to run web-facing apps under root
. So we’ll create a new user for ZNC.
adduser --disabled-password znc
Now switch to znc
.
su znc -
cd ~
Create ZNC’s config file under znc
:
/usr/local/bin/znc --makeconf
ZNC will ask us some questions in order to create the config file. The first one is important; note your input because you will connect to the ZNC daemon using that port.
We’ll enter 6697
now – that’s the default port for IRC with SSL / TLS.
[ ?? ] What port would you like ZNC to listen on? (1025 to 65535): 6697
It is strongly recommended to enable SSL listening instead of the plain-text (i.e. insecure) scheme.
Would you like ZNC to listen using SSL? (yes/no) [no]: yes
Next question is regarding IPv6. That actually depends on your needs. If your home network is IPv6 enabled, it’s recommended to enable. We’ll just leave the default option there.
[ ?? ] Would you like ZNC to listen using both IPv4 and IPv6? (yes/no) [yes]: <press Enter>
Now it’ll prompt us about two global modules, partyline
and webadmin
. They’re self-explanatory, and we’ll need to enable them.
[ ?? ] Load global module <partyline>? (yes/no) [no]: yes
[ ?? ] Load global module <webadmin>? (yes/no) [no]: yes
User creation. Enter your desired username and password for the user, then confirm it. Note that the password will not be echoed.
[ ?? ] Username (AlphaNumeric): Doe
[ ?? ] Enter Password: <password>
[ ?? ] Confirm Password: <password>
Grant the user admin permissions:
[ ?? ] Would you like this user to be an admin? (yes/no) [yes]: yes
Then, your IRC network options. Set it on your own. Here’s an example:
[ ?? ] Nick [Doe]: Doe
[ ?? ] Alt Nick [Doe_]: Doe_
[ ?? ] Ident [Doe]: DoeIdent
[ ?? ] Real Name [Got ZNC?]: Jane Doe
[ ?? ] Bind Host (optional): server.hostname
[ ?? ] Number of lines to buffer per channel [50]: 50
[ ?? ] Would you like to clear channel buffers after replay? (yes/no) [yes]: yes
Enable these modules:
[ ?? ] Load module <chansaver>? (yes/no) [no]: yes
[ ?? ] Load module <controlpanel>? (yes/no) [no]: yes
[ ?? ] Load module <perform>? (yes/no) [no]: yes
[ ?? ] Load module <webadmin>? (yes/no) [no]: yes
Now we may setup the IRC network that ZNC will connect to.
[ ?? ] Would you like to set up a network? (yes/no) [no]: yes
We’ll use #ubuntu
on Freenode for example.
Network (e.g. 'freenode' or 'efnet'): freenode
Information about these network modules prompted are here.
[ ?? ] Load module <chansaver>? (yes/no) [no]: yes
[ ?? ] Load module <keepnick>? (yes/no) [no]: yes
[ ?? ] Load module <kickrejoin>? (yes/no) [no]: yes
[ ?? ] Load module <kickrejoin>? (yes/no) [no]: yes
[ ?? ] Load module <nickserv>? (yes/no) [no]: yes
[ ?? ] Load module <perform>? (yes/no) [no]: yes
[ ?? ] Load module <simple_away>? (yes/no) [no]: yes
Set the server we’ll connect to:
[ ?? ] IRC server (host only): irc.freenode.net
[ ?? ] [irc.freenode.net] Port (1 to 65535) [6667]: 6697
[ ?? ] [irc.freenode.net] Password (probably empty):
[ ?? ] Does this server use SSL? (yes/no) [no]: yes
[ ** ]
[ ?? ] Would you like to add another server for this IRC network? (yes/no) [no]: no
And the channel we’ll join:
[ ?? ] Would you like to add a channel for ZNC to automatically join? (yes/no) [yes]: yes
[ ?? ] Channel name: #ubuntu
[ ?? ] Would you like to add another channel? (yes/no) [no]: no
Finish the configuration and launch ZNC:
[ ?? ] Would you like to set up another user? (yes/no) [no]: no
[ .. ] Writing config [/home/znc/.znc/configs/znc.conf]...
[ >> ] ok
... ...
[ ?? ] Launch ZNC now? (yes/no) [yes]: yes
Yay. ZNC is up and running!