Libravatar is a free and open-source service that provides globally recognized avatars. It allows you to use the same avatar for all your accounts, independent of the website or service you use. This tutorial will guide you through the process of installing Libravatar on Arch Linux.
Before starting, make sure that you have the following prerequisites:
The first step is to update the system to the latest version using the following command in the terminal:
sudo pacman -Syu
Enter your user password and confirm the update to proceed.
Libravatar requires a web server and PHP. We'll use Apache for this tutorial.
You can install Apache and PHP using the following command:
sudo pacman -S apache php php-apache
Confirm the installation by pressing 'y' and 'Enter.'
Next, we need to configure Apache to serve the Libravatar website. Open the Apache configuration file in a text editor using the following command:
sudo nano /etc/httpd/conf/httpd.conf
Add the following lines at the end of the file:
LoadModule php7_module modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
<Directory "/srv/http/libravatar">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Save and close the file by pressing 'Ctrl+X' then 'Y' and Enter.'
The next step is to download and install Libravatar. You can download the latest version of Libravatar from their website.
wget https://github.com/libravatar/libravatar/archive/master.zip
Extract the contents of the file:
unzip ~/master.zip
Rename the directory:
mv ~/libravatar-master /srv/http/libravatar
Set the file permissions:
sudo chown -R http:http /srv/http/libravatar
sudo chmod -R 755 /srv/http/libravatar
Libravatar needs a MySQL database to store user information. We'll use MariaDB for this tutorial.
You can install MariaDB using the following command:
sudo pacman -S mariadb
Once installed, start the MariaDB service and enable it to start at boot:
sudo systemctl start mysqld.service
sudo systemctl enable mysqld.service
Next, we need to create a new database and a user:
sudo mysql -u root -p
CREATE DATABASE libravatar;
GRANT ALL PRIVILEGES ON libravatar.* TO 'libravatar'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
Replace "password" with a strong password of your choice.
In the next step, we need to import the database schema:
sudo mysql -u root -p libravatar < /srv/http/libravatar/schema.sql
Enter the MySQL root user password and press 'Enter.'
Next, we need to configure the database credentials in the Libravatar configuration file:
nano /srv/http/libravatar/config.php
Update the following values with your MySQL database information:
$cfg['db']['dsn'] = 'mysql:dbname=libravatar;host=localhost;charset=utf8';
$cfg['db']['user'] = 'libravatar';
$cfg['db']['pass'] = 'password';
Save and close the file.
Open your web browser and go to http://localhost/libravatar. You should see the Libravatar website.
To test if Libravatar is working, go to http://localhost/libravatar/avatar/[email-address].png. Replace [email-address] with a valid email address. You should see the avatar of the user associated with that email address.
Congratulations! You have installed and configured Libravatar on your Arch Linux system.
Note: This tutorial and guide was taken and modified from DigitalOcean's tutorial called "How To Install an Apache, MySQL, and PHP (LAMP) Stack on Arch Linux" by Mark Drake.
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!