Tutorial: Installing Shaarli on macOS

Shaarli is a self-hosted bookmarking application that can help you manage and organize your bookmarks. In this tutorial, you will learn how to install Shaarli on a macOS operating system.

Requirements

Step 1: Installing Git

Shaarli is hosted on GitHub, so you will need to install Git on your macOS machine to fetch the source code.

To install Git, open the Terminal app and run the following command:

$ brew install git

If you do not have Homebrew installed on your machine, you can install it from the official website: https://brew.sh/

Step 2: Cloning Shaarli repository

After Git is installed, the next step is to clone the Shaarli repository from GitHub.

Open the Terminal app and navigate to the directory where you want to clone Shaarli. Then, run the following command:

$ git clone https://github.com/shaarli/Shaarli.git

The above command will clone the Shaarli repository to your current directory.

Step 3: Configuring Shaarli

To configure Shaarli, navigate to the root directory of the cloned repository and open the config.php file.

$ cd Shaarli/
$ cp config.default.php config.php
$ nano config.php

You can modify the configuration options according to your preference. The most important configuration options include the database connection details and security settings.

Step 4: Setting up the web server

To run Shaarli, you need to set up a web server such as Apache or Nginx.

Setting up Apache

If you are using Apache, make sure that the mod_rewrite module is enabled. You can enable it by running the following command:

$ sudo a2enmod rewrite

Next, create a new virtual host configuration file for Shaarli:

$ cd /etc/apache2/sites-available/
$ sudo nano shaarli.conf

Paste the following configuration into the file:

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /path/to/Shaarli/
    <Directory /path/to/Shaarli/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        allow from all
        </Directory>
    ErrorLog ${APACHE_LOG_DIR}/shaarli_error.log
    CustomLog ${APACHE_LOG_DIR}/shaarli_access.log combined
</VirtualHost>

Make sure to replace example.com with your own domain name and path/to/Shaarli/ with the actual path where Shaarli is installed.

Finally, enable the new virtual host configuration and restart Apache:

$ sudo a2ensite shaarli.conf
$ sudo systemctl restart apache2

Setting up Nginx

If you are using Nginx, create a new virtual host configuration file for Shaarli:

$ cd /etc/nginx/sites-available/
$ sudo nano shaarli

Paste the following configuration into the file:

server {
    listen 80;
    server_name example.com;

    root /path/to/Shaarli;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

Make sure to replace example.com with your own domain name and path/to/Shaarli/ with the actual path where Shaarli is installed.

Finally, enable the new virtual host configuration and restart Nginx:

$ sudo ln -s /etc/nginx/sites-available/shaarli /etc/nginx/sites-enabled/
$ sudo systemctl restart nginx

Step 5: Creating the database

Next, create a database for Shaarli using MySQL or MariaDB. You can use the following commands to create a new database and user:

$ sudo mysql -u root -p
mysql> CREATE DATABASE shaarli;
mysql> GRANT ALL PRIVILEGES ON shaarli.* TO 'shaarli'@'localhost' IDENTIFIED BY 'your_password';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;

Make sure to replace your_password with your own password.

Step 6: Running the installation script

Finally, navigate to the Shaarli installation page in your web browser:

http://example.com/index.php

Follow the instructions on the screen to complete the installation process. You will need to enter the database connection information and create a new admin account.

After the installation is complete, Shaarli should be up and running on your macOS machine.

Conclusion

In this tutorial, you learned how to install Shaarli on a macOS operating system. Shaarli is a powerful bookmarking application that can help you organize and manage your bookmarks.

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!