Roll Your Own Twitter Alternative with GNU Social 🌱

  1. Log into the Debian device
  2. Run the following commands in a terminal:
    # update software repositories
    sudo apt update
    # install software updates
    sudo apt upgrade -y
    # install Apache and MySQL
    sudo apt install apache2 mariadb-server mariadb-client -y
    # install PHP components
    sudo apt install php7.3 libapache2-mod-php7.3 php7.3-curl php7.3-mbstring php7.3-xml php7.3-fpm php7.3-gd php7.3-gmp php7.3-intl php7.3-mysql php7.3-json -y
    # download gnu social
    wget -O ~/Downloads/gnu-social-master.tar.gz https://git.gnu.io/gnu/gnu-social/-/archive/master/gnu-social-master.tar.gz
    # extract the tar.gz
    tar zxf ~/Downloads/gnu-social-*.tar.gz --directory ~/Downloads
    # move the folder to web root
    sudo mv ~/Downloads/gnu-social-*/ /var/www/html/gnusocial
    # set permissions
    sudo chown -R www-data:www-data /var/www/html/gnusocial/
    sudo chmod g+w /var/www/html/gnusocial/
    # configure the MySQL database
    sudo su
    mysql_secure_installation
  3. Press Enter to login as root
  4. Type Y and press Enter to set a root password, type the password twice to confirm
  5. Type Y and press Enter to remove anonymous users
  6. Type Y and press Enter to disallow root login remotely
  7. Type Y and press Enter to remove the test database
  8. Type Y and press Enter to reload privilege tables
  9. Run the following command to login into MySQL:
    mysql -u root -p
  10. Authenticate with the root password set earlier
  11. Run the following commands to create the GNU Social database and database user
    CREATE DATABASE gnusocial CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'gnusocial_rw'@'localhost' IDENTIFIED BY 'gnu$ocia1!!';
    GRANT ALL PRIVILEGES ON gnusocial.* TO 'gnusocial_rw'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
    exit
  12. Continue with the following commands:
    # edit default apache conf
    sudo nano /etc/apache2/sites-available/000-default.conf
  13. Paste the following at the bottom of the .conf file
    <Directory /var/www/html/gnusocial/>
    AllowOverride all
    </Directory>
  14. Press CTRL+O, Enter, CTRL+X to write the changes
  15. Continue with the following commands:
    # enable .htaccess in ./gnusocial
    sudo cp /var/www/html/gnusocial/htaccess.sample /var/www/html/gnusocial/.htaccess
    # set the relative path in .htaccess
    sudo sed -i "s/RewriteBase \//RewriteBase \/gnusocial\//g" /var/www/html/gnusocial/.htaccess
    # enable apache2 modules
    sudo a2enmod rewrite
    # restart apache2
    sudo systemctl restart apache2
  16. Open a web browser and navigate to http://DNSorIP/gnusocial/install.php
  17. The GNU Social installation screen should be displayed
  18. Enter a site name and fill out the database connection information as follows

    Hostname: localhost
    Name: gnusocial
    DB username: gnusocial_rw
    DB password: gnu$ocia1!!

  19. Enter an administrator username, password and email
  20. Click the Submit button
  21. After the installation completes, click the visit your new GNU social site link toward the bottom of the page
  22. Click Login at the top right of the page
  23. Login with the administrator user created during initialization
  24. Welcome to GNU Social

Source: https://git.gnu.io/gnu/gnu-social/blob/master/INSTALL