Setting Up an Basic IRC Server on Ubuntu


IRC Funny Cartoon Ahh the good old IRC server, these things have been letting people chat to each other since 1988. In there most basic form they are chat room servers, pretty much every chat room you’ve used on a web page is connecting to an IRC server. They definitely have a place in computing history as they were used to report on the 1991 Soviet coup d’état attempt and Gulf War during media blackouts.  But they have become much more then simple chat rooms, they allow for: File Transfer, Encryption, Proxy, Colour, Channels, Users, and even chat bots.

Sadly the IRC chat room  are being replaced by things like MSN and Facebook messenger. They are great to install on web servers because they allow you to include chat rooms into your websites, or just to play with something that’s been such an important part of computing history.


First we need to install “ircd-hybrid”, this is the main IRC server that we’ll be working on:

apt-get install ircd-hybrid

This will install a basic IRC server and run it on ports 6666-6669TCP, you can actually connect to this now buy opening your favourite IRC client (mines epic4) and typing:

irc 127.0.0.1

At this stage there isn’t much you can do with it, you cant even create a channel and chat to someone, we need to go through some configuration tasks. First lets edit the initial MOTD(Message of the Day) window by editing /etc/ircd-hybrid/ircd.motd:

sudo nano /etc/ircd-hybrid/ircd.motd

This file contains the MOTD and any changes you make here will be seen every time someone connects to your servers, you can use the suggestion below if you want:

        _,met$$$$$gg.       ircd-hybrid 7.2.2
     ,g$$$$$$$$$$$$$$$P.    -----------------
   ,g$$P""       """Y$$.".
  ,$$P'              `$$$.  Welcome to my first IRC Server"
',$$P       ,ggs.     `$$b:
`d$$'     ,$P"'   .    $$$
 $$P      d$'     ,    $$P
 $$:      $$.   -    ,d$$'
 $$;      Y$b._   _,d$P'
 Y$$.    `.`"Y$$$$P"'
 `$$b      "-.__
  `Y$$b
   `Y$$.
     `$$b.
       `Y$$b.
         `"Y$b._
            `""""




Now if you want to actually apply these changes you’ll need to restart the IRC server, to do this:

sudo /etc/init.d/ircd-hybrid restart

So now when you log in to the IRC server you should see the updated MOTD. Now we need to make a Admin Password for the server, to do this we are going to use the mkpasswd command:

mkpasswd [your password]

this will return some like “PtC1dMzSDL5gs”, make your you copy or note this down, we need in the next step. Now open the ircd-hybrid config file, and search for the operator section:

nano /etc/ircd-hybrid/ircd.conf

then search for:

 operator {
        /* name: the name of the oper */
        name = "root";

        /* user: the user@host required for this operator.  CIDR is not
         * supported.  multiple user="" lines are supported.
         */
        user = "root@127.0.0.1";

        /* password: the password required to oper.  By default this will
         * need to be encrypted using '/usr/bin/mkpasswd'.
         * WARNING: Please do not mix up the 'mkpasswd' program from
         * /usr/sbin with this one. If you are root, typing 'mkpasswd'
         * will run that one instead and you will receive a strange error.
         *
         * MD5 is supported. If you want to use it, use mkpasswd -Hmd5.
         */
        password = "ToJx.IEPqjiVg";

change user to “user = “*@127.0.0.1” and change the password filed to include your password hash we generated a minute ago, so it looks something like:

         * supported.  multiple user="" lines are supported.
         */
        user = "*@127.0.0.1";

        /* password: the password required to oper.  By default this will
         * need to be encrypted using '/usr/bin/mkpasswd'.
         * WARNING: Please do not mix up the 'mkpasswd' program from
         * /usr/sbin with this one. If you are root, typing 'mkpasswd'
         * will run that one instead and you will receive a strange error.
         *
         * MD5 is supported. If you want to use it, use mkpasswd -Hmd5.
         */
        password = "ToJx.IEPqjiVg";

Now you need to find the Connect() section of the config file, its usually under the operator section, it looks something like this:

#connect {
#       /* name: the name of the server */
#        name = "irc.example.net";
#
#       /* host: the host or IP to connect to.  If a hostname is used it
#        * must match the reverse dns of the server.
#        */
#        host = "127.0.0.1";
#
#       /* passwords: the passwords we send (OLD C:) and accept (OLD N:).
#        * The remote server will have these passwords reversed.
#        */

Remove the hole Connection(){ section and replace it with this:

connect {
        /* name: the name of the server */
        name = "irc.example.net";

        /* host: the host or IP to connect to.  If a hostname is used it
         * must match the reverse dns of the server.
         */
        host = "127.0.0.1";

        /* passwords: the passwords we send (OLD C:) and accept (OLD N:).
         * The remote server will have these passwords reversed.
         */
        send_password = "password";
        accept_password = "password";

        /* compressed: controls whether traffic is compressed via ziplinks.
         * By default this is disabled
         */
        compressed = no;
};

Now if your have ever used IRC before you will be familiar with NickServ and ChanServ, well these are addons services for IRC and they come in vary useful when configuring chat channels and users. We need to edit /etc/hybserv/hybserv.conf to look like this, remember to change “#YOUR PASSWORD HASH# to the other password we setup earlier:

O:*@*:#YOUR PASSWORD HASH#:root:segj
A:Debian User
N:irc.example.net:Hybrid services
S:password:127.0.0.1
V:127.0.0.1
C:#services
I:*.blah.com:6:1

now we need to restart the ircd and hybrid server to make things work, (i don’t know why but i needed to restart ircd-hybrid twice to get it to work):

sudo /etc/init.d/ircd--hybrid restart
sudo /etc/init.d/hybserv restart
sudo /etc/init.d/ircd--hybrid restart

and that’s it you should have a Basic IRC server running with the NickServ and ChanServ bots running. If you need more information on setting up users and channels using NickServ & ChanServ look here.

Thank You

, , , , , , , , , ,

Comments are closed.