Installing GNU Social with SSL on Debian 7 Wheezy

Yesterday I got my instance of GNU Social up and running on a Debian 7 server and I thought to document the steps I took in order to have a functional GNU Social instance.

First make sure you have the GLAMP (GNU/Linux Apache MySQL PHP) stack installed, with php 5.5 or higher.

nano /etc/apt/sources.list

Then add the following lines:

deb http://packages.dotdeb.org wheezy-php55 all
deb-src http://packages.dotdeb.org wheezy-php55 all

save and run the following:

wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg

Then install the packages:

apt-get update
apt-get install apache2 php5 php5-mysql php5-gd php5-curl php5-intl mysql-server git sendmail-bin

Now it’s time to create a database and a user for our GNU Social instance.
Log in to mysql server:

mysql -u root -p

And execute the following SQL query:

CREATE DATABASE gnusocial;
GRANT ALL ON gnusocial.* to 'gnusocial' IDENTIFIED BY 'your_password_here';
FLUSH PRIVILEGES;

Now download GNU Social and place it in /var/www/gnusocial

git clone https://git.gnu.io/gnu/gnu-social.git /var/www/gnusocial

Then give the user www-data ownership to the gnusocial folder:

chown -R www-data:www-data /var/www/gnusocial

Now let’s create an apache2 virtual host for our instance

touch /etc/apache2/sites-available/gnusocial

and edit the configuration to match our installation

nano /etc/apache2/sites-available/gnusocial
<VirtualHost *:80>
  ServerAdmin email@example.com
  ServerName example.com
  DocumentRoot /var/www/gnusocial
  DirectoryIndex index.php
</VirtualHost>

And activate the php module and the site with the following commands

a2enmod php5
a2ensite gnusocial
service apache2 reload

Now you can try to access your website domain (e.g. http://example.com) and you will see a page that informs you that you need to make a configuration file and start the installer.
Before continuing the GNU Social installation we are going to enable fancy URLs and SSL
In order to enable Fancy URLs we have to use the provided .htaccess file

mv /var/www/gnusocial/htaccess.sample /var/www/gnusocial/.htaccess

In order to have SSL encryption we will use a Let’s Encrypt certificate generated by their automated script.
So let’s go to work.

cd ~
git clone https://github.com/letsencrypt/letsencrypt letsencrypt
cd letsencrypt
./letsencrypt-auto --help

Now run the following command and follow on-screen wizard to install the Let’s encrypt certificates.

./letsencrypt-auto --apache

If it complains about outdated libaugeas0 and augeas-lenses you can download and install the packages from jessie (I assune you’re runing on a X86_64 installation, otherwise just find the links on http://packages.debian.org) :

cd ~
wget http://security.debian.org/debian-security/pool/updates/main/g/glibc/libc6_2.19-18+deb8u3_amd64.deb
wget http://ftp.no.debian.org/debian/pool/main/a/augeas/libaugeas0_1.2.0-0.2+deb8u1_amd64.deb
wget http://ftp.no.debian.org/debian/pool/main/a/augeas/augeas-lenses_1.2.0-0.2+deb8u1_all.deb
dpkg -i *.deb

Then run again :

./letsencrypt-auto --apache

Now after all these steps are followed you can proceed with the GNU Social installation wizard by visiting the GNU Social installation page (e.g. example.com/install.php)

After that you may want to change the theme of GNU Social to neo-quitter by adding the following line to the config.php

$config['site']['theme'] = 'neo-quitter';

If you would like to follow me on GNU Social, please do so at the following address: https://social.serbanescu.dk

References:
https://www.dotdeb.org/instructions/
https://karp.id.au/social/admin/installing.html
https://levlaz.org/installing-gnu-social-on-a-debian-server/
https://letsencrypt.org/getting-started/
https://github.com/hannesmannerheim/neo-quitter
http://code.tutsplus.com/tutorials/revisiting-open-source-social-networking-installing-gnu-social–cms-22456

5 thoughts on “Installing GNU Social with SSL on Debian 7 Wheezy”

  1. Daniel, I really like your straight forward approach to installing GNU Social and the easy to follow steps you have described in this guide.

    May I suggest the following:

    — using the GLAMP term instead of LAMP? It stands for GNU/Linux+Apache+MySQL+PHP
    http://www.gnu.org/philosophy/words-to-avoid.en.html#LAMP

    — providing the address of your GNU Social profile so people reading your guide can follow you? It’s true it’s easy to guess (subdomain social dot this domain), but a link would help people avoid the guess work and it would help you get more people watching your work.

    — using MariaDB instead of MySQL? MariaDB is the nonprofit project which continues the libre version of MySQL prior to acquisition by Oracle.

    — using Trisquel as server instead of Debian? It’s a stable , FSF-endorsed fully libre distro based on Ubuntu and Debian.

    Oh, I almost forgot: thanks for telling me about dotdeb.org!

    Excellent guide, I will recommend it to Ceata community in the hope it will inspire other people to have the courage to setup their own instance of GNU Social, because you make it look simple enough!

    Thanks :-)

    1. Thanks for your suggestions Tiberiu,
      I corrected the terminology as you suggested and I am looking to switch from Debian 7 to Debian 8, or maybe Trisquel 8 … it’s just hard to find a company providing Trisquel as a VPS choice. Please let me know if you know one.

      When I will make the switch I will definately use MariaDB instead of MySQL.

      1. Daniel, thank you for the update!

        For running a Trisquel virtual machine, maybe you don’t need the cooperation of the hosting company. The “trisquelize” script can transform from within an Ubuntu system into a Trisquel one with the corresponding version. I recommend migration from Ubuntu 14.04 to Trisquel 7, because it’s the latest version of Trisquel and it’s supported until 2019.

        https://en.wikipedia.org/wiki/Trisquel#Release_history
        https://trisquel.info/en/wiki/migrate-ubuntu-trisquel-without-reinstalling

        Please note that best for software freedom and privacy is to have your own self-hosted mini computer as server. Tehnoetic.com is working building such a hardware product.

        In the event you will try to use the trisquelize script, please let us, your blog readers, know if you have succeeded. Thanks!

        As for MariaDB, you can install it on any popular GNU system distribution. The foundation provides their own repositories, I’m not sure if MariaDB packages are provided by the system distributions.

        https://downloads.mariadb.org/mariadb/repositories/

        For the migration from MySQL to MariaDB, I found a version compatibility page and a migration tutorial:

        https://mariadb.com/kb/en/mariadb/moving-to-mariadb/
        https://mariadb.com/blog/how-migrate-mysql-mariadb-linux-five-steps

        If you try to migrate from MySQL to MariaDB, please let us know how that worked. Thanks!

        1. Thanks a lot for your suggestions. I am not sure I can run the trisquelize script successfully on a VPS because as far as I know you can not change the kernel of an OpenVZ VPS, maybe I am able to do that on a KVM or XEN VPS instance. I need to do some digging before doing that and I will definitely document it if I am going to succeed.

          I know it is better to have the server physically in a place I control but for now it is just not feasible for me.

          Thanks for the tips for MariaDB.

          1. Thank you for your reply, Daniel! I think you are right about OpenVZ, because the guest operating system is only a container isolated inside the real operating system. Please let us know if you succeed to trisquelize Ubuntu in a KVM or XEN-based virtual machine.

Leave a Reply

Your email address will not be published. Required fields are marked *