How to Self-Host Pixelfed on a VPS (Complete Guide)
Pixelfed is a decentralized image sharing platform that offers a unique alternative to traditional social media networks. If youโre a developer or a homelabber looking to self-host Pixelfed, this guide will walk you through the entire process of setting it up on a VPS. By self-hosting Pixelfed, you gain control over your data, customization options, and can create a community that aligns with your values.
Prerequisites
Before diving into the installation process, ensure you have the following:
- A VPS Provider: You can choose from various providers with competitive pricing. Here is a quick comparison:
| Provider | Price (per month) | Location Options |
|---|---|---|
| Contabo VPS | 5.99 EUR | Europe |
| Hetzner Cloud | 4.15 EUR | Europe |
| DigitalOcean | 6 USD | Global |
| Vultr | 6 USD | Global |
| Linode (Akamai) | 5 USD | Global |
Choose and get started with a VPS from your preferred provider, and refer to our full VPS comparison for more details.
-
Linux Knowledge: Basic command-line knowledge is essential for navigating your server.
-
Docker: This guide assumes youโll be using Docker to install Pixelfed.
-
Domain Name: A domain name is necessary for accessing your Pixelfed instance.
Step 1: Setting Up Your VPS
-
Create and Access Your VPS:
- Sign up with your chosen VPS provider, select your required plan, and create your instance.
- Connect to your VPS via SSH:
ssh root@your_vps_ip
-
Update the System:
- Run the following command to update package lists:
sudo apt update && sudo apt upgrade -y
- Run the following command to update package lists:
-
Install Docker:
- Run the following commands to install Docker:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt update sudo apt install docker-ce -y - After installation, ensure Docker is running:
sudo systemctl start docker sudo systemctl enable docker
- Run the following commands to install Docker:
Step 2: Install Pixelfed Using Docker
-
Clone Pixelfed Repository:
- Navigate to a directory of your choice and clone the Pixelfed repository:
git clone https://github.com/pixelfed/pixelfed.git cd pixelfed
- Navigate to a directory of your choice and clone the Pixelfed repository:
-
Set Up the Environment:
- Copy the example environment configuration and edit it:
cp .env.example .env nano .env - Configure your settings such as
APP_URL,DB_HOST, and other necessary parameters.
- Copy the example environment configuration and edit it:
-
Build and Run the Docker Containers:
- Use Docker Compose to build and run the containers:
docker-compose up -d
- Use Docker Compose to build and run the containers:
-
Database Setup:
- Pixelfed requires a database. Make sure you have the necessary migration and seed data in place by running:
docker-compose exec app php artisan migrate --seed
- Pixelfed requires a database. Make sure you have the necessary migration and seed data in place by running:
Step 3: Configuring Pixelfed
-
Accessing Pixelfed:
- Open your web browser and navigate to
http://your_domainorhttp://your_vps_ip. - Follow the setup wizard to finish the installation.
- Open your web browser and navigate to
-
Customizing Your Instance:
- Once installed, you may want to customize your Pixelfed instance. Explore the admin dashboard for settings like user management, theme settings, and more.
FAQs
How much does it cost to self-host Pixelfed on a VPS?
The cost of self-hosting Pixelfed largely depends on the VPS provider you choose. Providers like Hetzner Cloud start at only 4.15 EUR/mo, while DigitalOcean and Vultr have plans starting at about 6 USD/mo. Given that Pixelfed is resource-efficient, even the most basic plans are usually sufficient for small to medium instances. Always consider your expected user base and storage at the time of selection.
Can I run Pixelfed on shared hosting?
While theoretically possible, running Pixelfed on shared hosting is not recommended. Shared hosting typically imposes restrictions on resource usage and does not support Docker, which is essential for easy installation and scaling of applications like Pixelfed. A VPS offers dedicated resources and more control, which is especially important for managing data privacy and application performance.
Is Pixelfed secure when self-hosted?
Security is a critical consideration when self-hosting any application. Pixelfed can be relatively secure if you properly configure your server. It is recommended to use HTTPS for your Pixelfed instance, which can be easily set up using tools like Letโs Encrypt. Regularly update your software, limit access with firewalls, and follow best practices for securing your VPS to enhance your security posture.
By now, you should have a fully operational Pixelfed instance on your VPS! Enjoy the benefits of self-hosting, and remember to actively participate in discussions on platforms like r/selfhosted or browse resources like awesome-selfhosted for more inspiration and tools.