Scott Street - sprusr

Real life wizard and Internet person



Getting started with GNU social

I’ve seen a lot of people talking about Mastodon recently as a possible location for the mass exodus from Twitter. I’m not entirely sure why it’s seen a big spike of popularity over the past week or so (it’s been around for a while), but folks seem to have started caring somewhat about who’s in control of their data, which is a good thing!

Mastodon is what’s known as a federated social network, meaning that there are many different sites which all communicate with each other. Anybody is free to host their own version, which will be able to interoperate with any other instance on the network. Pretty cool, right?

The most popular Mastodon instance as of writing is mastodon.social, and many people I know have been signing up to it (so much so, that they’ve had to close registrations temporarily 😅). But by signing up to somebody else’s instance, you’re defeating the whole point of it being federated! The only proper way of joining the network is to roll your own instance!

What people may not know about Mastodon is that it’s based on GNU social, and as a result plays friendly with it. Somebody running a GNU social instance is able to read posts made by somebody with a Mastodon instance and vice versa.

GNU social logo GNU’s Not Unix! And I guess GNU social’s not Mastodon? Or something like that…

I’m not trying to make the case for GNU social being any better than Mastodon, but I like the idea of running “the original”. Also it’s written in Ruby and my server doesn’t have Ruby installed (nor Docker if I wanted to go that route). I’m super lazy, so I opted for the simpler option and installed GNU social (it’s in PHP 😽). If you prefer the TweetDeck style of Mastodon, I recommend you check out their installation instructions, or do a quick search for one of the numerous guides that are out there. Otherwise, please stick around!

What you need

You’re going to need a server somewhere. I recommend DigitalOcean (referral link 💕), especially if you’re a student because GitHub offer free DO credit as part of their Student Developer Pack! Ubuntu is my preferred server distro, but you can choose whichever you like - I used Ubuntu 16.04 for this post. Shared hosting should also work, as long as you have access to a database (but where’s the fun in somebody else setting everything up for you?!).

On said server you will need an installation of PHP (5.5+, works with 7), a web server (pick your own favourite, but mine’s Apache 😁), and some kind of database (either MariaDB or MySQL - I went for MySQL because I already had it installed, but ran into some trouble later which I’ll talk about).

In addition to the base PHP package on Ubuntu, I also needed to install php-gd, which was as simple as apt-get install php-gd on Ubuntu with PHP 7. The install docs mentioned a whole load of other PHP extensions, but my installation came with everything else I needed.

Do the thing!

Now you’re ready to go! Log into your web server and cd to your htdocs (something like /var/www, you know the drill). GNU social does provide releases I think, but they recommend just cloning their repo, so git clone https://git.gnu.io/gnu/gnu-social.git social, where social is the name of the directory you want it in. You then need to make the directory writeable by your web server user. For me this was as easy as:

chgrp www-data /var/www/gnusocial/
chmod g+w /var/www/gnusocial/

Next you’re going to want to set up a domain to point towards your site. I’m using Apache, so I set up a virtual host. Virtual hosts aren’t really in the scope of this post, but there are some really great guides around (like this one) which you should check out if you need a hand.

HTTPS is probably a good idea, so I got myself a certificate from Let’s Encrypt (free!) using their command-line tool. It handles everything for you, so there’s no faff trying to work out certificate chains or whatever (if you’ve never had to do this, you should try it some time 😉).

The final step before beginning the setup script is to create a database with a user for GNU social. From a mysql shell you can do…

CREATE DATABASE social;
GRANT ALL on social.* TO 'social'@'localhost' IDENTIFIED BY 'password123';

…changing password123 to be your chosen password (please don’t use that).

Now you can navigate to https://your.domain.tld/install.php to start the setup. It’s going to ask you a few questions: firstly your site name (what you want as the title), whether you want fancy URLs (/index.php?p=username vs /username; fancy requires ability to have .htaccess files - set AllowOverride None for directory in Apache site config), and whether you want SSL enabled (yes).

Then you have to tell the setup how to connect to your database. Provide the details that you set up before (something like localhost, social, social, notpassword123).

GNU social install part 1

Next you’ll be asked for your admin login and site profile. The site profile is to do with whether you want to allow others to sign up - I opted for single user, meaning that I’m the only user (duh 🙄). If you go for this option, your admin login becomes your account, so choose the username you want to be public facing 🙂. Then press submit!

GNU social install part 2

I had some problems with unknown SQL errors which stalled me for a while. It ended up being to do with the version of MySQL I was running, combined with the default config on Ubuntu. After trawling through the system log, and a bit of searching, I found a saviour in the form of this StackOverflow thread. Basically I needed to allow zero-dates (0000-00-00 00:00:00), which GNU social uses as a default value in the database (ew). Hopefully you don’t have this problem!

GNU social feed The height of cool: your own GNU social instance

If everything else goes according to plan, you’ll end up with your very own GNU social instance! It might look a bit bare to begin with, but once you start following people on other instances, it’ll soon fill up - remember you can follow anybody, regardless of which instance they’re on or whether they’re using Mastodon or GNU social or whichever compatible software!

What now?

I’m not sure we’ll all quite ready to delete our Twitter accounts quite yet, mainly because of where the community is. So… Do a bit of preaching! I hope that the reason you’re making the move to GNU social is because you care about who owns you online. Make others take note as well!

In the meantime you’ve got a head start on setting up your config 😁. There are a few different themes to choose from other than the default. Even better would be to contribute! I’d really like to see the selection of themes widen, and might have a go at making one myself.

There are a whole load of issues on the GNU social Gitlab project. And of course, contributing doesn’t have to be code - the docs have plenty of room for improvement. Adding screenshots alongside a list of themes would be amazing (I found it very annoying to have to change the config to see what each one was like).

To ease the transition of content from Twitter to GNU social, I’d love to be able to have links to posts on GNU social auto tweeted. Hackathon project maybe?

Something else which may be of interest is to “socialfy” your root domain. I’m hosting my instance on the soc.spru.sr subdomain, but I’d really quite like to be able to have [email protected] rather than [email protected]. Not a problem! Using the webfinger standard, you can create a script which is queried by other instances when they look up your domain. They first check /.well-known/host-meta (a static XML file) for directions to where the webfinger is. The script then returns details pointing the requesting instance to your own instance.

I haven’t been bothered to set this up yet, mainly because my root domain is a static site, so I can’t run a script to act as the webfinger. Hopefully I’ll get something working soon, and come back here with an edit 🤓.


I hope this helped you get to grips with GNU social. If you’ve managed to get set up, please let us know your new handle!

If you want to chat GNU social, decentralisation or anything else, give me a shout! I’m [email protected] 👋 or if you’re still feeling a bit too attached, you can reach me on Twitter at @sprusr 😬

Apr 9, 2017

Lifewiki: A wiki for your life

I came up with the idea just before Christmas. A hectic term at uni had just come to an end, and I had vowed to never let myself get that busy again. But how could I help manage myself and prevent this kind of horrible exhaustion from happening again? Part of the problem was my inability to keep track of things, which lead to forgetting about stuff I needed to do, and eventually having tasks pile up atop of me. I basically settled on the fact that I needed a second brain to remember all the crap my first one didn’t.

And then the epiphany happened: where does everybody turn when they need some bit of information, or to look up a snippet of general knowledge when they’re on the brink of winning twenty quid and a really hard question comes up on one of those electronic pub quiz machines? Wikipedia of course! What’s to stop me from having my very own, private wiki? The only difference between my solution and Wikipedia would be that instead of holding information about everything, it’d just be things very specific to me.

Lifewiki logo The adorable logo I made for my personal wiki

I toyed around with the idea for a couple of days first, debating inside my head how I should implement such a thing, and eventually settled on writing something with Node and Vue.js - pretty much what I’m familiar with. I set to work with a list of features I wanted to implement, including version history and some kind of custom markup with the ability to include reminders. After a few days work, I was getting towards a nice working prototype, but there was still a lot left to implement for it to be as feature-rich as the likes of Wikipedia. And this was when I realised that what I was doing was a bit stupid.

People use the phrase “why reinvent the wheel”, and I had pretty much started doing exactly that. It made absolutely no sense for me write my own app, when MediaWiki (the software behind Wikipedia) is fully open source and available for anybody to install! Why not just use this pre-existing solution? I made the decision to abandon my efforts up until that point, and just run a fresh MediaWiki install on my hobby server, set up with the requirement that you must have an account to access it.

Lifewiki screenshot MediaWiki does everything I need! (And yep, that’s me…)

I’ve had the wiki running for about 2 months now, and it’s doing a great job in its role as second brain. I use it to keep track of what’s happening with the various projects I’m involved with, to write up lecture notes, and I even started writing a daily journal (something I’d been thinking about doing for a while).

When I occasionally show people that I’m using a wiki as my digital notebook, or (as is more often the case) people glance over at my screen uninvited, most reactions are that of bewilderment. I was surprised myself to learn that personal wikis aren’t very commonplace - perhaps because a wiki is usually associated with open access, something that doesn’t suit personal information very well! Maybe it’s something to consider if you, as I did, rely on a menagerie of notes on Google Keep or similar.

Next steps

I’m nicely settled into my new way of doing things now, and I’m starting to develop nags. For example, Wikipedia has a really great mobile app for viewing and editing wiki pages, but it’s not portable to other self-hosted MediaWiki sites. Whilst writing this, I did discover that the app is, in typical Wikimedia fashion, open source, so I might have a crack at compiling a version for Lifewiki.

I also mentioned above that one of my original feature-wants was the ability to include reminders on pages, inline with the text. Obviously this isn’t something which MediaWiki offers out of the box, nor can I find an extension which offers this. I think the solution here is to have a go a writing my own extension. I don’t know how doable this is for me, nor whether I’ll manage to find the time for it anytime soon, but from what I’ve read so far, extension support in MediaWiki seems pretty good.

I’m going to continue using Lifewiki on a day-to-day basis to keep track of all the things going on in my life, and to make a log of everything I do. If you’re looking for a bit of a change in the way you organise your life, maybe consider a personal wiki to help you out, but remember: no matter how fantastic the software you use is, it can’t do the things you need to do for you!

Feb 25, 2017