By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.
Lychee is an open source photo management tool that helps you to organize your photos and create albums. Lychee does not compress or reduce the quality of the picture. It allows you to import photos from various sources such as from your computer, Dropbox, servers, or from a URL. You can expand Lychee by adding plugins to support features such as synching with any directory containing photos, watermarking your photos, and uploading photos via SSH.
In this tutorial, we will be installing and setting up Lychee photo management tool on an Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.04 installed.
Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges.
# sudo apt update && sudo apt upgrade
You will need to install unzip which will be used to unzip the compressed zip folder.
# sudo apt-get install unzip -y
Lychee requires installation of PHP 5.5 or newer version of PHP. In this tutorial, you will install PHP 7.2. To install PHP 7.2, execute the following steps.
In the first step, you will need to install python software properties and software properties common.
# sudo apt-get install software-properties-common python-software-properties
You will need to add repository for newer versions of PHP.
# sudo add-apt-repository ppa:ondrej/php
Update the system to refresh the available repositories.
# sudo apt update
Install PHP 7.2. To install PHP 7.2, execute the following command.
# sudo apt install -y php7.2
Lychee requires the following PHP extensions:
To install the above extensions of PHP, execute the following command.
# sudo apt-get -y install php-gd php-mbstring php-common php-mysql php-imagick php-xml libapache2-mod-php php-curl php-tidy php-zip
When you have installed all of the above extensions, apache2 will be installed automatically. You don't need to install apache explicitly.
Imagick will help in faster processing and uploading of the images. It will also help to generate intermediate size images for small screens and thumbnails.
To check PHP installation, you can execute the following command to check installed PHP version.
# php --version
Lychee supports MySQL. In this tutorial, we will use a MariaDB database. By default, Ubuntu repository has an older version of MariaDB server. To use the new version of MariaDB, you will need to add MariaDB repository to your Ubuntu system. To do so, follow the steps below.
Verify the keys by executing the following command.
# sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
Add the repository using the following command.
# sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.2/ubuntu xenial main'
Update your system.
# sudo apt update
Install MariaDB using the following command.
# sudo apt install -y mariadb-server
Start and enable the MariaDB server so that after reboot, MariaDB can start automatically.
# sudo systemctl start mariadb
# sudo systemctl enable mariadb
Run the following command to enhance security of MariaDB server and set password for the root user.
# sudo mysql_secure_installation
Now connect to the MySQL shell as root user using the command below and enter your password.
# sudo mysql -u root -p
Execute the following MySQL queries in your MariaDB server.
CREATE DATABASE lycheedb CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'aareez'@'localhost' IDENTIFIED BY '654321Ab';
GRANT ALL PRIVILEGES ON lycheedb.* TO 'aareez'@'localhost';
FLUSH PRIVILEGES;
EXIT;
To install Lychee, you will need to follow the steps.
Navigate to /var/www/ using the command.
# cd /var/www
Download Lychee from sourceforge using the command below.
# sudo wget --content-disposition https://github.com/electerious/Lychee/archive/v3.1.6.zip
Execute the command below to see the downloaded directory name.
# ls
Unzip the downloaded zip compressed folder by executing the command below.
# sudo unzip Lychee-3.1.6.zip
Remove the zip folder Lychee-3.1.6.zip using the command below.
# sudo rm Lychee-3.1.6.zip
Rename Lychee-3.1.6 to Lychee. To do so, execute the command below.
# sudo mv /var/www/Lyche''''e-3.1.6 /var/www/Lychee
You can confirm renamed file name by executing command below.
# ls
Provide ownership of /var/www/Lychee to www-data so that apache server can access the required files.
# sudo chown -R www-data:www-data /var/www/Lychee
Let's create a virtual host configuration file for Lychee. Execute the following command, a file will be opened in nano text editor.
# sudo nano /etc/apache2/sites-available/Lychee.conf
Copy and paste the following code and save the file.
<VirtualHost *:80>
ServerAdmin admin@xyz.com
ServerName softpedia.xyz
DocumentRoot /var/www/Lychee
DirectoryIndex index.php index.htm index.html
<Directory /var/www/Lychee>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory> ErrorLog ${APACHE_LOG_DIR}/Lychee_error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/Lychee_access.log combined
</VirtualHost>
Execute the command below to disable default site.
# sudo a2dissite 000-default.conf
You will need to enable the newly created virtual host.
# sudo a2ensite Lychee
You will need to enable rewrite mod by editing configuration file in apache2 directory or you can simply execute the command below.
# sudo a2enmod rewrite
You will need to enable SSL engine. You can do so by editing configuration file in apache2 directory or you can simply execute the command below.
# sudo a2enmod ssl
Open php.ini file in nano text editor by executing the command below and make some changes given below.
# sudo nano /etc/php/7.2/apache2/php.ini
memory_limit = 256M
max_execution_time = 300
post_max_size = 100M
upload_max_filesize = 50M
max_file_uploads = 100
Save the settings by pressing Ctrl+X, type Y and hit Enter key.
You will have to restart apache server to apply the changes and load the settings by executing command below.
# sudo service apache2 restart
Now you can access Lychee via your domain name or ECS IP address. You will see the following screen.
To configure database, fill the database credentials details and hit connect button.
After configuration of database, you will be asked to select username and password
After clicking Create Login, you will see the following screen.
You may import or upload photos by clicking on + button in the upper right corner as shown below.
You can update the settings as shown in the screen below by clicking setting sign on upper left corner of Lychee.
To install SSL certificate using Let's Encrypt, you will use Certbot. To do so, execute the following steps.
Update the package using command.
# sudo apt-get update
To install software-properties-common, execute the command below.
# sudo apt-get install software-properties-common
Add the certbot repository by using command below.
# sudo add-apt-repository ppa:certbot/certbot
Update the package to load the added certbot repository using command.
# sudo apt-get update
Stop apache before issuance of SSL certificate.
# sudo systemctl stop apache2
Install python-certbot-apache using the command below.
# sudo apt-get install python-certbot-apache
Execute the following command to get Let's Encrypt SSL issued.
# sudo certbot --apache -d softpedia.xyz
Select option 2 to redirect the link to https and update virtual host settings for SSL.
Restart apache server.
# sudo systemctl start apache2
Now you can access your website using https protocol. https://your_domain_name.tld
If you have activated firewalls, you will have to define a rule in Alibaba Cloud security group for your cloud server to add exception for port 80/tcp and 443/tcp. You can enable these ports while creating ECS instance, but in case if you have forgotten to unblock these ports, you can follow the procedure in this guide: https://www.alibabacloud.com/help/doc-detail/25471.htm
Congratulations! You go, you have successfully installed and configured Lychee on your Alibaba Cloud Elastic Compute Service (ECS) server.
Making E-Commerce Promotions More Effective - A Guide for SMEs
2,599 posts | 762 followers
FollowAlibaba Clouder - June 22, 2018
Alibaba Cloud Community - December 12, 2023
Alibaba Clouder - December 11, 2018
GXIC - June 11, 2019
Ahmed Gad - August 26, 2019
Alibaba Clouder - September 13, 2018
2,599 posts | 762 followers
FollowElastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreAn encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MoreLearn More
More Posts by Alibaba Clouder