How to Install HomeGallery on Alpine Linux Latest
HomeGallery is a lightweight and easy-to-use self-hosted image gallery for your personal photos. Alpine Linux is a minimal Linux distribution that provides a secure and lightweight environment for hosting web applications. In this tutorial, we will guide you through the process of installing HomeGallery on Alpine Linux Latest.
Prerequisites
Before you begin, make sure that you have the following:
- A server or virtual machine running Alpine Linux Latest.
- A user account with sudo privileges.
Step 1: Update Package Index
Log in to your Alpine Linux server and update the package index using the following command:
sudo apk update
Step 2: Install Dependencies
HomeGallery requires several dependencies to be installed on your server. Use the following command to install them:
sudo apk add --no-cache curl nginx mariadb mariadb-client mariadb-server-utils php7 php7-fpm php7-json php7-mysqli php7-opcache php7-session php7-zlib php7-gd php7-exif php7-mbstring php7-xml php7-curl
This command will install Nginx, MariaDB, PHP7, and all the required PHP7 modules.
Step 3: Configure MariaDB
After installing MariaDB, you need to configure it by creating a new user and database for HomeGallery. Use the following commands to create a new user and database:
sudo mysql -u root -p
CREATE DATABASE homegallery;
CREATE USER 'homegallery'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON homegallery.* TO 'homegallery'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace strongpassword with a strong password of your choice.
Step 4: Install HomeGallery
Now it's time to download and install HomeGallery. Use the following commands to download and extract the latest release of HomeGallery:
cd /tmp
curl -LO https://github.com/photoprism/photoprism/releases/latest/download/photoprism-linux-amd64.tar.gz
tar -xvf photoprism-linux-amd64.tar.gz
sudo mv photoprism /usr/local/bin/photoprism
sudo chmod +x /usr/local/bin/photoprism
rm photoprism-linux-amd64.tar.gz
This will move the photoprism executable to /usr/local/bin/photoprism.
Step 5: Configure Nginx
Next, you need to configure Nginx to serve HomeGallery. Use the following command to create a new Nginx configuration file:
sudo nano /etc/nginx/conf.d/homegallery.conf
Then, paste the following configuration into the editor:
server {
listen 80;
server_name example.com; # change this to your domain name
root /var/www/homegallery;
index index.php;
access_log /var/log/nginx/homegallery.access.log;
error_log /var/log/nginx/homegallery.error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
index index.php;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock; # change this to your PHP version
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Make sure to replace example.com with your domain name. You can leave the fastcgi_pass setting as is if you are using PHP 7.4. If you are using a different version of PHP, make sure to change the version number accordingly.
Save and exit the file by pressing CTRL+X, then Y, and then ENTER.
Step 6: Start Services
Finally, start the Nginx, PHP, and MariaDB services using the following commands:
sudo rc-update add nginx default
sudo rc-service nginx start
sudo rc-update add php-fpm7 default
sudo rc-service php-fpm7 start
sudo rc-update add mariadb default
sudo rc-service mariadb start
Step 7: Access HomeGallery
You can now access HomeGallery by visiting http://example.com in your web browser, replacing example.com with your domain name. The first time you visit the page, you will be prompted to configure HomeGallery with your MariaDB credentials.
Congratulations! You have successfully installed HomeGallery on Alpine Linux Latest.