How to Install Friendica Social Network Platform on Ubuntu 22.04

Friendica formerly known as Friendika is an open-source and decentralized communications platform that allows you to build your own social networking platform on the web. It aims to connect friends, acquaintances, or simply people with the same interests in groups of members. It is an alternate solution for other social network platforms such as Mastodon, Twitter, and Diaspora. You can import your websites and blogs into your social stream via RSS/Atom feeds.

This guide will explain how to install the Friendica social network with Apache on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A valid domain name is pointed to your server IP.
  • A root password is configured on the server.

Getting Started

First, update and upgrade all system packages to the latest version using the following command:

apt update -y
apt upgrade

Once all the packages are updated, you can proceed to the next step.

Install Apache, MariaDB, and PHP

Friendica is written in PHP and uses MySQL as a database backend. So you will need to install the LAMP server on your system. You can install it with the following command:

apt install apache2 mariadb-server php 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 curl git -y

After installing all the packages, edit the php.ini file and change the default settings:

nano /etc/php/8.1/apache2/php.ini

Change the following lines:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 300
max_input_vars = 1500
date.timezone = UTC

Save and close the file when you are finished.

Configure MariaDB Database

Next, you will need to create a database and user for Friendica. First, connect to MySQL with the following command:

mysql

Once you are done, create a database and user with the following command:

MariaDB [(none)]> CREATE DATABASE friendica;
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 friendica.* TO 'friendica'@'localhost' WITH GRANT OPTION;

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

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

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

Install Friendica on Ubuntu 22.04

First, download the latest version of Friendica from the Git repository to the Apache web root directory:

cd /var/www/html
git clone https://github.com/friendica/friendica-addons.git -b stable

Once the download is completed, change the directory to friendica and install the required PHP dependencies with the following command:

cd friendica
./bin/composer.phar install --no-dev

Next, download the Friendica addons with the following command:

git clone https://github.com/friendica/friendica-addons.git

Next, rename the addon directory and .htaccess file.

mv friendica-addons addon
mv .htaccess-dist .htaccess

Next, set proper ownership and permission to the friendica directory:

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

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

Create an Apache Virtual Host

Next, you will need to create an Apache virtual host configuration file to host 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}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Save and close the file then enable the Apache virtual host and rewrite module with the following command:

a2ensite friendica.conf
a2enmod rewrite

Next, reload the Apache service to apply the changes:

systemctl restart apache2

You can verify the status of the Apache service with the following command:

systemctl status apache2

You should get the following output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-12-21 10:33:18 UTC; 6s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 57027 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 57031 (apache2)
      Tasks: 6 (limit: 2238)
     Memory: 15.8M
        CPU: 43ms
     CGroup: /system.slice/apache2.service
             ??57031 /usr/sbin/apache2 -k start
             ??57032 /usr/sbin/apache2 -k start
             ??57033 /usr/sbin/apache2 -k start
             ??57034 /usr/sbin/apache2 -k start
             ??57035 /usr/sbin/apache2 -k start
             ??57036 /usr/sbin/apache2 -k start

Dec 21 10:33:18 ubuntu2204 systemd[1]: apache2.service: Deactivated successfully.
Dec 21 10:33:18 ubuntu2204 systemd[1]: Stopped The Apache HTTP Server.
Dec 21 10:33:18 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

At this point, the Apache web server is installed and configured. You can now proceed to the next step.

Install Let's Encrypt SSL

It is always a good idea to secure your website with Let's Encrypt SSL. You will need to install the Certbot client to install and manage the SSL.

First, install the Snap package manager with the following command:

apt install snapd

Next, update the Snap package to the latest version:

snap install core
snap refresh core

Next, install the certbot package using the following command:

snap install --classic certbot

Next, create a symbolic link for the Certbot binary to the system location:

ln -s /snap/bin/certbot /usr/bin/certbot

Next, run the following command to download and install Let's Encrypt SSL certificates:

certbot --apache

You will be asked to accept the term of service and provide your valid email address.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
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.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, 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
Account registered.

Next, you will be asked to select the domain on which you want to install the Let's Encrypt SSL:

Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: friendica.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1

Type 1 to select the default domain and press the Enter key to install SSL on your website.

Requesting a certificate for friendica.linuxbuz.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/friendica.linuxbuz.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/friendica.linuxbuz.com/privkey.pem
This certificate expires on 2023-03-21.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for friendica.linuxbuz.com to /etc/apache2/sites-available/friendica-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://friendica.linuxbuz.com
We were unable to subscribe you the EFF mailing list because your e-mail address appears to be invalid. You can try again later by visiting https://act.eff.org.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Access Friendica Web UI

Now, open your web browser and access the Friendica web interface using the URL https://friendica.linuxbuz.com. You will be redirected to the system check page:

Ensure all the PHP dependencies are installed then click on the Next button. You should see the following page:

Provide your domain name, and installation path, and click on the Submit button. You should see the following page:

Provide your database name, database username, password, and click on the Submit. You should see the Site setting page:

Provide the administrator's email, language, time zone, and click on the Submit button. Once the installation has been completed, you should see the following page:

Now, click on the registration page button. You should see the following page.

Provide all required information and click on the Sign Up Now button. You should see the following page containing your username and password.

Now, open your web browser and access the Friendica login page using the URL https://friendica.linuxbuz.com. You should see the Friendica login page.

Provide your login username, password and click on the Login button. You should see the Friendica dashboard on the following page.

Conclusion

Congratulations! You have successfully installed and configured the Friendica social network platform on an Ubuntu 22.04 server. You can now manage your social network community from the central location. Feel free to ask me if you have any questions.

Share this page:

0 Comment(s)