PixelFed is an open-source, federated image sharing platform. This tutorial will guide you through the steps to install PixelFed on FreeBSD.
Before proceeding, ensure that your server meets the following requirements:
Update the FreeBSD package manager and upgrade the system to the latest version.
sudo pkg update && sudo pkg upgrade
PixelFed requires Apache, PHP, and a database. Install the required packages:
sudo pkg install apache24 php74 php74-extensions php74-pdo_mysql mysql57-server
During the installation of the MySQL server, set a root password and run the script to secure the installation.
Start the Apache and MySQL services:
sudo sysrc apache24_enable=yes
sudo sysrc mysql_enable=yes
sudo service mysql-server start
sudo service apache24 start
Install Git to fetch the PixelFed source code:
sudo pkg install git
PixelFed requires several PHP modules. Edit the php.ini
file to enable the required modules:
sudo vi /usr/local/etc/php.ini
Add the following lines to enable the required modules:
extension=bz2
extension=ctype
extension=curl
extension=dom
extension=exif
extension=fileinfo
extension=gd
extension=gettext
extension=gmp
extension=intl
extension=json
extension=mbstring
extension=mysqli
extension=openssl
extension=pdo
extension=pdo_mysql
extension=posix
extension=session
extension=tokenizer
extension=xml
extension=zip
Save and close the file.
Clone the PixelFed repository from GitHub:
sudo git clone https://github.com/pixelfed/pixelfed.git /usr/local/www/pixelfed
Set the correct file permissions:
sudo chown -R www:www /usr/local/www/pixelfed
sudo chmod -R 755 /usr/local/www/pixelfed
Create a new virtual host configuration file for Apache:
sudo vi /usr/local/etc/apache24/Includes/pixelfed.conf
Add the following content to the file:
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /usr/local/www/pixelfed/public
<Directory /usr/local/www/pixelfed/public>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/pixelfed-error.log
CustomLog /var/log/pixelfed-access.log combined
</VirtualHost>
Replace your-domain.com
with your domain name, then save and close the file.
Restart the Apache service:
sudo service apache24 restart
Copy the example configuration file to the configuration folder and rename it to pixelfed.env
:
sudo cp /usr/local/www/pixelfed/.env.example /usr/local/www/pixelfed/.env
Edit the configuration file:
sudo vi /usr/local/www/pixelfed/.env
Update the following settings:
APP_URL=http://your-domain.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=pixelfed
DB_USERNAME=root
DB_PASSWORD=your-mysql-root-password
Save and close the file.
Log in to the MySQL server:
sudo mysql -u root -p
Enter the MySQL root password when prompted.
Create a new database named pixelfed
:
CREATE DATABASE pixelfed;
Create a new user and grant access to the pixelfed
database:
CREATE USER 'pixelfed'@'localhost' IDENTIFIED BY 'your-pixelfed-db-password';
GRANT ALL PRIVILEGES ON pixelfed.* TO 'pixelfed'@'localhost';
Replace your-pixelfed-db-password
with a strong password.
Exit the MySQL prompt:
exit;
Run the database migration script to create the required tables and data:
sudo php /usr/local/www/pixelfed/artisan migrate
PixelFed requires an SMTP server to send emails. Edit the configuration file to set up the SMTP server:
sudo vi /usr/local/www/pixelfed/.env
Update the following settings:
MAIL_DRIVER=smtp
MAIL_HOST=your-smtp-server
MAIL_PORT=587
MAIL_USERNAME=your-smtp-username
MAIL_PASSWORD=your-smtp-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@your-domain.com
MAIL_FROM_NAME=PixelFed
Replace your-smtp-server
, your-smtp-username
, and your-smtp-password
with your SMTP server information.
Save and close the file.
Create a new user account with administrator privileges:
sudo php /usr/local/www/pixelfed/artisan user:create admin
Follow the prompts to set up the username, email, and password.
Start the PixelFed service:
sudo php /usr/local/www/pixelfed/artisan queue:work
Access the PixelFed web interface by visiting http://your-domain.com
in your web browser.
Congratulations! You have successfully installed PixelFed on FreeBSD.
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!