IRC is my preferred method of real-time communication. I love being able to spend time on IRC channels. With my schedule continuing to get busier and with less free time in general I’m not able to be on IRC all the time like I used to be. Being offline so much brings out the biggest weakness with IRC itself. Messages that are sent while you are offline are not queued. If someone sends you a message when you aren’t logged in the message will be lost forever. Only by staying logged in are you sure to get all your messages. That’s where bouncers come in. Bouncers stay logged into the IRC server for you and record all the messages you would have otherwise received had you been online. When you log in again the bouncer sends you all the messages you missed while you were away. ZNC is a popular open source bouncer that is easy to install and configure. In this blog post I’ll show how to get it running on a WebFaction hosting account.
I use WebFaction’s shared hosting account. The price is unbeatable and the fact that it’s just a shared account and not a VM means it’s much faster than a VPS with equivalent specs. The best part is that you can install and run any software you want on your account as long as it doesn’t violate the terms of service. WebFaction terms of service allows things like ZNC so it’s the perfect place to install a bouncer. I highly recommend WebFaction. It’s only $10 a month for an account with 100GB of SSD storage, and it gets cheaper if you pay by the year. Here is an affiliate link if you are interested.
First login to your webfaction control panel and navigate to “Domains/Websites” > “Applications” and create a new application. For “App category” choose “Custom”. Give your app a name (I chose
znc in this article). Then for “App type” choose “Custom App (listening on port)”. Then check the “Open port” checkbox and click save. You should be taken back to the applications index page. The applications page should show the application you just created along with the port number and IP address. Make a note of the IP and port, you’ll need them next.
SSH into your server and create a directory for the build:
mkdir -p $HOME/znc_build cd $HOME/znc_build
Then download the ZNC source and extract the files out of the archive:
wget http://znc.in/releases/archive/znc-1.4.tar.gz tar -xzf znc-1.4.tar.gz cd znc-1.4
I had to use version 1.4 since the compiler on my server didn’t have support for C++11 and ZNC version 1.4 was the last version to not require C++1. Apparently other shared WebFaction servers have support for C++11 so if yours does it would be best to use the latest version of ZNC.
Next configure your ZNC build to run the directory that was created for custom app you created. Mine was
$HOME/webapps/znc so I ran:
make && make install
If all goes as expected you should see this message:
****************************************************************** ZNC was successfully installed. You can use '.../bin/znc --makeconf' to generate a config file. If you need help with using ZNC, please visit our wiki at: http://znc.in
Remove the build directory since ZNC is now installed:
cd ~ rm -rf ~/znc_build
Before configuration let’s add the ZNC bin directory to our
$PATH so it’s available in the shell. This will make things a lot easier in the long run. With my server the command I ran looked like this:
echo "export PATH=$HOME/webapps/znc/bin:$PATH" >> $HOME/.bashrc # Then reload the bashrc source ~/.bashrc
Now we can configure ZNC. First generate the config file:
It will prompt you to enter a port number. Enter the port number you saw on the application page when you created the custom application in the WebFaction interface. After entering the port number follow the prompts to select your SSL and IPv settings. Then continue to follow the prompts and select the ZNC modules you want to enable. After that follow still more prompts to create a user. Make sure the user you create is an admin user. You will also be prompted to enter a “bind host”. Enter the IP address you saw listed on the applications page in the WebFaction interface. You can create as many users as you want during setup. Continue through the rest of the prompts. The last one should ask if you want to start ZNC. Choose yes. Make a note of the configuration file location since it contains everything you’ll need to know to connect to ZNC.
Now that ZNC is running you should be able to connect to it. Try connecting to ZNC with your IRC client.
Before connecting to your ZNC server you need to install the dispatch.pl script as described on this page and place it in your
~/.irssi/scripts/autorun/ directory. This plugin allows you to use
/znc in Irssi to send commands to ZNC. Once you have the file in place run
/script load autorun/dispatch to load it. Then add your ZNC server:
/server add -net myserver -auto -ssl <hostname or ip> <port> <username>:<password>
myserver with the name you want to give to your ZNC server. The name will be used when you connect to ZNC. Be sure to enter the same IP and port you got from the WebFaction interface just like with ZNC. Then connect by running
/connect myserver. Once you are connected use
/znc to issue ZNC commands.
/znc help should be enough to get you started.
Connecting to ZNC is even simpler in WeeChat. Just add the server and tell it to autoconnect:
/server add myserver <hostname or ip>/<port> -ssl -username=<username> -password=<password> /set irc.server.myserver.autoconnect on
myserver with whatever name you want to give your server. You may also need to turn
ssl_verify off if you aren’t using it:
/set irc.server.myserver.ssl_verify off
Then you should be able to connect by running
/connect myserver or restarting WeeChat. Once again you can use
/znc to issue ZNC commands once you are connected.
Getting ZNC setup is just the beginning. There is still more that needs to be done in order to have ZNC recording everything you care about while you are offline. That’s too much for this blog post though. Checkout the documentation on ZNC website or run
/znc help to learn more about configuring your ZNC account.
As you have seen ZNC is simple to install and configure. With WebFaction it’s also very economical to run. I’m really glad I set up ZNC as it has really helped me get more out of IRC. Hopefully this blog post has inspired you to try out ZNC or another bouncer. As always, if you have any questions or suggestions don’t hesitate to send me an email.