How to Install PictShare on Void Linux

PictShare is an open-source and free web-based image hosting and sharing application that allows users to easily upload, share, and manage their images. In this tutorial, we will guide you through the process of installing PictShare on Void Linux.

Prerequisites

Before proceeding with this guide, you need:

Step 1: Install Required Packages

To install PictShare on Void Linux, we need to install some required packages. We can do this by opening a terminal and executing the following command:

sudo xbps-install -y nginx mariadb mariadb-client php8 php8-fpm php8-gd php8-mbstring php8-opcache php8-pdo php8-pdo_mysql

This command will install Nginx as a web server, Mariadb as a database server and PHP8 with some required PHP extensions.

Step 2: Download PictShare

Next, we need to download the latest version of PictShare from its official website. We can download it by executing the below command:

wget https://github.com/chrisiaut/pictshare/releases/latest/download/pictshare.zip

Step 3: Extract PictShare

After downloading the PictShare, we need to extract it to the web root directory '/var/www'.

sudo unzip pictshare.zip -d /var/www/

Step 4: Create Mariadb Database and User

Before we begin the PictShare installation, we need to create a new MariaDB database and user for PictShare to use. We can create a new database and user by executing the following commands:

sudo mysql -u root

Then enter the following SQL commands:

CREATE DATABASE pictshare;
GRANT ALL PRIVILEGES ON pictshare.* TO 'pictshare'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit

Step 5: Configure PictShare

Now that we have installed and extracted PictShare to the web root directory, we need to configure it.

First, we need to create a new configuration file by copying the original configuration file

sudo cp /var/www/config_default.php /var/www/config.php

Next, we need to edit the configuration file by opening it in a text editor:

sudo nano /var/www/config.php

In this file, we need to edit the following variables:

$db_host = 'localhost';
$db_user = 'pictshare';
$db_pass = 'password';
$db_database = 'pictshare';

Make sure to change "password" to the password you set in step 4.

Also, uncomment the following line to enable HTTPS:

define('HTTPS', true);

Step 6: Configure Nginx

Now we need to set up an Nginx server block configuration file for PictShare.

We can create a new configuration file by opening a new file and pasting the following server block:

sudo nano /etc/nginx/sites-available/pictshare
server {
    listen 80;
    server_name your_server_domain.com;

    location / {
        rewrite ^ https://$server_name$request_uri? permanent;
    }
}

server {
    listen 443 ssl;
    server_name your_server_domain.com;

    ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
    ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;

    root /var/www;

    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$uri&$args;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Make sure to change "your_server_domain.com" with your own domain name or IP Address.

After creating the configuration file, we need to create a symlink to the Nginx's sites-enabled directory by executing the following command:

sudo ln -s /etc/nginx/sites-available/pictshare /etc/nginx/sites-enabled/pictshare

Now, we need to test the Nginx configuration for any syntax errors.

sudo nginx -t

If there are no syntax errors, we can reload the Nginx service for the changes to take effect.

sudo systemctl reload nginx.service

Step 7: Access PictShare

Now you can access PictShare using your web browser by visiting your server domain name or IP address. If you set up HTTPS, make sure to access PictShare using HTTPS.

You should see the PictShare welcome page, and you can create a new account or login with an existing account to start using PictShare.

Congratulations! You have successfully installed PictShare on Void Linux.

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!