mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / Local_IRC_server.mdwn
1 Tonight I've been looking into ways to set up a local chat system for
2 students in one of my courses.  My initial thought was to use the
3 NetKit `talk` at `talkd` programs, but I couldn't find an active
4 homepage.  Maybe they are so mature that noone needs to touch the
5 code, but I expect they are actually just quietly dying in the corners
6 of assorted harddrives, without any users to love them.
7
8 Since part of the goal of my course is to get the students up to speed
9 on common open source development tools, my next thought was to go
10 with a local [IRC][] server.  I know that there many wonderful public
11 IRC servers (e.g. [freenode][]), but why use a free service when you
12 can run the service locally?  Anyhow, here's my setup.
13
14 Local IRC server
15 ================
16
17 There seem to be a number of these out there.  I chose [ngIRCd][],
18 because it's packaged for Gentoo (`net-irc/ngircd`), and it seems to
19 be both cleanly coded and actively maintained (in [[Git]] ☺).
20 Installation was a simple:
21
22     # emerge -av ngircd
23     # emacs /etc/ngircd/ngircd.conf
24     # cat /etc/ngircd/ngircd.conf
25     [Global]
26         Name = irc.example.com
27         AdminInfo1 = John Doe
28         AdminInfo2 = 123 Street Rd.
29         AdminEMail = jdoe@example.com
30         Info = bla bla bla
31         ServerGID = nogroup
32         ServerUID = ngircd
33     [Options]
34         PAM = no
35     # /etc/init.d/ngircd restart
36
37 I didn't add `ngircd` to the default runlevel.  I'll just start it by
38 hand whenever I want to use it.
39
40 Local connections
41 =================
42
43 Using the excellent [[irssi]] client (`net-irc/irssi` on Gentoo):
44
45     $ irssi -c localhost
46
47 When you specify a server on the command line with `-c server`,
48 `irssi` won't connect to any other servers for which you've configured
49 automatic connection.  In my case, this is what I want.
50
51 Exposing the IRC server on a remote host
52 ========================================
53
54 Alright, I've got an IRC server running on my laptop, but I'm behind a
55 firewall.  I can expose my IRC server to the students by forwarding
56 the IRC port to our department server, where the students all have
57 shell accounts.
58
59     $ ssh -R localhost:6667:localhost:6667 physics.uni.edu
60
61 If someone else is already using port 6667 on the department server,
62 it's easy to use another one:
63
64     $ ssh -R localhost:6668:localhost:6667 physics.uni.edu
65
66 Students can then connect by [[SSHing|SSH]] into the department server
67 and running `irssi` there:
68
69     student@home $ ssh physics.uni.edu
70     student@physics $ irssi -c localhost -p 6668
71
72 And that's all there is too it!  An easy way to introduce people to a
73 popular tool.
74
75 [IRC]: http://en.wikipedia.org/wiki/Internet_Relay_Chat
76 [freenode]: http://freenode.net/
77 [ngIRCd]: http://ngircd.barton.de/
78
79 [[!tag tags/web]]
80 [[!tag tags/tools]]