1. Code
  2. PHP

Revisiting Open Source Social Networking: Installing GNU Social

Read Time:9 minsLanguages:
This post is part of a series called Revisiting Open Source Social Networking Alternatives.
Revisiting Open Source Social Networking Alternatives
Final product imageFinal product imageFinal product image
What You'll Be Creating

In part one of this series, Revisiting Open Source Social Networking Alternatives, I gave a brief overview of a handful of open source social networking platforms and clients. In this part, I'll dive in with an installation of GNU Social and discuss what I think will be critical to competing in a Facebook/Twitter dominated world. 

Why GNU Social? I felt that it's the most straightforward system to install and use. It's also written in PHP, which I think is the most accessible open source language. While it's constrained itself to appearing to be a clone of Twitter, I think this has helped keep all of its basic features and web user interface relatively clean. However, the GNU Social website was down for several days while I was working on this tutorial; the state of the open source distributed network world remains spotty at times.

Installing GNU Social

You can install GNU Social on any LAMP-based system. I've posted my generic guide to installing an Ubuntu LAMP stack for reference.

Log in to your server:

Install all the required components (Curl and Git are also required for this tutorial):

Create a directory for the site and set permissions:

Clone the repository:

Log in to MySQL with your root database password:

Create a new database and set permissions:

Create the Apache site:

Paste in the Apache configuration below, tailored to your server:

Enable the site, disable the default site, and restart Apache:

You'll also need to configure a few directories for write access:

To activate pretty URL strings, we have to move the sample .htaccess file and enable mod_rewrite:

Visit the installation page and enter your name and configuration settings:

You should see something like this:

Install GnuSocialInstall GnuSocialInstall GnuSocial


Gnu Social Installation Settings ContinuedGnu Social Installation Settings ContinuedGnu Social Installation Settings Continued

The installation procedure takes up to a minute, but you should see something like this when it's complete:

GnuSocial Installation ScriptGnuSocial Installation ScriptGnuSocial Installation Script

Here's what the default home page looks like:

Default theme for GnuSocialDefault theme for GnuSocialDefault theme for GnuSocial

Installing a Custom Theme

Let's install the open source Neo Quitter theme, which resembles Twitter:

Edit the configuration file and add an entry for the Neo Quitter theme:

It should look like this:

Paste in this line:

Return to the home page and it should look more like this:

The NeoQuitter themeThe NeoQuitter themeThe NeoQuitter theme

Getting Started with GNU Social

Registering Your Account

It's time to register at your own social networking site:

Registering with GnuSocial Neo-Quitter themeRegistering with GnuSocial Neo-Quitter themeRegistering with GnuSocial Neo-Quitter theme

Once you register, you'll be greeted with this helpful getting started page:

Welcome page in GnuSocial with Neo-Quitter ThemeWelcome page in GnuSocial with Neo-Quitter ThemeWelcome page in GnuSocial with Neo-Quitter Theme

After uploading my avatar, here's what it looks like to post a status update with a photo:

GnuSocial PostingGnuSocial PostingGnuSocial Posting

I'm not quite sure what clicking the padlock open and closed does, as privacy seems to be controlled by the dropdown box.

Here's my profile page with my first post:

GnuSocial Profile PageGnuSocial Profile PageGnuSocial Profile Page

Look like any common social networking site that you know? 

The relative polish and finish of GNU Social compared to the other networks covered in part one is the reason I chose to focus on it for further exploration.

Experimenting With the Federated Network

Next, I wanted to experiment with the federated networking features of GNU Social. I jumped over to, a GNU Social site open to the public, and followed the username of the first person I found there.

On your own site, you have to visit your profile page, then click Following +Remote in the right column (it's not quite intuitive):

Remote Follow on the Profile Page - GnuSocialRemote Follow on the Profile Page - GnuSocialRemote Follow on the Profile Page - GnuSocial

To follow a remote user, you create an address combining their remote user name with the domain of the remote network site e.g.

Remote Follow Subscribe Form - GnuSocialRemote Follow Subscribe Form - GnuSocialRemote Follow Subscribe Form - GnuSocial

While the performance is relatively slow (this Quitter is in Iceland), we were able to exchange @replies and my GNU Social account appeared in the followers list. When I logged in the next day, their updates showed up on my GNU Social installation:

My public timeline with remote updates GnuSocialMy public timeline with remote updates GnuSocialMy public timeline with remote updates GnuSocial

Here's what it looked like a few hours later, after following a couple more remote people:

Gnu Social Integrated Timeline LaterGnu Social Integrated Timeline LaterGnu Social Integrated Timeline Later

Competing With Facebook and Twitter

The Basic Challenge

Here are some of the qualities that I think are important for an open source social networking system to gather popular support and adoption:

  • Simple installation for low-skilled developers. For example, it should be easy for anyone with PHP and basic Linux knowledge to quickly install. It should approach the ease of installing self-hosted WordPress.
  • Single and multi-user options. Ideally, the platform should support running a social installation for just one user (the installer) or as a network that supports a community of many users.
  • Paid hosting option to allow interested non-technical users to participate. For example, I like the way the Ghost blogging platform offers a paid SaaS option.
  • Elegant posting user interface (text, photos, eventually video) and support for looking up meta tags from URLs. This is one of the most critical and overlooked features in today's open source offerings.
  • Simple end user experience. The interface should be as simple to use as Facebook and Twitter.
  • Good performance. The common operations, e.g. posting, uploading photos, following, browsing the timeline, and getting timeline updates should all be fast.
  • Publishing to Twitter and Facebook. The platform should allow users to mirror their local posts to their existing networks in an automated or semi-automated way.
  • Support Theming. Users should be able to personalize their network look and feel.
  • Backup strategy. The platform should include built-in backup capability, ideally with some cloud option such as S3.
  • Analytics integration. It should be easy for users to get data about the activity of their feeds.
  • Solid code architecture, e.g. MVC architecture and/or use of a common framework.
  • Great documentation on the codebase.
  • Semi-automated upgrades. It's important to make the upgrade cycle easy for people to keep the codebase up to date across the network.

Advanced Capabilities

Furthermore, so many aspects of what make Facebook and Twitter successful and dominant are subtle or invisible to us. Just for example, here are a few important ones:

  • High performance across the network
  • High throughput for uploading images (and possibly video)
  • Fault tolerance to usage
  • Never losing data

While the distributed nature of open source federated networks can help with limiting the damage from a single node failure, it also increases the complexity of solving performance challenges and managing the user experience, as the network interacts with a variety of installed nodes.

A Bridge to Existing Networks

To speed adoption, it may also be important for these networks to import feeds from Twitter (and possibly Facebook). For example, if you switch from Twitter to your own social network, you may be the first of your friend group. You'll probably want to continue to receive updates and notifications, receive follow requests, and mirror replies from the old network within your site—without having to return to Twitter.

Current Twitter API technology (User Streams) supports this as a technical possibility for individual users, but it requires their permission to support for a group of users (Site Streams). See Building with the Twitter API (Tuts+). I presume it's unlikely Twitter will grant Site Stream permission for this kind of interoperability.

Evaluating GNU Social

Basic Assessment

GNU Social does a lot well but leaves significant room for improvement. It does a good job keeping the feature set narrow and implementing the basics well.

The installation of the codebase could be improved still further. Ideally, there should be packages that can be installed more quickly. Eventually, I'd like to see an installation and maintenance guide for non-technical users. 

There are numerous networks where you can register for a free account and try out the platform. In the future, it would be nice to see providers offer to install and maintain the networks for people on a paid basis.

While the code base is clean, it's not clearly using a standard framework.

GNU Social can be operated for single users or as a community. Support for OStatus seems to work well. And there's support for themes.

The posting interface is clean but doesn't offer any lookups for URLs. There does not seem to be any support for meta tags, Open Graph tags, or Twitter cards.

The end user experience is relatively simple, but it can still be improved. For example, following remote users wasn't straightforward from the home timeline. I had to navigate to my profile page to follow remote users.

The performance was painful when it came to connecting to remote networks—possibly because I was connected to an Iceland-based server. It's probably important that all of these operations be queued as background tasks.

There isn't much maturity around mirroring to Twitter and Facebook, backups, and analytics, but this may come with time.

Final Thoughts

GNU Social is in a place where PHP enthusiasts could adopt it, launch their own sites, and contribute to the codebase. I also feel the open source team behind GNU Social could make great progress by keeping the feature set narrow and focusing on polishing what they have. Delivering a super solid, well-architected, well-documented codebase that can re-create Twitter in a federated fashion would be a significant accomplishment, and they are well on their way there.

While GNU Social is built to support OStatus, there is an active working group at W3C Social Web Working Group; you can follow their work on Twitter @socialwebwg.

Please feel free to post your questions and comments below. This is a wide topic area and I'm sure there's a lot that I've missed. You can also reach me on Twitter @reifman or email me directly. Follow my Tuts+ instructor page to see future articles in this series.

Related Links

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.