Skip to content

Powered by Grav

Configuration

The active terminal directory should still be /usr/share/webapps/pixelfed

Prepare Pixelfed services

BASH
sudo -u pixelfed php artisan key:generate
sudo -u pixelfed php artisan storage:link
sudo -u pixelfed php artisan migrate --force
sudo -u pixelfed php artisan import:cities
sudo -u pixelfed php artisan instance:actor
sudo -u pixelfed php artisan passport:keys
sudo -u pixelfed php artisan horizon:install
sudo -u pixelfed php artisan horizon:publish

Fix OAuth key permission

BASH
sudo chown pixelfed:pixelfed /usr/share/webapps/pixelfed/storage/*.key
sudo chmod 600 /usr/share/webapps/pixelfed/storage/*.key

Set up background service

Create the systemd service file

BASH
sudo nano /etc/systemd/system/pixelfed.service
INI
[Unit]
Description=Pixelfed task queueing via Laravel Horizon
After=network.target mysql.service php8.5-fpm.service redis-server.service apache2.service
Requires=mysql.service php8.5-fpm.service redis-server.service apache2.service

[Service]
Type=simple
User=pixelfed
WorkingDirectory=/usr/share/webapps/pixelfed
ExecStart=/usr/bin/php8.5 artisan horizon
Restart=always
RestartSec=5
Environment=QUEUE_CONNECTION=redis

# Security hardening
NoNewPrivileges=yes
PrivateTmp=true
ProtectSystem=full
ProtectHome=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
RestrictSUIDSGID=yes
LockPersonality=yes
RestrictRealtime=yes

# Paths Horizon actually needs to write to
ReadWritePaths=/usr/share/webapps/pixelfed/storage
ReadWritePaths=/usr/share/webapps/pixelfed/bootstrap
ReadWritePaths=/tmp

[Install]
WantedBy=multi-user.target

Create a drop-in specifically for PHP-FPM

Make storage writable despise ProtectSystem=full by editing

BASH
sudo systemctl edit php8.5-fpm

The beginning of the file has to look like

INI
### Editing /etc/systemd/system/php8.5-fpm.service.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file

[Service]
ReadWritePaths=/usr/share/webapps/pixelfed/storage
ReadWritePaths=/usr/share/webapps/pixelfed/bootstrap

### Edits below this comment will be discarded

Restart PHP-FPM and check it's working

BASH
sudo systemctl restart php8.5-fpm
sudo systemctl status php8.5-fpm

Reload systemd configuration manager and start Pixelfed

BASH
sudo systemctl daemon-reload
sudo systemctl enable --now pixelfed

Create a Cron job for the Pixelfed user

BASH
sudo crontab -u pixelfed -e

At the end of the file, paste these lines

BASH
#
# Runs Laravel's task scheduler every minute. It evaluates all scheduled commands
# defined in Pixelfed's console kernel and executes whichever ones are due — things
# like media optimization, garbage collection, database cleanups, and other time-based
# maintenance tasks. This is the standard Pixelfed cron job.
* * * * * /usr/bin/php8.5 /usr/share/webapps/pixelfed/artisan schedule:run >> /dev/null 2>&1

Create the first user

BASH
sudo -u pixelfed php artisan user:create

Change admin_password

Creating a new user...

Name:
> Yves LeGuellec

Username:
> leguellec

Email:
> leguellec@cogip.be

Password:
> admin_password

Confirm password:
> admin_password

Make this user an admin? (yes/no) [no]:
> yes

Manually verify email address? (yes/no) [no]:
> no

Are you sure you want to create this user? (yes/no) [no]:
> yes

Verify the user

BASH
sudo -u pixelfed php artisan user:verify leguellec

Initialize

Visit https://pixelfed.cogip.be/i/actor to activate cache.

Run

BASH
sudo -u pixelfed php artisan config:cache
sudo -u pixelfed php artisan route:cache
sudo -u pixelfed php artisan view:cache

Reboot (crash test)

BASH
sudo reboot

Check instance status

BASH
sudo -u pixelfed php /usr/share/webapps/pixelfed/artisan app:federation

And visit the instance at pixelfed.cogip.be.

© 2026 howto.cogip.be. All rights reserved.