How to Install Friendica on POP! OS Latest?

Friendica is a free, open-source, decentralized social network software. It provides many features that are similar to those of Facebook, Twitter or LinkedIn. POP! OS is a Linux distribution that is based on Ubuntu. In this tutorial, I will guide you on how to install Friendica on POP! OS.

Prerequisites

Before starting with the installation process, make sure that you have the following:

Step 1: Update and Upgrade Operating System

It's always best to update and upgrade your operating system before installing any new software. Run the following command on the terminal to update and upgrade your POP! OS:

sudo apt-get update && sudo apt-get upgrade -y

Step 2: Install LAMP Stack

Friendica requires a LAMP (Linux, Apache, MySQL, PHP) stack to run on your system. Run the following command to install the LAMP stack:

sudo apt-get install apache2 mysql-server php php-mysql php-curl php-gd php-mbstring php-xml libapache2-mod-php -y

The above command will install Apache web server, MySQL database server, PHP, and required PHP extensions.

Follow the prompt to set the MySQL server root password.

Step 3: Configure Apache for Friendica

After completing the installation of the LAMP stack, we need to configure Apache for Friendica. Here are the steps to do that:

  1. Create a new virtual host configuration file for Friendica:
sudo nano /etc/apache2/sites-available/friendica.conf
  1. Add the following configurations in the friendica.conf file:
<VirtualHost *:80>
    ServerAdmin your-email@example.com
    ServerName your-domain.com
    DocumentRoot /var/www/friendica

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

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

Make sure to replace your-email@example.com, your-domain.com with your own email address and domain name.

  1. Save and close the file.

  2. Enable the virtual host:

sudo a2ensite friendica.conf
  1. Disable the default virtual host configuration:
sudo a2dissite 000-default.conf
  1. Restart Apache web server to apply the changes:
sudo systemctl restart apache2

Step 4: Download and Extract Friendica

Now, we need to download and extract the Friendica source code. Run the following commands on the terminal to do that:

cd /var/www/
sudo rm -rf html
sudo git clone https://github.com/friendica/friendica.git
sudo mv friendica/ html/
cd html/
sudo git checkout stable
sudo chown -R www-data:www-data /var/www/html/

The above commands will delete the default Apache web server document root that contains the index.html file and download Friendica from the Github repository to /var/www/html.

Step 5: Configure Friendica

After successfully extracting Friendica, we need to configure it. Follow the steps below to do that:

  1. Copy Friendica's sample configuration file:
cd /var/www/html/
sudo cp .htconfig.php.sample .htconfig.php
  1. Edit the .htconfig.php file:
sudo nano .htconfig.php
  1. Update the database configuration:
$config['system']['url'] = 'http://your-domain.com';
$config['system']['db_host'] = 'localhost';
$config['system']['db_user'] = 'root';
$config['system']['db_pass'] = 'your-mysql-root-password';
$config['system']['db_database'] = 'friendica';
  1. Save and close the configuration file.

Step 6: Create the Friendica Database

After configuring Friendica, we need to create the database required for Friendica to work. Run the following command to create the database:

sudo mysql -u root -p

Enter the MySQL root password when prompted.

CREATE DATABASE friendica CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL ON friendica.* TO 'friendica'@'localhost' IDENTIFIED BY 'your-database-password';
FLUSH PRIVILEGES;
exit;

Replace your-database-password with your preferred password.

Step 7: Install Friendica Dependencies

Friendica requires some dependencies to work. Run the following command to install them:

sudo apt-get install libfile-fcntllock-perl libyaml-libyaml-perl liblwp-useragent-determined-perl libdatetime-format-w3cdtf-perl libnet-dns-perl libcrypt-openssl-rsa-perl libxml-twig-perl libproc-processtable-perl libstring-approx-perl libjson-any-perl libomnibus-perl -y

Step 8: Configure SELinux

If you have SELinux enabled on your system, then you need to change the context of the Friendica directory. Run the following command to do that:

sudo chcon -Rv --type=httpd_sys_content_t /var/www/html/

Step 9: Start Friendica

Now, we can start Friendica by accessing the URL http://your-domain.com. Follow the on-screen instructions to complete the setup.

Congratulations, Friendica is now installed and running on your POP! OS Latest system.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!