How to Install PixelFed on Debian Latest
PixelFed is a free and open-source social media platform that allows users to share photos and videos. It is similar to Instagram in terms of functionality but is decentralized and owned by the community. Installing PixelFed on Debian Latest is a straightforward process that can be done with ease following this tutorial.
Prerequisites
Before installing PixelFed on Debian Latest, make sure you have the following requirements:
- A VPS (Virtual Private Server) or dedicated server running Debian Latest.
- Apache web server installed and configured.
- PHP and its extensions (php7.4-fpm, php7.4-xml, php7.4-mbstring, php7.4-gd, php7.4-zip) installed.
- A database management system (MySQL, PostgreSQL) installed and configured.
Step 1: Update and Upgrade Packages
Update and upgrade all the packages to their latest version using the apt command.
sudo apt update
sudo apt upgrade
Step 2: Install Required Dependencies
Install the necessary software packages required by PixelFed using the apt command.
sudo apt install git nginx php7.4-fpm php7.4-xml php7.4-mbstring php7.4-gd php7.4-zip composer ffmpeg libimage-exiftool-perl exiftool -y
Step 3: Clone PixelFed Repository
Clone the PixelFed repository from the official website using the Git command.
sudo git clone https://github.com/pixelfed/pixelfed.git /var/www/pixelfed
Step 4: Set Permissions
Change the ownership of the folder and set the correct permissions on the system files for the web server to access them.
sudo chown -R www-data:www-data /var/www/pixelfed/
sudo chmod -R 755 /var/www/pixelfed/
Step 5: Configure NGINX
Create a virtual host configuration file for PixelFed using a text editor of your choice.
sudo nano /etc/nginx/sites-available/pixelfed
Paste the following contents in the file and save it:
server {
listen 80;
server_name yourservername.com;
root /var/www/pixelfed/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.php$ {
include fastcgi.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
}
}
After saving the file, enable the virtual host configuration.
sudo ln -s /etc/nginx/sites-available/pixelfed /etc/nginx/sites-enabled/
Step 6: Install and Configure Database
Install a database management system (MySQL or PostgreSQL) and create a new database for PixelFed.
sudo apt install mysql-server
mysql -u root -p
CREATE DATABASE pixelfed_db;
GRANT ALL PRIVILEGES ON pixelfed_db.* TO 'pixelfed_user'@'localhost' IDENTIFIED BY 'your_password';
FLUSH PRIVILEGES;
exit
Step 7: Configure Environment Variables
Rename the ".env.example" file to ".env"
cp /var/www/pixelfed/.env.example /var/www/pixelfed/.env
Then, open the ".env" file using a text editor of your choice and edit the following fields
APP_NAME=PixelFed
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_URL=http://yourservername.com
...
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=pixelfed_db
DB_USERNAME=pixelfed_user
DB_PASSWORD=your_password
Step 8: Install Dependencies and Migrations
Install the dependencies of PixelFed using Composer and run the migrations to create the required database tables.
cd /var/www/pixelfed
sudo composer install --no-dev
sudo php artisan migrate
Step 9: Configure SMTP
If you plan on using email features of PixelFed, you'll need to configure SMTP.
MAIL_DRIVER=smtp
MAIL_HOST=your-mail-server.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=your-email-password
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="Your Name"
Step 10: Start NGINX and PHP-FPM
Start the NGINX and PHP-FPM services on your system.
sudo systemctl enable nginx
sudo systemctl start nginx
sudo systemctl enable php7.4-fpm
sudo systemctl start php7.4-fpm
Step 11: Access PixelFed
You can now access PixelFed by navigating to "http://yourservername.com" on your web browser.
Congratulations! You have successfully installed PixelFed on Debian Latest. Enjoy exploring its features!