Hobbyists who look to have maximum control over the image files that they host online may look into purchasing a virtual private server. If you are looking for an alternative to Flickr, a VPS could be the perfect alternative.
Several applications exist that will help you self-host your own images. Some are more basic than others; for example, you may wish to have the ability to mark photos as private or password protect specific areas of the site.
In this article, we’ll detail the command line installation instructions of Lychee, an open source app that is used for hosting images on virtual private servers. These install instructions will help you install Lychee on an Ubuntu 16.04 server. Use commands with sudo when needed.
Prerequisites:
Run updates:
> sudo apt-get update
Install LAMP
Go ahead and install Apache, PHP and MySQL using these commands:
> sudo apt-get install apache2 > sudo apt-get install php > sudo apt-get install mysql-server > sudo apt install php libapache2-mod-php
If you are asked to create a username and password for MySQL, make a note of this as you’ll need it later.
To configure Lychee, we need make sure that the following list of extensions is enabled in our PHP build:
- session
- exif
- mbstring
- gd
- mysqli
- json
- zip
To see what extensions are pre-enabled on your box, type this command:
> sudo php –m
In my test, my VPS was missing mbstring, gd, mysqli and zip. Let’s get these enabled.
I ran:
sudo apt-get install php-cli php-gd php-mysqlnd php-curl php-json php-zip php-mbstring
For good measure, let’s restart apache.
> sudo service apache2 restart
Let’s confirm that the extensions are enabled
> sudo php –m
According to my output, all of the prerequisites now seem to be installed. If you are missing some of the other prerequisites, you might have to do some Googling to get the exact command you need.
Now we must adjust the PHP.ini file in order for Lychee to work properly. Use the following command:
> nano /etc/php/7.0/apache2/php.ini
You’ll want to find the following lines and change it to these settings:
max_execution_time = 200 post_max_size = 100M upload_max_size = 100M upload_max_filesize = 20M memory_limit = 256M
Hint, you’ll be able to use CTRL+W to find these terms in Nano editor. You’ll simply find these values and change them and save the PHP.ini file.
Hit CTRL+O to save and select yes. You’ll want to hit CTRL+X to exit. It’s a good idea to reload Apache using the command we used previously to do so.
From here, we can clone the Lychee files onto the VPS. Use the following sequence of commands:
> cd /var/www/html > git clone https://github.com/electerious/Lychee.git > chown -R www-data:www-data /var/www/html/Lychee
Then change the permissions of the upload directory.
> cd Lychee > sudo chmod -R 777 uploads/ data/
From here, let’s restart Apache one more time.
> sudo service apache2 restart
Congrats, you’ve installed Lychee. Let’s login to the app to continue configuring your new photo sharing application self-hosted on your VPS.
In your browser, go to http://<IPADDRESS>/Lychee
You’ll be asked for a server name, database username, database password and database name. If you’ve followed these instructions, you should simply enter in the database username and password that you created in a previous step and leave the rest of the fields blank.
Once this is complete, you’ll be able to create an administrative username and password for the Lychee app.
Now that the application setup is complete, you can begin uploading your photos onto your privately administrated virtual private server. For more information about Lychee, visit the project’s page on GitHub.
Related Posts:
- Have you ever visited the web’s busiest hosting forum? LowEndTalk awaits. - September 27, 2022
- Grab the deals first by subscribing to our new deal alerts - September 16, 2022
- LowEndBox is on Instagram and TikTok! - August 5, 2022
Are technical terms getting blocked in the comments? I’m trying to reply and am getting CloudFlare’s blocked notification.
Good tutorial!
is this better than https://github.com/aerouk/imageserve or https://chevereto.com/free
It’s bad security practise to change the ownership of script pages to www-data.
Only the upload directory and the non-executable files should be owned by www-data.
Hey are you still here? Could you get in touch with me? I’m having trouble getting past the database connection. I made a database but probably did it wrong. Could you point me in the right direction?
chevereto is more good alternative.