How to Self-Host Forgejo on Linode (2026 Guide)
Self-hosting applications like Forgejo can empower developers and homelabbers by providing control over their data and tools. In this guide, we will walk you through the process of installing Forgejo on a Linode VPS. Forgejo is an open-source software that facilitates source code management using Git, similar to platforms like GitHub but with greater flexibility for self-hosted environments.
Why Choose Linode for Forgejo?
Before diving into the installation process, letโs briefly discuss why Linode makes a great choice for hosting Forgejo. Linode offers high-performance virtual machines starting at just 5 USD per month, making it an affordable option for developers. Their infrastructure is streamlined for speed and reliability, essential for efficient Git hosting.
Linode VPS Pricing Overview
Here is a quick comparison of VPS providers based on their starting prices:
| Provider | Monthly Price (EUR/USD) | CPU Cores | RAM | Storage |
|---|---|---|---|---|
| Contabo VPS | 5.99 EUR/mo | 4 | 8GB | 200GB |
| Hetzner Cloud | 4.15 EUR/mo | 1 | 2GB | 20GB |
| DigitalOcean | 6 USD/mo | 1 | 1GB | 25GB |
| Vultr | 6 USD/mo | 1 | 1GB | 25GB |
| Linode | 5 USD/mo | 1 | 2GB | 50GB |
For a complete comparison, check out our full VPS comparison.
Prerequisites for Self-Hosting Forgejo on Linode
Before we start with the installation, ensure you have the following:
- A Linode Account: Create an account on Linode, if you havenโt already.
- A VPS Instance: Spin up a new Linode instance with at least 2 GB of RAM.
- Domain Name: Itโs best practice to have a domain name pointed to your Linodeโs IP address.
- Basic Knowledge of Linux Command Line: Familiarity with SSH and command-line operations will help.
Step-by-Step Installation Guide
Step 1: Access Your Linode Instance
Once your Linode instance is up and running, SSH into it:
ssh root@YOUR_LINODE_IP
Replace YOUR_LINODE_IP with your Linodeโs public IP address.
Step 2: Update the System
Ensure your system is up-to-date with the latest security patches:
sudo apt update && sudo apt upgrade -y
Step 3: Install Dependencies
Forgejo requires several dependencies. Install them with:
sudo apt install -y git redis-server nginx postgresql
Make sure these services are enabled to start on boot:
sudo systemctl enable redis-server
sudo systemctl enable postgresql
sudo systemctl start redis-server
sudo systemctl start postgresql
Step 4: Configure PostgreSQL
Log into PostgreSQL to create a database and user for Forgejo. Use the following commands:
sudo -u postgres psql
Then execute:
CREATE DATABASE forgejo;
CREATE USER forgejo_user WITH PASSWORD 'your_secure_password';
GRANT ALL PRIVILEGES ON DATABASE forgejo TO forgejo_user;
Replace your_secure_password with a strong password.
Step 5: Download and Install Forgejo
Now, download Forgejoโs latest version from their official releases page:
wget https://forgejo.org/release/forgejo_latest_linux_amd64.tar.gz
tar -xvzf forgejo_latest_linux_amd64.tar.gz
cd forgejo-*
Step 6: Configure Forgejo
Create a configuration file based on the sample provided:
cp forgejo.sample.toml forgejo.toml
Edit the forgejo.toml file:
nano forgejo.toml
Adjust the following settings:
- Database connection
- Server domain
- Your SMTP settings for email notifications, if needed.
Step 7: Set Up Nginx
Create a new Nginx configuration file for Forgejo:
sudo nano /etc/nginx/sites-available/forgejo
Add the following configuration:
server {
listen 80;
server_name YOUR_DOMAIN;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Enable the site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/forgejo /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Step 8: Start Forgejo
Finally, start Forgejo with the following command:
./forgejo server
Your Forgejo instance should now be live at http://YOUR_DOMAIN.
Frequently Asked Questions
What are the benefits of self-hosting Forgejo?
Self-hosting Forgejo gives you complete control over your projects and data. You can customize the environment according to your workflow needs, ensuring privacy and security of your repositories. Additionally, you avoid vendor lock-in and have the freedom to modify the software as desired.
Is it difficult to set up Forgejo on Linode?
Setting up Forgejo on Linode is straightforward if you follow the outlined steps. With a foundational understanding of Linux and basic server management, most developers will find the process manageable. Linode also provides excellent documentation and support, which can assist during the setup.
Can I host multiple instances of Forgejo on a single Linode?
While it is technically possible to host multiple instances of Forgejo on the same Linode by configuring different ports and domains, it is not recommended. Doing so can lead to resource competition and reduced performance. Itโs generally better to allocate separate Linode instances for high-availability configurations.
In conclusion, by following this guide, you have successfully set up Forgejo on Linode. This setup allows for a streamlined development workflow while providing the benefits of self-hosting. Embrace the flexibility of Forgejo and enhance your development efficiency today!