In this tutorial, we will show you how to install PixelFed, which is a federated image sharing platform, on Void Linux.
Before proceeding with the installation, you need to have some prerequisites on your system:
To install PixelFed, we need to install some dependencies on the system. Open the terminal and run the following command:
sudo xbps-install -S git curl composer nginx php7 php7-fpm php7-curl php7-mbstring php7-zip php7-opcache php7-gd php7-json php7-fileinfo
This command installs Git, Composer, Nginx, and various PHP dependencies required for the PixelFed installation.
Create a new directory where the PixelFed code will reside:
sudo mkdir -p /var/www/pixelfed
cd /var/www/pixelfed
Now, download the PixelFed code using the following command:
sudo git clone https://github.com/pixelfed/pixelfed.git .
Navigate into the PixelFed directory and install the Composer dependencies:
cd /var/www/pixelfed
sudo composer install --no-dev --no-interaction --prefer-dist
This command installs all the dependencies required for the PixelFed web application.
To configure PixelFed, we need to make some changes to the env
file. Navigate to the config
directory and copy the example .env
file:
cd /var/www/pixelfed/config
sudo cp .env.example .env
Open the .env
file using your preferred text editor and update the following values:
APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com/
Update the APP_URL
value with your domain where PixelFed will be hosted.
The directory permissions need to be updated to allow the web server to access necessary files. Change the owner of the pixelfed
directory:
sudo chown -R nginx:nginx /var/www/pixelfed
PixelFed requires a web server like Nginx to serve the web requests. Create a new Nginx server block for PixelFed by creating a new configuration file:
sudo nano /etc/nginx/sites-available/pixelfed
Add the following configuration in the file:
server {
listen 80;
server_name yourdomain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name yourdomain.com;
client_max_body_size 150m; # upload size limit
index index.php index.html index.htm;
root /var/www/pixelfed/public;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_vary on;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /avatars {
try_files $uri /index.php?$query_string;
add_header Cache-Control "public, max-age=31536000, immutable";
}
location /storage {
try_files $uri /index.php?$query_string;
internal;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock; # change version as needed
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location = / {
rewrite ^ /index.php?r=site/index permanent;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Make sure to update the server_name
, ssl_certificate
, and ssl_certificate_key
values with your domain and certificate paths.
Enable the new server block and restart Nginx:
sudo ln -s /etc/nginx/sites-available/pixelfed /etc/nginx/sites-enabled/
sudo systemctl restart nginx
PixelFed requires a database to store its data. We will use MariaDB as the database server. Install MariaDB with the following command:
sudo xbps-install mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
Follow the on-screen prompts to secure the MariaDB installation. Next, create a new user and database for PixelFed:
sudo mysql -u root -p
CREATE DATABASE pixelfeddb;
CREATE USER 'pixelfeduser'@'localhost' IDENTIFIED BY 'your-password';
GRANT ALL PRIVILEGES ON pixelfeddb.* TO 'pixelfeduser'@'localhost';
FLUSH PRIVILEGES;
exit;
Make sure to replace 'your-password'
with a strong and secure password you want to set.
Navigate to the web server's root directory and install PixelFed with the following command:
cd /var/www/pixelfed
sudo php artisan pixelfed:install
This command creates a new administrator user and asks for database details. Enter the following database details:
Database Name: pixelfeddb
Database Username: pixelfeduser
Database Password: your-password
Make sure to replace 'your-password'
with the password you set in Step 7.
The installation process completes with the following output:
Database and storage link setup complete.
To run the worker, run: `php artisan queue:work`
Initial Configuration Completed!
Default admin created! email: email@example.com password: secret
Restart the web server and PHP-FPM to apply the changes made during the installation:
sudo systemctl restart nginx php7-fpm
Open a web browser and navigate to https://yourdomain.com/
. You will see the PixelFed login page. Log in with the email address and password that were created during the installation.
Congratulations! You have successfully installed PixelFed on Void Linux. You can now create your profile and start sharing your images on this federated image sharing platform.
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!