Chevereto is a free and open-source image hosting and sharing software that allows you to host your own image hosting server on the web. It is a self-hosted, multipurpose, multi-user, and full-featured image hosting solution that allows you to create responsive image hosting websites. It offers many features, including multiple languages, bulk image importation, social media integration, multiple servers and more.
In this post, we will show you how to install the Chevereto image hosting solution on Ubuntu 22.04.
Prerequisites
- A server running Ubuntu 22.04.
- A root password is configured on the server.
Getting Started
First, it is recommended to update and upgrade all your system packages to the latest version. You can update them by running the following command:
apt update -y
apt upgrade -y
Once all the packages are upgraded, run the following command to install additional required dependencies:
apt install apt-transport-https ca-certificates curl software-properties-common -y
Once all the dependencies are installed, you can proceed to the next step.
Install Apache, PHP, and MariaDB Server.
Before starting, you will need to install the LAMP server on your server.
First, install the Apache and MariaDB server using the following command:
apt install apache2 mariadb-server
Next, add the PHP repository to the APT with the following command:
add-apt-repository ppa:ondrej/php -y
Next, install PHP version 7.4 with other required extensions using the following command:
apt install php7.4 libapache2-mod-php7.4 php7.4-cli php7.4-fpm php7.4-json php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath -y
Once all the packages are installed, you can proceed to the next step.
Create a MariaDB Database
First, secure the MariaDB installation and set a root password by running the following script:
mysql_secure_installation
Answer all the questions as shown below:
Enter current password for root (enter for none): Press ENTER Set root password? [Y/n]: Y New password: Set-your-new-password Re-enter new password: Set-your-new-password Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y
Next, log in to the MariaDB with the following command:
mysql -u root -p
Once your are logged in, create a database and user with the following command:
MariaDB [(none)]> CREATE DATABASE chevereto;
MariaDB [(none)]> CREATE USER 'chevereto'@'localhost' IDENTIFIED BY 'password';
Next, grant all the privileges to the Chevereto database with the following command:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON chevereto.* TO 'chevereto'@'localhost';
Next, flush the privileges to apply the changes:
MariaDB [(none)]> FLUSH PRIVILEGES;
Finally, exit from the MariaDB shell with the following command:
MariaDB [(none)]> EXIT;
Download Chevereto
First, create a directory for Chevereto inside the Apache web root directory using the following command:
mkdir -p /var/www/html/chevereto/
Next, navigate to the Chevereto directory and download the latest version of Chevereto with the following command:
cd /var/www/html/chevereto
wget https://github.com/rodber/chevereto-free/releases/download/1.6.0/1.6.0.zip
Once the download is completed, unzip the downloaded file with the following command:
unzip 1.6.0.zip
Next, set proper permission and ownership to the Chevereto directory:
chown -R www-data:www-data /var/www/html/chevereto/
chmod -R 775 /var/www/html/chevereto/
Configure Apache for Chevereto
Next, create an Apache virtual host configuration file for Chevereto using the following command:
nano /etc/apache2/sites-available/chevereto.conf
Add the following configurations:
<VirtualHost *:80> ServerAdmin admin@chevereto.example.com ServerName chevereto.example.com DocumentRoot /var/www/html/chevereto ErrorLog ${APACHE_LOG_DIR}/chevereto.example.com_error.log CustomLog ${APACHE_LOG_DIR}/chevereto.example.com_access.log combined <Directory /var/www/html/chevereto/> Options FollowSymlinks AllowOverride All Require all granted </Directory> </VirtualHost>
Save and close the file when you are finished. Next, activate the Chevereto virtual host with the following command:
a2ensite chevereto.conf
Next, enable the Apache rewrite and SSL module with the following command:
a2enmod rewrite ssl
Finally, restart the Apache service to apply the changes:
systemctl restart apache2
You can also verify the status of the Apache with the following command:
systemctl status apache2
You should see the following output:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2022-08-28 07:22:12 UTC; 9s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 87027 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 87032 (apache2) Tasks: 6 (limit: 2242) Memory: 14.1M CPU: 111ms CGroup: /system.slice/apache2.service ??87032 /usr/sbin/apache2 -k start ??87033 /usr/sbin/apache2 -k start ??87034 /usr/sbin/apache2 -k start ??87035 /usr/sbin/apache2 -k start ??87036 /usr/sbin/apache2 -k start ??87037 /usr/sbin/apache2 -k start Aug 28 07:22:12 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...
Access Chevereto Web Interface
Now, open your web browser and access the Chevereto web interface using the URL http://chevereto.example.com. You will be redirected to the database configuration page:
Provide your database information, and click on the Continue button. You should see the following page:
Now, provide your admin username, password, and website mode, then click on the Install Chevereto button. Once the installation has been completed, you should see the following page:
Click on the admin dashboard button. You should see the Chevereto login page:
Provide your admin username, password and click on the => button. You should see the Chevereto dashboard on the following page:
Secure Chevereto with Let's Encrypt SSL
It is also recommended to secure your website with Let's Encrypt SSL. First, you will need to install the Certbot client on your server. You can install it with the following command:
apt-get install python3-certbot-apache -y
Once the Certbot is installed, run the following command to secure your website with Let's Encrypt SSL:
certbot --apache -d chevereto.example.com
You will be asked to provide your email and accept the term of service as shown below:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer None Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): hitjethva1981@gmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Plugins selected: Authenticator apache, Installer apache Obtaining a new certificate Performing the following challenges: http-01 challenge for chevereto.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/chevereto-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/chevereto-le-ssl.conf Enabling available site: /etc/apache2/sites-available/chevereto-le-ssl.conf Next, select whether or not to redirect HTTP traffic to HTTPS as shown below:
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Type 2 and hit Enter to install the Let's Encrypt SSL for your website:
Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-enabled/chevereto.conf to ssl vhost in /etc/apache2/sites-available/chevereto-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://chevereto.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=chevereto.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/chevereto.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/chevereto.example.com/privkey.pem Your cert will expire on 2022-11-29. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Conclusion
Congratulations! you have successfully installed the Chevereto image hosting server on Ubuntu 22.04. You can now upload your images to the server and access it from anywhere on the web. Feel free to ask me if you have any questions.