This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| computing:pixelfed [2026/03/01 17:37] – oemb1905 | computing:pixelfed [2026/03/01 17:55] (current) – removed oemb1905 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ------------------------------------------- | ||
| - | * **pixelfed** | ||
| - | * **Jonathan Haack** | ||
| - | * **Haack' | ||
| - | * **support@haacksnetworking.org** | ||
| - | ------------------------------------------- | ||
| - | |||
| - | // | ||
| - | |||
| - | ------------------------------------------- | ||
| - | |||
| - | ====== Complete Pixelfed Installation Tutorial: Fresh Setup or Full Rebuild ====== | ||
| - | |||
| - | This tutorial provides a comprehensive, | ||
| - | |||
| - | The process assumes you're running as a user with sudo privileges. It destroys any existing Pixelfed installation and database, then rebuilds everything fresh. Run commands sequentially. If you're starting from a completely bare system, ensure basic packages like Apache, MariaDB, Redis, and Git are installed first (e.g., via '' | ||
| - | |||
| - | ===== Prerequisites: | ||
| - | |||
| - | Pixelfed requires PHP 8.4 with specific extensions for database, image processing, Redis, and more. Update your package list and install them. | ||
| - | |||
| - | <code bash> | ||
| - | cd /var/www | ||
| - | sudo apt update | ||
| - | sudo apt install php8.4-fpm php8.4-mysql php8.4-curl php8.4-gd php8.4-mbstring php8.4-xml php8.4-zip php8.4-bcmath php8.4-intl php8.4-redis php8.4-imagick php8.4-imap php8.4-ldap -y | ||
| - | sudo systemctl restart php8.4-fpm | ||
| - | </ | ||
| - | |||
| - | This ensures PHP-FPM is running and ready for Apache integration. | ||
| - | |||
| - | ===== Step 1: Nuke the Old Database (If Exists) ===== | ||
| - | |||
| - | Log in to MySQL/ | ||
| - | |||
| - | <code bash> | ||
| - | mysql -u root -p | ||
| - | </ | ||
| - | |||
| - | Inside the MySQL shell, run: | ||
| - | |||
| - | <code sql> | ||
| - | DROP DATABASE IF EXISTS pixelfed; | ||
| - | DROP DATABASE IF EXISTS pixel; | ||
| - | EXIT; | ||
| - | </ | ||
| - | |||
| - | ===== Step 2: Create the New ' | ||
| - | |||
| - | Create a new database named ' | ||
| - | |||
| - | <code bash> | ||
| - | mysql -u root -p | ||
| - | </ | ||
| - | |||
| - | Inside the MySQL shell, run: | ||
| - | |||
| - | <code sql> | ||
| - | CREATE DATABASE pixel CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
| - | CREATE USER IF NOT EXISTS ' | ||
| - | GRANT ALL PRIVILEGES ON pixel.* TO ' | ||
| - | FLUSH PRIVILEGES; | ||
| - | EXIT; | ||
| - | </ | ||
| - | |||
| - | This sets up a UTF-8 compatible database optimized for Pixelfed' | ||
| - | |||
| - | ===== Step 3: Nuke the Old Pixelfed Directory (If Exists) ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo rm -rf / | ||
| - | </ | ||
| - | |||
| - | ===== Step 4: Clone Fresh Pixelfed from Git (Dev Branch) ===== | ||
| - | |||
| - | Clone the latest development branch from the official repository. The ' | ||
| - | |||
| - | <code bash> | ||
| - | cd /var/www | ||
| - | git clone -b dev https:// | ||
| - | </ | ||
| - | |||
| - | ===== Step 5: Set Permissions for the New Installation ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo chown -R www-data: | ||
| - | sudo chmod -R 775 / | ||
| - | </ | ||
| - | |||
| - | This prevents permission errors during runtime, such as failed uploads or cache writes. | ||
| - | |||
| - | ===== Step 6: Install Dependencies with Composer ===== | ||
| - | |||
| - | <code bash> | ||
| - | cd / | ||
| - | sudo -u www-data composer install --no-dev --optimize-autoloader | ||
| - | </ | ||
| - | |||
| - | This pulls in Laravel and other required packages without development tools for a production setup. | ||
| - | |||
| - | ===== Step 7: Configure the .env File ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo nano / | ||
| - | </ | ||
| - | |||
| - | Paste or update with the following content (replace placeholders if needed, e.g., passwords, domains, or mail settings): | ||
| - | |||
| - | <code ini> | ||
| - | APP_NAME=" | ||
| - | APP_ENV=production | ||
| - | APP_KEY= # Generated later | ||
| - | APP_DEBUG=false | ||
| - | APP_URL=https:// | ||
| - | APP_DOMAIN=gnulinux.pics | ||
| - | ADMIN_DOMAIN=gnulinux.pics | ||
| - | SESSION_DOMAIN=gnulinux.pics | ||
| - | DB_CONNECTION=mysql | ||
| - | DB_HOST=127.0.0.1 | ||
| - | DB_PORT=3306 | ||
| - | DB_DATABASE=pixel | ||
| - | DB_USERNAME=pixel | ||
| - | DB_PASSWORD=lweRt5-xmcvQW2_poRtyUG51.78345^ | ||
| - | REDIS_HOST=127.0.0.1 | ||
| - | REDIS_PASSWORD=null | ||
| - | REDIS_PORT=6379 | ||
| - | REDIS_CLIENT=predis | ||
| - | REDIS_SCHEME=tcp | ||
| - | CACHE_DRIVER=redis | ||
| - | QUEUE_CONNECTION=redis | ||
| - | SESSION_DRIVER=redis | ||
| - | HORIZON_PREFIX=horizon- | ||
| - | MAIL_MAILER=smtp | ||
| - | MAIL_HOST=mail.haacksnetworking.org | ||
| - | MAIL_PORT=587 | ||
| - | MAIL_USERNAME=webmaster | ||
| - | MAIL_PASSWORD==R0undC@arg3dTer$sProduc3!inu73@4r!ied | ||
| - | MAIL_ENCRYPTION=tls | ||
| - | MAIL_FROM_ADDRESS=webmaster@haacksnetworking.org | ||
| - | MAIL_FROM_NAME=" | ||
| - | ACTIVITY_PUB=true | ||
| - | AP_REMOTE_FOLLOW=true | ||
| - | AP_INBOX=true | ||
| - | AP_OUTBOX=true | ||
| - | AP_SHAREDINBOX=true | ||
| - | RELAY=true | ||
| - | OPEN_REGISTRATION=true | ||
| - | ENFORCE_EMAIL_VERIFICATION=true | ||
| - | PF_MAX_USERS=1000 | ||
| - | PF_OPTIMIZE_IMAGES=true | ||
| - | IMAGE_QUALITY=80 | ||
| - | MAX_PHOTO_SIZE=15000 | ||
| - | MAX_CAPTION_LENGTH=500 | ||
| - | MAX_ALBUM_LENGTH=4 | ||
| - | INSTANCE_DISCOVER_PUBLIC=true | ||
| - | PF_ENABLE_CLOUD=false | ||
| - | FILESYSTEM_CLOUD=s3 | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | #AWS_URL= | ||
| - | # | ||
| - | # | ||
| - | </ | ||
| - | |||
| - | Save and exit. | ||
| - | |||
| - | ===== Step 8: Run Database Migrations ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo -u www-data php artisan migrate --force | ||
| - | </ | ||
| - | |||
| - | ===== Step 9: Create the Public Storage Symlink (Critical for Images) ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo -u www-data php artisan storage: | ||
| - | </ | ||
| - | |||
| - | Verify the symlink: | ||
| - | |||
| - | <code bash> | ||
| - | ls -l / | ||
| - | </ | ||
| - | |||
| - | Expected output: '' | ||
| - | |||
| - | If images fail to display after uploads, recheck permissions: | ||
| - | |||
| - | <code bash> | ||
| - | sudo chown -R www-data: | ||
| - | sudo chmod -R 775 / | ||
| - | #oauth bits require stronger perms | ||
| - | sudo chmod 600 / | ||
| - | sudo chmod 600 / | ||
| - | </ | ||
| - | |||
| - | ===== Step 10: Generate Application Key ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo -u www-data php artisan key: | ||
| - | </ | ||
| - | |||
| - | ===== Step 11: Set Up Passport for OAuth ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo -u www-data php artisan passport: | ||
| - | sudo -u www-data php artisan passport: | ||
| - | </ | ||
| - | |||
| - | ===== Step 12: Set Up Horizon for Queue Worker ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo -u www-data php artisan horizon: | ||
| - | </ | ||
| - | |||
| - | ===== Step 13: Cache Configurations, | ||
| - | |||
| - | <code bash> | ||
| - | sudo -u www-data php artisan config: | ||
| - | sudo -u www-data php artisan route:cache | ||
| - | sudo -u www-data php artisan view:cache | ||
| - | sudo -u www-data php artisan optimize | ||
| - | </ | ||
| - | |||
| - | ===== Step 14: Configure Apache Virtual Hosts ===== | ||
| - | |||
| - | For the non-SSL site (HTTP redirect): | ||
| - | |||
| - | <code bash> | ||
| - | sudo nano / | ||
| - | </ | ||
| - | |||
| - | Paste: | ||
| - | |||
| - | <code apache> | ||
| - | < | ||
| - | ServerName gnulinux.pics | ||
| - | RewriteEngine On | ||
| - | RewriteCond %{SERVER_NAME} =gnulinux.pics | ||
| - | RewriteRule ^ https:// | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | For the SSL site: | ||
| - | |||
| - | <code bash> | ||
| - | sudo nano / | ||
| - | </ | ||
| - | |||
| - | Paste: | ||
| - | |||
| - | <code apache> | ||
| - | < | ||
| - | ServerName gnulinux.pics | ||
| - | SSLEngine on | ||
| - | SSLCertificateFile / | ||
| - | SSLCertificateKeyFile / | ||
| - | Include / | ||
| - | DocumentRoot / | ||
| - | < | ||
| - | Options Indexes FollowSymLinks | ||
| - | AllowOverride All | ||
| - | Require all granted | ||
| - | </ | ||
| - | < | ||
| - | SetHandler " | ||
| - | </ | ||
| - | LimitRequestBody 524288000 | ||
| - | ErrorLog ${APACHE_LOG_DIR}/ | ||
| - | CustomLog ${APACHE_LOG_DIR}/ | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | Ensure '' | ||
| - | |||
| - | <code bash> | ||
| - | sudo nano / | ||
| - | </ | ||
| - | |||
| - | In the ''< | ||
| - | |||
| - | <code apache> | ||
| - | < | ||
| - | Options Indexes FollowSymLinks | ||
| - | AllowOverride All | ||
| - | Require all granted | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | ===== Step 15: Configure .htaccess for URL Rewrites ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo nano / | ||
| - | </ | ||
| - | |||
| - | Paste: | ||
| - | |||
| - | <code apache> | ||
| - | Options +FollowSymLinks -Indexes | ||
| - | RewriteEngine On | ||
| - | RewriteCond %{HTTP: | ||
| - | RewriteRule .* - [E=HTTP_AUTHORIZATION: | ||
| - | RewriteCond %{REQUEST_FILENAME} !-d | ||
| - | RewriteCond %{REQUEST_FILENAME} !-f | ||
| - | RewriteRule ^ index.php [L] | ||
| - | </ | ||
| - | |||
| - | ===== Step 16: Create and Enable Horizon Systemd Service ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo nano / | ||
| - | </ | ||
| - | |||
| - | Paste: | ||
| - | |||
| - | <code ini> | ||
| - | [Unit] | ||
| - | Description=Pixelfed Horizon Queue Worker (Laravel Horizon) | ||
| - | After=network.target apache2.service php8.4-fpm.service redis-server.service mariadb.service | ||
| - | Wants=apache2.service php8.4-fpm.service redis-server.service mariadb.service | ||
| - | |||
| - | [Service] | ||
| - | Type=simple | ||
| - | User=www-data | ||
| - | Group=www-data | ||
| - | WorkingDirectory=/ | ||
| - | ExecStart=/ | ||
| - | Restart=on-failure | ||
| - | RestartSec=5s | ||
| - | StandardOutput=journal | ||
| - | StandardError=journal | ||
| - | NoNewPrivileges=yes | ||
| - | PrivateTmp=true | ||
| - | ProtectSystem=strict | ||
| - | ProtectHome=yes | ||
| - | ReadWritePaths=/ | ||
| - | ReadWritePaths=/ | ||
| - | |||
| - | [Install] | ||
| - | WantedBy=multi-user.target | ||
| - | </ | ||
| - | |||
| - | Then: | ||
| - | |||
| - | <code bash> | ||
| - | sudo systemctl daemon-reload | ||
| - | sudo systemctl enable pixelfed.service | ||
| - | sudo systemctl restart pixelfed.service | ||
| - | sudo systemctl status pixelfed.service | ||
| - | journalctl -u pixelfed.service -n 50 | ||
| - | </ | ||
| - | |||
| - | ===== Step 17: Restart All Services ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo apache2ctl configtest | ||
| - | sudo systemctl reload apache2 | ||
| - | sudo systemctl restart apache2 php8.4-fpm pixelfed.service redis-server | ||
| - | </ | ||
| - | |||
| - | ===== Step 18: Create Admin User ===== | ||
| - | |||
| - | <code bash> | ||
| - | sudo -u www-data php artisan user:create | ||
| - | </ | ||
| - | |||
| - | Follow prompts (example values): | ||
| - | |||
| - | * Name: Admin | ||
| - | * Username: admin | ||
| - | * Email: webmaster@haacksnetworking.org | ||
| - | * Password: 8gHpw# | ||
| - | * Make this user an admin? yes | ||
| - | |||
| - | ===== Step 19: Verification and Debugging Checks ===== | ||
| - | |||
| - | * Check Redis: | ||
| - | <code bash> | ||
| - | redis-cli ping | ||
| - | redis-cli keys " | ||
| - | sudo systemctl status redis-server | ||
| - | sudo systemctl status pixelfed.service | ||
| - | journalctl -u pixelfed.service -n 50 | ||
| - | </ | ||
| - | |||
| - | * Verify queue config: | ||
| - | <code bash> | ||
| - | sudo -u www-data php artisan config:show queue | grep default | ||
| - | </ | ||
| - | |||
| - | * Check well-known / NodeInfo: | ||
| - | <code bash> | ||
| - | curl -s https:// | ||
| - | curl -s https:// | ||
| - | sudo -u www-data php artisan route:list | grep -i nodeinfo | ||
| - | </ | ||
| - | |||
| - | * Federation test: | ||
| - | <code bash> | ||
| - | curl -I https:// | ||
| - | curl -I https:// | ||
| - | </ | ||
| - | |||
| - | * Check logs: | ||
| - | <code bash> | ||
| - | tail -n 100 / | ||
| - | </ | ||
| - | |||
| - | ===== Update Instructions ===== | ||
| - | |||
| - | <code bash> | ||
| - | cd / | ||
| - | git pull origin dev | ||
| - | sudo -u www-data composer install --no-dev --optimize-autoloader | ||
| - | sudo -u www-data php artisan migrate --force | ||
| - | sudo -u www-data php artisan config: | ||
| - | sudo -u www-data php artisan route:cache | ||
| - | sudo systemctl restart pixelfed.service apache2 php8.4-fpm redis-server | ||
| - | </ | ||
| - | |||
| - | Always check GitHub for release notes before updating. | ||
| - | |||
| - | |||
| - | --- // | ||