Setting up Prosody on the Raspberry Pi for house/apartment/secret club house-wide chatroom
Although I only live with 4 others, wife, son & 2 cats, in a small 5 room apartment most evenings we are in different rooms, or in the summer 3 different floors, wearing headphones chilling to our own choices in music & tv. As I think it's uncouth to yell out of the window or across the apartment to get someone's attention I setup a Raspberry Pi Model B as an XMPP server running MUC. As it's only for 3 people, unless we have visitors, I chose to run Prosody, it's pretty lightweight, easy to setup, the stable version is in the raspbian repos & i've used it before. I've also used and run ejabberd, openfire, tigase, jabberd,... but IMHO they are heavier on resources and a bit harder to setup, and are overkill for my needs and anyway I like lua.
As stable Prosody, currently 8.2, is in the raspbian repos you install it via apt.
sudo apt-get install prosody
which will install (if they are not already installed)
liblua5.1-0 lua-event lua-expat lua-filesystem lua-sec lua-socket prosody ssl-cert
Once Prosody is installed you'll need to create a config file & add some users.
First create an admin user for the server. As Prosody is running on birstall.leicestershire.lan, i'll use admin@birstall.leicestershire.lan as my admin account & create it using the prosodyctl utility.
sudo prosodyctl adduser admin@birstall.leicestershire.lan
which will ask you to enter a password for that user (twice)
Enter new password: Retype new password:
[As i'm going to disallow in-band registration i also created accounts for my wife & son & a non-admin account for myself after creating the admin account also using prosodyctl. But if you are going to allow users to create their own accounts you can just skip to creating the config file.]
sudo prosodyctl adduser linda@birstall.leicestershire.lan
sudo prosodyctl adduser john@birstall.leicestershire.lan
sudo prosodyctl adduser russell@birstall.leicestershire.lan
Now you need to create a config file. It's written in lua, but you don't need to know lua to create it as it's pretty human readable.
Create a file in /etc/prosody/conf.avail with the filename of FQDN of the host Prosody is running on and a suffix of .cfg.lua using whatever editor you are comfortable with, in my case I happen to like vi/vim so i'll use that.
sudo vi /etc/prosody/conf.avail/birstall.leicestershire.lan.cfg.lua
My configuration file looks like this.
VirtualHost "birstall.leicestershire.lan" -- FQDN of host server is running on
admins = {"admin@birstall.leicestersire.lan"} -- admin account
modules_enabled = {
"roster"; -- Allow users to have a roster. Recommended
"saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
"tls"; -- Add support for secure TLS on c2s/s2s connections
"disco"; -- Service discovery
"private"; -- Private XML storage (for room bookmarks, etc.)
"vcard"; -- Allow users to set vCards
"legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
"version"; -- Replies to server version requests
"uptime"; -- Report how long server has been running
"time"; -- Let others know the time here on this server
"ping"; -- Replies to XMPP pings with pongs
"adhoc"; -- Support for "ad-hoc commands" that can be executed with an XMPP client
"admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands
"announce"; -- Send announcement to all online users
"welcome"; -- Welcome users who register accounts
"motd"; -- Send a message to users when they log in
"posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
--"register"; -- Uncomment to enable mod_register
};
-- allow_registration = true -- Uncomment to llow users to register new accounts
motd_text = [[This is a private xmpp server. if you are not authorized please logoff immediately.]]
welcome_message = [[$username welcome to $host]]
disallow_s2s = true -- This is a private server so no federation
Component "conference.birstall.leicestershire.lan" "muc"
name = "MUC"
restrict_room_creation = admin -- only admin user can create a new MUC
[If you want to allow in-band registration, users can register an account from their XMPP client, uncomment the
"register"; -- Enable mod_register
&
allow_registration = true -- Allow users to register new accounts
lines.]
After you have created & saved the configuration file you need to create a symlink to it in the /etc/prosody/conf.d directory.
sudo ln -s /etc/prosody/conf.avail/birstall.leicestershire.lan.cfg.lua /etc/prosody/conf.d/birstall.leicestershire.lan.cfg.lua
[Change birstall.leicestershire.lan to your hosts name]
And then start Prosody
sudo /etc/init.d/prosody start
Actually you are restarting it as it's already running as you installed it using apt and it'll start automatically when you reboot as well. You can now login to the server, if you are the admin user create muc/chatrooms, im logged in users and do all the other things you can do using xmpp by using any xmpp compliant client such as adium, pidgin, Tkabber, psi, ...
This is just a very simple setup that works for my needs as I don't need to worry about setting up SRV records, portforwarding, federation or even much security. If you want to do a more complicated setup or just read a bit more about XMPP look at these sites.
http://prosody.im
http://xmpp.org
January 18th, 2013 - 19:48
Talk about a good use of the server!
January 22nd, 2013 - 13:55
Hi sounds very interesting. Unfortunately I have never heard of local chatrooms & prosody. The websites quoted don’t seem to be aimed at novice users.
How does it work in practice?
What sort of devices can be communicated with?
Windows PCs? smart Phones? …?
January 22nd, 2013 - 14:40
anything that has an im client that does xmpp/jabber will work. so pretty much any m client there is. pidgin, adium, im+ pro, trillian, …
January 29th, 2013 - 15:30
Sorry but I’m none the wiser as to what happens from a user point of view.
I’m guessing each person runs some special software on their PC, Mac, Smart Phone etc. and a message pops up when another user in the ‘chatroom’ messages them?
March 28th, 2013 - 16:36
Chris, you are correct, each user runs a Instant messaging client app on you PC (e.g. on called pidgin) or a Mobile app on you Smartphone (IM+), which then connects to the Prosody server. The server then simply passes text messages, sounds, pictures between users in realtime.
January 19th, 2013 - 21:53
I think
“sudo ln -s /etc/prosody/birstall.leicestershire.lan.cfg.lua /etc/prosody/birstall.leicestershire.lan.cfg.lua”
might be a typo
January 22nd, 2013 - 14:40
oopsy. i’ll fix that in a tick