Finally started hosting my own GNU Social instance

I’ve been planning to do this for a while now, but have been wary because of the lack of decent documentation. But I’ve finally taken the plunge!

My GNU Social instance is at https://sn.genesismachina.ca/. It’s a single-user instance – just for me – but it’s federated. So my GNU Social ID will now be indi@sn.genesismachina.ca.

Installation was not as simple as more polished web apps like WordPress, but it wasn’t that bad.

First I had to set up the new virtual host for sn.genesismachina.ca; nothing really to that if you’ve set up virtual hosts before. I basically just copy-pasted one of my other vhost conf files (I forget which one) and changed the server name and document root directives. Then I copy-pasted the mod_rewrite rules from GNU Social’s htaccess.sample. And that was pretty much it.

Then I had to expand my Let’s Encrypt list to include the new subdomain. Again, nothing different from adding any other subdomain/vhost.

Then it was the usual dance:

  1. Enable the new vhost site.
  2. Reload Apache’s config.
  3. Put a test HTML file in the new site’s document root.
  4. Use a browser to see if everything works.

Thus far nothing involved GNU Social specifically. It was just the standard dance for setting up a new subdomain.

The first thing I had to do for GNU Social was add a few PHP modules I was missing: gmp and intl. Not a problem:

$ sudo apt install php7.0-gmp php7.0-intl
$ sudo phpenmod intl
$ sudo phpenmod gmp
$ sudo systemctl restart apache2

Next I had to set up the database. I use MariaDB, but the steps are identical as for MySQL:

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  [...]

MariaDB [(none)]> create database social;
Query OK, 1 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on social.* TO 'social'@'localhost' identified by '<password>';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> exit;
Bye

One annoyance I ran into later was that the document root had to be world-writable. Not just writable by the web server; world-writable. I don’t know why that was, but it refused to install until I made the document root world writable, so:

$ sudo chmod a+w .

Finally it was time to clone GNU Social into the document root:

$ git clone https://git.gnu.io/gnu/gnu-social.git .
Cloning into '.'...
remote: Counting objects: 376404, done.
remote: Compressing objects: 100% (41647/41647), done.
remote: Total 376404 (delta 171626), reused 376106 (delta 171471)
Receiving objects: 100% (376404/376404), 247.68 MiB | 4.82 MiB/s, done.

There were 3 directories missing from the Git repository. I don’t know if they would have been created automatically, but I created them anyway.

$ mkdir avatar background file
$ chown :www-data avatar background file
$ chmod ga+rwx avatar background file

You’ll notice I made them world-writable, too. That was just for the install. I’m still mucking about with permissions to figure out what’s safest yet still works.

After that it was just a matter of browsing to https://sn.genesismachina.ca/install.php, and going through the install script. Everything “worked”, though the install script belched out a couple pages’ worth of deprecation warnings. That may just be because I was using PHP 7 and not 5.whatever.

And now I have a working GNU Social instance. All in all, not that painful.

After setting up the instance, the first thing I did was reset all the file and directory permissions to something I find more sane; no more world-writable stuff in the web root. So far no problems. I made some initial tests federating with the Quitter.se instance; all seems well. I haven’t yet experimented with moving config.php out of the document root (the GNU Social docs suggest I can move it to /etc/statusnet), but that’s on my agenda. I also haven’t yet tried mucking about with the queue settings – I haven’t even looked at what the defaults are set up to yet – and I haven’t tried turning off the automatic “schema check”.

But the bottom line is that the whole process wasn’t as nerve-wracking as I thought it would be. If you’ve been mulling over the idea, like I had for a long time, I encourage you to give it a whirl!

I will continue to use my Quitter.se account (https://quitter.se/indi) for now, at least until I’m confident that all the kinks are worked out with my own instance. I will only use my instance for personal stuff; I’ll still be putting Canadian Atheist announcements on the Quitter account (until Canadian Atheist has it’s own instance!).

Creative Commons License
This work by Indi. is licensed under a Creative Commons Attribution-ShareAlike 4.0 International

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.