How to Install Friendica on Void Linux
Friendica is a free and open-source social networking platform that allows users to manage and share their information on various social networking sites, including Facebook, Twitter, and others. In this tutorial, we will guide you through the steps to install Friendica on Void Linux.
Prerequisites
Before we start with the installation process, we need to ensure that the following prerequisites are met:
- A running instance of Void Linux.
- A user account with administrative privileges or the root user.
Step 1 - Installation of Required Packages
To install Friendica on Void Linux, we need to first install some necessary packages. Open the Terminal window and run the following command to update package lists:
sudo xbps-install -S
Next, run the following command to install the required packages:
sudo xbps-install -y mariadb mariadb-client lighttpd php php-fpm php-mysqlnd php-gd php-mbstring php-curl
It will install the MariaDB database server, Lighttpd webserver, and some necessary PHP modules required for Friendica.
Step 2 - Installation of Composer
Composer is a PHP package manager that is used to manage dependencies in PHP applications. To install Composer, run the following command:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
Once installed, check the version of Composer by running the following command:
composer -V
You should see the Composer version displayed if it has been installed successfully.
Step 3 - Creating a MariaDB Database and User
We need to create a new database and a user for Friendica to use. To do so, use the following commands to log in to the MariaDB server:
sudo mysql -u root
Now, create a new database for Friendica by running the following command:
CREATE DATABASE friendica_db;
Next, create a new user for Friendica and grant privileges to the newly created database:
CREATE USER 'friendica_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON friendica_db.* TO 'friendica_user'@'localhost';
FLUSH PRIVILEGES;
Ensure to replace the "password" with a secure password for the 'friendica_user' account.
Step 4 - Download and Install Friendica
To download and install Friendica, we need to run the following commands:
sudo mkdir /var/www && cd /var/www
sudo git clone https://github.com/friendica/friendica.git friendica
cd friendica
sudo -HEu www-data composer install
sudo cp .htaccess-dist .htaccess
sudo cp config/sample.config.php config/config.php
sudo chmod -R 777 view/theme/frio/cache/
sudo chmod -R 777 store/
In the above commands:
- We create a new directory
/var/wwwand move to this directory. - We clone the Friendica repository from GitHub.
- We move to the cloned directory and install dependencies using
composer. - We copy the
.htaccess-distfile to.htaccess. - We copy the sample configuration file to the application directory and rename it to
config.php. - We set the permission of
view/theme/frio/cacheandstoredirectories to777.
Step 5 - Setup Friendica
To set up Friendica, we need to edit the config.php file. For this, open the file using your text editor:
sudo nano /var/www/friendica/config/config.php
Scroll down to the database settings section, and update the following settings according to the database created in Step 3:
db_host: Change it to 'localhost'.db_user: Change it to 'friendica_user'.db_pass: The password used for the 'friendica_user' account.db_data: The name of the database, i.e., 'friendica_db'.
Save and close the file by pressing Ctrl + X, then Y and press Enter.
Step 6 - Configure Lighttpd Web Server
The default Lighttpd configuration file needs some changes to enable the Friendica application. Open the configuration file using the following command:
sudo nano /etc/lighttpd/lighttpd.conf
Add the following lines of configuration at the end of the file:
server.document-root = "/var/www/friendica"
server.error-handler-404 = "/index.php"
url.rewrite-if-not-file = (
"^/([^?]*)(\?(.*))?$" => "/dfrn_poll.php?fragment=$1&$3"
)
Save and close the file.
Step 7 - Restart Services
We need to restart the web server and PHP-FPM services to pick up the changes made. To restart these services, run the following commands:
sudo systemctl restart lighttpd.service
sudo systemctl restart php-fpm.service
Step 8 - Access Friendica
Now, launch your web browser and go to http://your_server_IP_address. If everything has been configured correctly, you should see the Friendica home page.
Enter your details to create a new account or use an existing account to log in and start using Friendica.
Congratulations! You have successfully installed Friendica on Void Linux.