How to Install Shaarli on Elementary OS

Shaarli is an open-source bookmarking application that allows users to store and share links with others. In this tutorial, we'll go through the steps required to install Shaarli on Elementary OS.

Prerequisites

Before we dive into installing Shaarli, let's make sure we have everything we need:

Installing Dependencies

First of all, we need to make sure all required packages are installed on our system. Open the terminal and type in the following commands to install the required dependencies:

sudo apt update
sudo apt install apache2 php7.0 php7.0-curl php7.0-mysql mariadb-server mariadb-client git

Configuring the Database

Next, we need to create a database for Shaarli to store its data. Run the following command to access the MySQL shell:

sudo mysql -u root

Once in the MySQL shell, execute the following commands to create the database and user for Shaarli:

CREATE DATABASE shaarli;
CREATE USER 'shaarli'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON shaarli.* TO 'shaarli'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Make sure to replace "yourpassword" with a strong password.

Downloading and Installing Shaarli

Now that we have all the required packages installed and the database is configured, let's download and install Shaarli:

sudo git clone https://github.com/shaarli/Shaarli.git /var/www/html/shaarli

This command will download the Shaarli repository to /var/www/html/shaarli directory, which is the default web root directory for Apache.

Configuring Shaarli

Next, we need to configure Shaarli to use the database we just created. Navigate to the Shaarli directory:

cd /var/www/html/shaarli

Copy the Shaarli configuration file:

sudo cp config.default.php config.php

Open the config.php file in your text editor and update the following lines:

define('LINKS_STORAGE_FOLDER', '/var/www/html/shaarli/data/');
define('LINKS_DATABASE', 'shaarli');
define('LINKS_DB_USER', 'shaarli');
define('LINKS_DB_PASSWORD', 'yourpassword');

Change yourpassword to the password you set earlier.

Finishing up

We're nearly there! Now we just need to fix the file permissions for Shaarli to work:

sudo chown -R www-data: /var/www/html/shaarli/
sudo chmod -R 755 /var/www/html/shaarli/

Finally, restart Apache to apply the changes:

sudo systemctl restart apache2

Shaarli should now be accessible on http://localhost/shaarli.

Conclusion

You now have Shaarli installed on your Elementary OS machine and should be able to start using it to store and share your bookmarks. From here, you can customize Shaarli further by adding themes or plugins.

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!