How to Install Friendica from https://friendi.ca/ on Debian Latest

Friendica is a free and open-source social networking platform that allows users to connect with their friends across the internet. In this tutorial, we will guide you through the installation process of Friendica on Debian 11.

Prerequisites

Before you start, ensure that you have the following:

  • A VPS or a dedicated server running the latest version of Debian
  • SSH access to the server
  • A user account with root privileges

Updating and Upgrading Debian

It is always advisable to update and upgrade your system before proceeding to install any software. Use the following commands to update and upgrade your Debian system:

sudo apt update
sudo apt upgrade

Installing Required Dependencies

Before installing Friendica, we need to install required dependencies. Run the following command to install them:

sudo apt install apache2 mariadb-server php libapache2-mod-php7.4 php-pear php-mysql php-curl php-json php-xml php-mbstring php-zip php-gd

Installating Friendica

Visit the following page to download the latest Friendica version:

https://friendi.ca/download/

Extract the downloaded archive to the desired directory:

cd /var/www/html
sudo tar zxvf friendica_full_x.x.x.tar.gz

(where x.x.x is the version number)

Rename the friendica directory:

sudo mv friendica_full_x.x.x friendica

Set up the permissions of the Friendica directory:

sudo chown -R www-data:www-data /var/www/html/friendica/

Creating MariaDB Database for Friendica

Friendica requires a database to store its data. Run the following command to log in to the MySQL command line as the root user:

sudo mysql -u root -p

Create a new database and user for Friendica:

CREATE DATABASE friendica;
CREATE USER 'friendica'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON friendica.* TO 'friendica'@'localhost';
FLUSH PRIVILEGES;

Replace 'password' in the above command with a secure password.

Apache Configuration

Run the following command to enable the Apache rewrite module:

sudo a2enmod rewrite

Create a new Apache virtual host configuration file by running command:

sudo nano /etc/apache2/sites-available/friendica.conf

Add the following lines in the file:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/friendica
    ServerName your_domain.com
    ServerAlias www.your_domain.com

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/html/friendica>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =your_domain.com [OR]
    RewriteCond %{SERVER_NAME} =www.your_domain.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Replace your_domain.com with your actual domain name.

Save the file and exit.

To make this virtual host configuration active, run:

sudo a2ensite friendica.conf

Reload the Apache service:

sudo systemctl reload apache2

Friendica Configuration

Open your web browser and go to http://your_domain.com/install.php.

Configure the following settings:

  • Database Type : MariaDB (default)
  • Database Location : localhost (default)
  • Database Name : friendica (The name of the database that we created earlier)
  • Database Username : friendica (The username of the database that we created earlier)
  • Database Password : (The password that you used for the database user)
  • Salt : (Enter a random string to seed the password hashing system)
  • Base URL : http://your_domain.com (replace with your actual domain name)
  • Directory : /var/www/html/friendica (default)
  • Theme : (Choose a theme of your choice)

Click on the "Install Friendica" button.

After the installation is complete, delete the install.php file:

sudo rm /var/www/html/friendica/install.php

Conclusion

Congratulations! You have successfully installed Friendica on your Debian 11 server. You can now create your account and start using Friendica.