Thumbor is an open-source image processing system, and it allows you to resize, crop, and flip images using a simple API. Alpine Linux is a lightweight Linux distribution that is designed for security, simplicity, and resource efficiency.
In this tutorial, we will guide you through the steps to install Thumbor on Alpine Linux latest.
Before we begin, make sure you have the following prerequisites:
First, you need to install the required packages:
sudo apk update
sudo apk add gcc python3-dev musl-dev libffi-dev openssl-dev
sudo apk add libjpeg-turbo-dev libpng-dev
Once you have installed the required packages, you can proceed with the Thumbor installation:
sudo pip3 install thumbor
Next, you need to configure Thumbor. You can use the default configuration file provided by Thumbor, or you can create your own configuration file.
To use the default configuration file, run the following command:
sudo thumbor-config > thumbor.conf
To create your own configuration file, run the following command:
sudo nano /etc/thumbor.conf
The sample configuration file looks like this:
#thumbor.conf
# Security key (used for encrypted URLs)
SECURITY_KEY = 'MY_SECURE_KEY'
# Allowed sources (regular expressions)
ALLOWED_SOURCES = []
# Max image size
MAX_SOURCE_SIZE = 0
MAX_WIDTH = 0
MAX_HEIGHT = 0
# Storage configuration
STORAGE = 'thumbor.storages.file_storage'
STORAGE_OPTIONS = {
'root_path': '/path/to/storage',
}
# Engines
ENGINE = 'opencv'
ENGINE_ALTERNATIVES = []
# Result storage configuration
RESULT_STORAGE = 'thumbor.result_storages.file_storage'
RESULT_STORAGE_OPTIONS = {
'root_path': '/path/to/results/storage',
}
Make sure to replace MY_SECURE_KEY
with a unique string for your application.
Once you have configured Thumbor, you can start the service using the following command:
thumbor -c /etc/thumbor.conf
To verify that Thumbor is installed and running correctly, open your web browser and visit http://<your server IP>:8888/<your secure key>/unsafe/300x300/some-image.jpg
You should see the resized image on the page.
Congratulations, you have successfully installed Thumbor on Alpine Linux latest. You can now integrate it into your applications to process images.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!