Royc30ne

Royc30ne

机器学习 | 联邦学习 | VPS | 摄影 | 日常

Install Chevereto V4 using Docker to set up your own image hosting platform.

The article was first published on Royc30ne: How to Install Chevereto V4 with Docker and Build Your Own Image Hosting. Please indicate the source if you repost.

In the process of writing a blog, the use of images is essential. They can enrich the content of the article and enhance the reading experience for the audience. Building your own image hosting platform allows you to better manage and use image resources. Image hosting can compress and optimize images, reducing the file size and speeding up page loading. Fast-loading pages contribute to improved user experience and reduced bounce rates. In addition, storing images on an image hosting platform can reduce the burden on your blog server, saving storage space and bandwidth. This way, your server can focus more on handling blog content and provide better performance.

image

Here, I want to recommend a very useful image hosting platform: Chevereto. Although there are other open-source image hosting software like Lankong Image Hosting on the market, Chevereto is the most mature and stable software I have used, and it also has support for many third-party plugins. Chevereto is divided into a free version and a Pro version. The Pro version has a one-time fee of $75, but the free version is already sufficient for daily use. This time, I will install the Pro version.

Preparation#

!! First, make sure that Nginx is not installed or running on your server. The Docker version of Chevereto will conflict with the existing Nginx and cannot run (personal experience).

  1. Prepare a VPS with a configuration of at least 1 core, 512MB RAM, and 10GB hard disk (advanced tutorials will teach you how to use object storage to expand storage space, so a smaller hard disk is also fine).
  2. Prepare your own domain name and point your domain name to the server IP.

Domain Name Resolution#

If you are using Cloudflare for domain name resolution, you can refer to the following figure to add a new A record for your domain name. Here, I will use "p.2cu.icu" as the domain name for my image hosting. If you want to use the Chevereto image hosting I have already set up, you are welcome to use V50 Image Hosting.

image

Environment Preparation#

Basic Environment#

Manage your server through the command line and enter your server via SSH. Check if your server has installed make, unzip, curl, and git. If not, you can install them with the following command:

sudo apt install make unzip curl git

Install Docker (skip if already installed)#

If you are using Ubuntu, you can install Docker by running the following command (other systems can refer to the Docker official website):

Configure Repository#

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
  1. Add the Docker official GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
  1. Set up the stable repository:
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine#

  1. Update the apt package index:
sudo apt-get update
  1. Install Docker Engine, containerd, and Docker Compose. To install the latest version, run:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. Verify that Docker Engine is installed correctly by running the hello-world image:
sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and then exits.

Clone chevereto/docker#

We will use git to get a copy of our base Docker project. Run the following command to create a docker folder in the current working directory.

git clone https://github.com/chevereto/docker.git

Go to this newly created docker folder.

cd docker

In the docker folder, you can configure or modify the basic configuration of Chevereto.

(Optional) Customize the Basic Configuration of Chevereto#

Chevereto supports a maximum image upload size of 64MB and a memory usage of 512MB by default. However, you can modify them in the Dockerfile. Here are some basic configurations in the Dockerfile with comments to help you adjust them according to your needs.

Modify the Dockerfile with vim.

vim Dockerfile

The following fields are in the Dockerfile, and I have added some comments to help you adjust them according to your needs.

    CHEVERETO_MAX_MEMORY_SIZE=512M \ # Maximum memory usage for Chevereto
    CHEVERETO_MAX_POST_SIZE=64M \  # Maximum POST request size, recommended to be consistent with the maximum upload size
    CHEVERETO_MAX_UPLOAD_SIZE=64M \  # Maximum upload size

Set Up Background Tasks#

Chevereto needs to perform regular system tasks in the background, such as deleting expired images, unverified users, or checking for updates. Run the following command to set up background processing for all your websites.

make cron

Create an HTTPS Proxy#

The Docker version of Chevereto includes an NGINX network server that forwards access to all Chevereto websites and provides automatic HTTPS certificate renewal.

To set up the proxy server, run the following command:

make proxy [email protected]

In the EMAIL_HTTPS option, set your email address. It is required for HTTPS certificate notifications.

Create Chevereto Image (skip for free version)#

This process will build the Chevereto container image.

💡 Skip this step when using the free version, as the image can be found here GHCR.

make image

This process will prompt you to provide a license key. If you have purchased the Pro version, you can find your key here (see the screenshot below for details).
image

If no license is provided or an invalid license is entered, the system will build a free image.

Set Up Domain Name#

You can use the following command to create a namespace named imagehost for the p.v50.tools domain name (the namespace can be customized, but the HOSTNAME must be the domain name that resolves to your host IP address):

make namespace NAMESPACE=imagehost HOSTNAME=`p.v50.tools`

You can check the namespace file in the ./namespace folder.

Run Chevereto Website#

Pro version: To create a new website, run the make spawn command with the NAMESPACE option.

make spawn NAMESPACE=imagehost

Free version: When using the free version, use EDITION=free with the NAMESPACE option.

make spawn NAMESPACE=example EDITION=free

🎉 Chevereto is now up and running. You can now access your own Chevereto image hosting through your domain name.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.