How to Install Lychee on POP! OS Latest

Lychee is an open-source, free photo-management tool that helps you store, organize, and share your memories with ease. In this tutorial, I will guide you through the steps to install Lychee on POP! OS Latest.

Prerequisites

Steps to Install Lychee on POP! OS Latest

1. Install NGINX and PHP

Lychee requires a web-server and PHP to run on POP! OS. You can install them with the following command:

sudo apt update
sudo apt install nginx php-fpm php-mbstring php-zip php-gd php-mysql php-curl php-imagick

2. Install a Database

You need to install a database to store your Lychee data. In this tutorial, I will be using MySQL. You can install it with the following command:

sudo apt install mysql-server

Then execute the following command to secure you MySQL installation:

sudo mysql_secure_installation

3. Create a Database and User

Login to your MySQL prompt using the following command:

mysql -u root -p

Then create a new database named lychee_db with the following MySQL query:

CREATE DATABASE lychee_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Create a user and grant all necessary permissions to it. In this example, we create a user named lycheeuser with the password password.

CREATE USER 'lycheeuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL PRIVILEGES ON lychee_db.* TO 'lycheeuser'@'localhost';

4. Download the Lychee Files

It's time to download the Lychee files. You can get them from the official website:

wget https://github.com/LycheeOrg/Lychee/archive/master.zip

Unzip the downloaded files:

unzip master.zip

Move the extracted files to /var/www/html/lychee directory:

sudo mv Lychee-master /var/www/html/lychee

5. Configure NGINX for Lychee

Create a new server block file for Lychee:

sudo nano /etc/nginx/sites-available/lychee

Add the following content to the server block file:

server {
    listen 80;
    server_name your-domain.com;
    root /var/www/html/lychee;
    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.4-fpm.sock;
    }

    location ~* /(data|uploads|static)/ {
         access_log off;
         expires max;
    }
}

Replace your-domain.com with your domain name or IP address.

Create a symbolic link for the server block file in the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/lychee /etc/nginx/sites-enabled/

6. Restart NGINX and PHP

Restart NGINX and PHP-FPM service to apply the changes:

sudo systemctl restart nginx php7.4-fpm

7. Configure Lychee

Create a configuration.php file inside the Lychee directory:

sudo nano /var/www/html/lychee/data/configuration.php

Paste the following content inside the file:

<?php

$servername = "localhost";
$database = "lychee_db";
$username = "lycheeuser";
$password = "password";

$db = new mysqli($servername, $username, $password, $database);

if ($db->connect_error) {
    die("Connection failed: " . $db->connect_error);
}

define('LYCHEE,"true");

?>

Replace the values of $database, $username, and $password with the ones you chose in step 3.

8. Complete the Installation

Open your browser and go to http://your-domain.com/lychee. If everything is configured correctly, you should see the Lychee installer. Follow the on-screen instructions to complete the installation.

Congratulations, you have successfully installed Lychee on POP! OS Latest. Start uploading and organizing your photos with Lychee!

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!