PixelFed is a free and open-source federated image sharing platform that is very similar to Instagram. It is built on ActivityPub, which is a decentralized social networking protocol. In this tutorial, we will explain how you can install PixelFed on nixOS latest.
Before we start, make sure that you have the following:
Please note that you will need a domain name in order to install PixelFed. If you do not have one already, you can purchase one from a domain registrar.
The first step is to clone the PixelFed repository from the project's GitHub repository. Open a terminal and run the following command:
$ git clone https://github.com/pixelfed/pixelfed.git
This will clone the Pixelfed repository to your current directory.
Before we can run PixelFed, we need to install some dependencies. We will use Nix to manage our dependencies.
Run the following command to install the necessary dependencies:
$ nix-shell --run "composer install"
This will install all the necessary dependencies.
We need to set up the environment variables that PixelFed requires. To do this, copy the .env.example
file to .env
:
$ cp .env.example .env
Open the .env
file with a text editor and fill in the appropriate values. You will need to set the APP_URL
variable to your domain name.
The next step is to create the database and run the migrations.
Run the following command to create the database:
$ php artisan db:create
After the database is created, run the following command to run the migrations:
$ php artisan migrate
This will create the necessary tables in the database.
Finally, we need to set up the web server. We will use Apache for this tutorial.
Create a new file in the Apache configuration directory:
$ sudo nano /etc/apache2/sites-available/pixelfed.conf
Add the following configuration to the file:
<VirtualHost *:80>
ServerName your.domain.com
DocumentRoot /path/to/pixelfed/public
DirectoryIndex index.php
<Directory /path/to/pixelfed/public>
AllowOverride All
Options -Indexes -MultiViews
Require all granted
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
</VirtualHost>
Make sure to replace your.domain.com
with your domain name, and /path/to/pixelfed
with the path to your PixelFed installation.
Enable the new configuration:
$ sudo ln -s /etc/apache2/sites-available/pixelfed.conf /etc/apache2/sites-enabled/pixelfed.conf
Restart Apache for the changes to take effect:
$ sudo systemctl restart apache2
PixelFed requires a cron job to be set up in order to run some of its background tasks.
Add the following line to your crontab file:
* * * * * php /path/to/pixelfed/artisan schedule:run >> /dev/null 2>&1
Make sure to replace /path/to/pixelfed
with the path to your PixelFed installation.
After completing the steps above, PixelFed should be installed and running on your system. Visit http://your.domain.com
in your web browser to access the web interface.
In this tutorial, we have shown you how to install PixelFed on nixOS latest. By following the steps above, you should be able to set up your own federated image sharing platform.
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!