Friendica is a free, open-source distributed social network that allows users to connect and communicate with friends and family. In this tutorial, we will show you how to install Friendica on Alpine Linux Latest.
Before we begin, ensure that you have the following prerequisites:
First, run the following command to update your system:
sudo apk update && sudo apk upgrade
This will update all the packages currently installed on your system.
Now, let’s install the required packages for Friendica. Run the following command:
sudo apk add nginx php7 php7-curl php7-dom php7-fpm php7-gd php7-json php7-mbstring php7-mysqli php7-pdo php7-pdo_mysql php7-zlib mariadb mariadb-client openrc
This will install the necessary packages for Friendica to run.
Now, we will download and install Friendica. Run the following command to download the latest release of Friendica:
wget https://github.com/friendica/friendica/archive/refs/tags/2021.05.tar.gz
Once the download is complete, extract the archive using the following command:
tar -xzf 2021.05.tar.gz
Now, move the extracted content to the /var/www
directory like this:
sudo mv friendica-2021.05 /var/www/friendica
Ensure that the www-data
user owns the directory with the following command:
sudo chown -R www-data:www-data /var/www/friendica
In this step, we will configure MariaDB to work with Friendica. Run the following command to secure your MariaDB instance:
sudo mysql_secure_installation
Answer "yes" to all questions, and set a strong password for the root user.
Now, log in to the MariaDB console with the following command:
sudo mysql -u root -p
Once logged in, create a new database with the following command:
CREATE DATABASE friendica;
Create a new user with the following command:
CREATE USER 'friendica'@'localhost' IDENTIFIED BY 'password';
Ensure that the new user has access to the database with the following command:
GRANT ALL PRIVILEGES ON friendica.* TO 'friendica'@'localhost';
Then, exit the console with the following command:
exit
In this step, we will configure Nginx and PHP to work with Friendica. Run the following command to create a new configuration file at /etc/nginx/conf.d/friendica.conf
:
sudo nano /etc/nginx/conf.d/friendica.conf
Add the following lines to the file:
server {
listen 80;
server_name example.com; ## Replace with your domain name
root /var/www/friendica;
index index.php;
access_log /var/log/nginx/friendica.access.log;
error_log /var/log/nginx/friendica.error.log;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php7-fpm.sock;
}
}
Save and close the file.
Next, open the PHP-FPM configuration file with the following command:
sudo nano /etc/php7/php-fpm.d/www.conf
Change the listen
parameter to match the following:
listen = /run/php7-fpm.sock
Uncomment the following line:
;listen.owner = www-data
Then, save and close the file.
Finally, start the Nginx and PHP-FPM services with the following commands:
sudo rc-update add nginx
sudo rc-update add php-fpm7
sudo rc-service nginx start
sudo rc-service php-fpm7 start
You can now complete the installation of Friendica by accessing your server’s IP address or domain name in your web browser. Follow the instructions provided by the installer to complete the installation process.
In this tutorial, we showed you how to install Friendica on Alpine Linux Latest. You now have a working instance of Friendica that you can use for distributed social networking.
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!
Alternatively, for the best virtual desktop, try Shells!