How to Install PixelFed on Arch Linux

PixelFed is a free, federated, and decentralized alternative to the popular photo-sharing platform, Instagram. In this tutorial, we will guide you through the process of installing PixelFed on Arch Linux.

Prerequisites

Before installing PixelFed, you need to make sure that your system meets the following requirements:

Step 1: Install Dependencies

To install PixelFed on Arch Linux, you need to install the following dependencies:

You can install these dependencies by running the following command in your terminal:

sudo pacman -S apache php php-apache php-curl php-gd php-mysqli php-json php-mbstring php-xml php-zip mariadb

Once the installation is complete, start the Apache web server and MariaDB database server and enable them to start at boot time:

sudo systemctl start httpd
sudo systemctl start mariadb
sudo systemctl enable httpd
sudo systemctl enable mariadb

Step 2: Configure the Database

PixelFed requires a database to store its data. In this step, we will create a new database and user for PixelFed and grant access to the user.

Log in to the MariaDB console as the root user:

sudo mysql -u root -p

Create a new database and user:

CREATE DATABASE pixelfed_db;
CREATE USER 'pixelfed_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON pixelfed_db.* TO 'pixelfed_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace password with a strong and secure password for the user.

Step 3: Download and Install PixelFed

In this step, we will download and install the latest version of PixelFed from the official website.

First, install Git:

sudo pacman -S git

Next, clone the PixelFed repository:

git clone https://github.com/pixelfed/pixelfed.git

The above command will download the latest version of PixelFed to your current directory.

Navigate to the pixelfed directory:

cd pixelfed

Copy the example configuration file to config/.env:

cp .env.example config/.env

Edit the config/.env file and set the following parameters:

APP_ENV=production
APP_DEBUG=false
APP_URL=http://localhost:8080
APP_KEY=your_app_key_here
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=pixelfed_db
DB_USERNAME=pixelfed_user
DB_PASSWORD=password
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Replace your_app_key_here with a random string of 32 characters.

Step 4: Install Dependencies using Composer

PixelFed has several dependencies that need to be installed using Composer.

Install Composer:

sudo pacman -S composer

Navigate to the pixelfed directory:

cd pixelfed

Run the following command to install the dependencies:

composer install --no-dev

This command will download and install the required dependencies for PixelFed.

Step 5: Setup Storage and Cache

PixelFed stores uploaded photos and thumbnails in the storage directory. You need to create this directory and set the correct permissions.

Run the following commands to create the storage directory and set the permissions:

mkdir -p storage/app/public
mkdir -p storage/framework/{cache,sessions,views}
chmod -R 775 storage
chown -R http:http storage

Next, create a symbolic link from the public storage folder to the public folder:

php artisan storage:link

This command will create a symlink between the storage and public directories, allowing uploaded files to be accessible from the web.

Step 6: Configure the Web Server

PixelFed requires a web server to handle HTTP requests. In this step, we will configure Apache to serve PixelFed.

Create a new Apache virtual host file:

sudo nano /etc/httpd/conf/extra/pixelfed.conf

Add the following configuration to the file:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /path/to/pixelfed/public
    <Directory /path/to/pixelfed/public>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/httpd/pixelfed_error.log
    CustomLog /var/log/httpd/pixelfed_access.log combined
</VirtualHost>

Replace /path/to/pixelfed with the path to your PixelFed installation directory.

Save and close the file.

Open the Apache main configuration file:

sudo nano /etc/httpd/conf/httpd.conf

Add the following line at the end of the file:

Include conf/extra/pixelfed.conf

Save and close the file.

Restart Apache:

sudo systemctl restart httpd

Step 7: Run the Database Migrations

In this step, we will create the necessary tables in the database.

Navigate to the pixelfed directory:

cd pixelfed

Run the following command to run the database migrations:

php artisan migrate

This command will create the necessary tables in the database.

Step 8: Start the Queue Worker

PixelFed uses a queue worker to handle background tasks such as generating thumbnails.

Run the following command to start the queue worker:

nohup php artisan queue:work &

This command will start the queue worker in the background.

Step 9: Open PixelFed in the Web Browser

PixelFed is now installed and configured. You can access PixelFed by opening your preferred web browser and entering your server's IP address or domain name in the URL bar.

http://your_ip_address:8080

You should see the PixelFed homepage. You can create a new account and start sharing photos.

Conclusion

In this tutorial, we have shown you how to install PixelFed on Arch Linux. You can now enjoy a decentralized and federated alternative to Instagram on your own server.

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!