How to Install Friendica on Debian

Friendica is a free, open-source and decentralized social networking platform that helps you to build your own social networking projects and communities. It allows you to import arbitrary websites and blogs into your social stream via RSS/Atom feeds. It has support for ActivityPub, Mastodon, OStatus, Funkwhale, Pleroma and diaspora* protocols. You can also use Friendica as a publishing platform to post content on Libertree, WordPress and Tumblr. It also allows you to tag users and groups via "@ mentions", hashtags, comments, likes and reshares public posts.

In this tutorial, we will learn how to install Friendica Social Networking Platform on Debian 10.

Prerequisites

  • A server running Debian 10.
  • A root password is configured on your server.

Getting Started

First, update your system to the latest version with the following command:

apt-get update -y
apt-get upgrade -y

Once your server is updated, restart it to apply the changes.

Install LAMP Server

Before starting, the LAMP server must be installed on your server. If not installed, you can install it with other PHP dependencies with the following command:

apt-get install apache2 mariadb-server php php-cli libapache2-mod-php php-common php-gmp php-curl php-intl php-mbstring php-xmlrpc php-mysql php-gd php-imagick php-xml php-cli php-zip php-sqlite3 unzip git curl -y

Once all the packages are installed, edit php.ini file and make some changes:

nano /etc/php/7.3/apache2/php.ini

Change the following lines with your desired value:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Asia/Kolkata

Save and close the file when you are finished.

Configure MariaDB Database

By default, the MariaDB root password is not set. So you will need to set a root password and secure your MariaDB installation.

To do so, log in to MariaDB shell with the following command:

mysql

Once login, set a MariaDB root password with the following command:

MariaDB [(none)]> SET PASSWORD FOR 'root'@'localhost' = PASSWORD("newpassword");

Next, set the MariaDB authentication plugin to mysql_native_password with the following command:

MariaDB [(none)]> SET GLOBAL innodb_fast_shutdown = 0;
MariaDB [(none)]> UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE User = 'root';

Next, flush the privileges and exit from the MariaDB shell with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Next, log in to MariaDB shell with root user:

mysql -u root -p

Provide your root password when prompt then create a database and user for friendica with the following command:

MariaDB [(none)]> CREATE DATABASE friendicadb;
MariaDB [(none)]> CREATE USER 'friendica'@'localhost' IDENTIFIED BY 'password';

Next, grant all the privileges to the Friendica database with the following command:

MariaDB [(none)]> GRANT ALL ON friendicadb.* TO 'friendica'@'localhost' WITH GRANT OPTION;

Next, flush the privileges and exit from the MariaDB shell with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Once your database is configured, you can proceed to the next step.

Download Friendica

First, you will need to download the Friendica to your Apache web root directory. You can download it with the following command:

cd /var/www/html
wget https://github.com/friendica/friendica/files/2061623/friendica-full-2018.05.tar.gz

Once downloaded, extract the downloaded file with the following command:

tar -xvzf friendica-full-2018.05.tar.gz

Next, rename the extracted directory to friendica:

mv friendica-full-2018.05 friendica

Next, change the directory to friendica and download the Friendica addons with the following command:

cd friendica
wget https://github.com/friendica/friendica-addons/archive/2018.05.tar.gz

Once downloaded, extract the downloaded file with the following command:

tar -xvzf 2018.05.tar.gz

Next, rename the extracted directory to addon:

mv friendica-addons-2018.05 addon

Next, give proper permissions to the friendica directory:

chown -R www-data:www-data /var/www/html/friendica
chmod -R 775 /var/www/html/friendica

Once you are finished, you can proceed to the next step.

Configure Apache for Friendica

Next, you will need to create an Apache virtual host configuration file for Friendica.

You can create it with the following command:

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

Add the following lines:

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

     <Directory /var/www/html/friendica/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/friendica_error.log
     CustomLog ${APACHE_LOG_DIR}/friendica_access.log combined

</VirtualHost>

Save and close the file when you are finished. Then, enable the virtual host file and Apache rewrite module with the following command:

a2ensite friendica
a2enmod rewrite

Finally, restart the Apache service to apply the changes:

systemctl restart apache2

Secure Friendica with Let's Encrypt

It is recommended to secure your Friendica website with Let's encrypt free SSL. To do so, you will need to install the Certbot client in your system to install and manage Let's Encrypt SSL.

First, add the Certbot repository with the following command:

echo "deb http://ftp.debian.org/debian buster-backports main" >> /etc/apt/sources.list

Next, update the repository and install the Certbot Apache client with the following command:

apt-get update -y
apt-get install python3-certbot-apache -t buster-backports -y

Once installed, run the following command to install Let's Encrypt SSL for your domain:

certbot --apache -d friendica.linuxbuz.com

You will be prompt to accept the term of service and provide your valid email address as shown below:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for friendica.linuxbuz.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/friendica-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/friendica-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/friendica-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.

Next, you will need to choose whether or not to redirect HTTP traffic to HTTPS as shown below:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Type 2 and hit Enter to continue. Once the installation has been completed, you should get the following output:

Redirecting vhost in /etc/apache2/sites-enabled/friendica.conf to ssl vhost in /etc/apache2/sites-available/friendica-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://friendica.linuxbuz.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=friendica.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/friendica.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/friendica.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-04-30. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Once you are done, you can proceed to the next step.

Access Friendica Web Interface

Now, open your web browser and type the URL https://friendica.linuxbuz.com. You will be redirected to the following page:

Once all the requirements are met, click on the Next button. You should see the following page:

Provide your database credentials and click on the Submit button. You should see the following page:

Provide your email address, select your timezone, language and click on the Submit button. You should see the following page:

Click on the registration page. You should see the following page:

Provide your email address, password and click on the Sign up now button. You should see the following page:

Provide your email address, password and click on the Login button. You should see the Friendica dashboard in the following screen:

Conclusion

Congratulations! you have successfully installed and configured Friendica on Debian 10. You can now start building your social networking projects with Friendica.

Share this page:

0 Comment(s)