Le répertoire du terminal en cours devrait toujours être /usr/share/webapps/pixelfed
Préparer les services Pixelfed
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
Corriger les permissions des clés OAuth
sudo chown pixelfed:pixelfed /usr/share/webapps/pixelfed/storage/*.key
sudo chmod 600 /usr/share/webapps/pixelfed/storage/*.key
Configurer un service d'arrière-plan
Créer le fichier de service systemd
sudo nano /etc/systemd/system/pixelfed.service
[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
Créer un drop-in spécialement destiné à PHP-FPM
Définir storage en écriture malgré ProtectSystem=full en éditant
sudo systemctl edit php8.5-fpm
Le début du fichier doit être modifié comme suit
### 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
Redémarrer PHP-FPM et vérifier son fonctionnement
sudo systemctl restart php8.5-fpm
sudo systemctl status php8.5-fpm
Redémarrer le gestionnaire de configuration de systemd et démarrer Pixelfed
sudo systemctl daemon-reload
sudo systemctl enable --now pixelfed
Créer une tâche Cron pour l'utilisateur Pixelfed
sudo crontab -u pixelfed -e
En fin de fichier, ajouter ces lignes
#
# 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
Créer le premier utilisateur
sudo -u pixelfed php artisan user:create
Modifier mdp_admin
Creating a new user... Name: > Yves LeGuellec Username: > leguellec Email: > leguellec@cogip.be Password: > mdp_admin Confirm password: > mdp_admin Make this user an admin? (yes/no) [no]: > yes Manually verify email address? (yes/no) [no]: > yes Are you sure you want to create this user? (yes/no) [no]: > yes
Initialiser
Visiter https://pixelfed.cogip.be/i/actor pour activer le cache.
Exécuter
sudo -u pixelfed php artisan config:cache
sudo -u pixelfed php artisan route:cache
sudo -u pixelfed php artisan view:cache
Redémarrer (crash test)
sudo reboot
Vérifier le status de l'instance
sudo -u pixelfed php /usr/share/webapps/pixelfed/artisan app:federation
Et visiter l'instance pixelfed.cogip.be.