Setting up Lychee on your Ubuntu 24.04 server with Apache allows you to manage and display your photo collection effortlessly through a user-friendly web interface. This guide walks you through each step, from initial preparations to troubleshooting common issues, ensuring you have a fully functional Lychee installation tailored to your needs. Before starting, ensure your server is up-to-date and has a stable internet connection to download necessary packages and dependencies.
What You’ll Need
- Ubuntu 24.04 server installed and updated
- Root or sudo privileges on the server
- Domain name pointing to your server’s IP (optional but recommended)
- Basic knowledge of terminal commands
- Apache web server installed (if not, instructions included below)
- PHP 8.2 or higher supported by Lychee
- MySQL or MariaDB database server
- SSL certificate for HTTPS (optional but recommended)
Step-by-Step
- Update Your System
- Install Apache Web Server
- Install PHP and Required Extensions
- Install Database Server (MySQL/MariaDB)
- Secure Your Database Installation
- Create a Database and User for Lychee
- Download Lychee
- Configure Apache Virtual Host
- Complete Lychee Installation via Web Interface
- Secure Your Installation (Optional)
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 -y
sudo apt install php php-cli php-mbstring php-zip php-gd php-xml php-mysql libapache2-mod-php -y
sudo apt install mysql-server -y
sudo mysql_secure_installation
sudo mysql -u root -p
CREATE DATABASE lychee_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'lychee_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON lychee_db.* TO 'lychee_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
cd /var/www/html
sudo wget https://github.com/LycheeOrg/Lychee/releases/latest/download/Lychee.zip
sudo apt install unzip -y
sudo unzip Lychee.zip -d lychee
sudo chown -R www-data:www-data /var/www/html/lychee
sudo nano /etc/apache2/sites-available/lychee.conf
Insert the following configuration, replacing ‘yourdomain.com’ with your actual domain or server IP:
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html/lychee
<Directory /var/www/html/lychee>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/lychee_error.log
CustomLog ${APACHE_LOG_DIR}/lychee_access.log combined
</VirtualHost>
sudo a2ensite lychee.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Open your browser and navigate to http://yourdomain.com or your server IP. Follow the on-screen instructions to complete the setup, entering your database details and creating an admin account.
sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d yourdomain.com
Follow the prompts to obtain and install an SSL certificate, enabling HTTPS for secure access.
Common Mistakes
- Not updating the system before starting, leading to package conflicts or missing dependencies.
- Forgetting to set correct permissions on the Lychee directory, causing access issues.
- Using incorrect database credentials during setup, which prevents Lychee from connecting to the database.
- Failing to enable Apache rewrite module, resulting in broken URLs or setup failures.
- Not securing the installation with HTTPS, exposing your data and images to potential threats.
Tips
- Always back up your database and Lychee files before making major changes or updates.
- Use strong, unique passwords for your database and admin accounts.
- Configure automatic renewal for SSL certificates to maintain HTTPS security without manual intervention.
- Regularly update Lychee and server packages to benefit from security patches and new features.
- If you encounter permission issues, ensure www-data owns the Lychee directory: sudo chown -R www-data:www-data /var/www/html/lychee
Troubleshooting
If Lychee does not load correctly or you encounter errors, follow these steps:
- Check the Apache error logs: sudo tail -f /var/log/apache2/lychee_error.log
- Verify that the database connection details are correct in the Lychee setup page.
- Ensure PHP modules are installed and enabled: php -m | grep -i ‘mbstring\|zip\|gd\|xml\|mysql’
- Restart Apache after any configuration changes: sudo systemctl restart apache2
- Clear your browser cache or try accessing the site in incognito mode.
- If HTTPS issues occur, check your SSL certificate status and renewal status.
Frequently Asked Questions
Can I install Lychee without a domain name?
Yes, you can access Lychee via your server’s IP address, but using a domain name is recommended for easier access and SSL setup.
Is Lychee safe to use on my server?
When properly configured with security best practices, including HTTPS and regular updates, Lychee is generally safe for personal use.
Can I run Lychee with other web servers like Nginx?
Yes, Lychee can be configured with Nginx, but this guide focuses on Apache. Nginx setup requires different configuration steps.
How do I update Lychee to the latest version?
Download the latest release from GitHub, replace the existing files in your Lychee directory, and run the web-based setup or command-line upgrade if available.
What are the system requirements for Lychee?
Lychee requires PHP 8.2+, a web server like Apache or Nginx, and a database like MySQL or MariaDB. Sufficient storage and RAM depend on your photo collection size.
Can I add multiple users to Lychee?
Lychee’s default setup supports a single user, but with customization or plugins, multi-user support can be added. Check the latest Lychee documentation for updates.
Related
- How to Hide Virus & Threat Protection Section in Windows 11 Security
- How to Hide the Toolbar on a MacBook Air Easily
- How to Hide the Time and Date on Your Windows 11 Taskbar