How to Install Forgejo on Ubuntu: A Self-Hosted Lightweight Git Forge
Forgejo is a self-hosted, lightweight software forge that bundles Git hosting, issues, pull requests, a wiki, releases, a package registry and Forgejo Actions into a single Go binary. Maintained by the Codeberg community as a fork of Gitea, it is built to run well on modest hardware, from a spare Ubuntu server to a small cloud instance.
For teams and individuals who want the convenience of a hosted Git platform while keeping full control of their data, Forgejo hits a sweet spot. It has no sprawling dependency stack, defaults to SQLite for small instances, and scales up to PostgreSQL or MySQL when the workload grows.
Ubuntu does not ship Forgejo in its default archives, and upstream moves faster than the release cycle of a stable distribution. The unofficial deb.griffo.io repository closes the gap with an up-to-date, prebuilt forgejo package, letting you install and upgrade the forge through apt instead of managing binaries manually.
Install the Latest Forgejo on Ubuntu: The Short Version
If you only came for the commands, this adds the repository and installs the latest Forgejo .deb package on Ubuntu:
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null
sudo apt update
sudo apt install forgejo
The rest of this guide explains what each command does, how to verify the install, how to keep Forgejo up to date, and what to check when something goes wrong.
What Makes Forgejo Special?
- 🔧 Single binary - The whole forge is one self-contained Go executable
- 🪶 Lightweight - Comfortable on a 1 GB instance or a small home server
- 🔀 Pull requests and code review - Reviews, protected branches and a full merge workflow
- 🎬 Forgejo Actions - Integrated CI/CD compatible with the GitHub Actions ecosystem
- 📦 Package registry - Serve Docker, npm, PyPI, Cargo and Maven artifacts next to your code
- 🗄️ Flexible databases - SQLite for small setups, PostgreSQL or MySQL for larger ones
- 🌐 Federation-minded - A community-governed project working towards forge federation
- 🛡️ Self-hosted and private - Repositories, issues and accounts stay on your own machine
Why Use the deb.griffo.io Repository?
- Easy installation and updates through the APT package manager
- Automatic dependency management handled by Debian/Ubuntu packaging
- Always tracks upstream releases so fixes reach you without delay
- No compiling from source and no hand-placed binaries
- Works across supported Ubuntu releases with the codename detected automatically
Prerequisites
Before you begin, make sure you have:
- An Ubuntu system (Jammy 22.04 LTS, Noble 24.04 LTS, or newer)
sudoprivilegescurlinstalled (sudo apt install curlif needed)- Git installed (
sudo apt install git) - Optionally, PostgreSQL if you prefer it over SQLite
Step 1: Add the deb.griffo.io Repository
Register the signing key and repository with APT:
# Create the keyrings directory
sudo install -d -m 0755 /etc/apt/keyrings
# Download and install the repository GPG key
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
# Add the repository (auto-detects your distro codename)
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null
# Update the package list
sudo apt update
What each command does:
- Keyrings directory - Prepares
/etc/apt/keyringswith the right permissions for third-party keys. - GPG key - Retrieves the repository key and stores it de-armoured for verification.
- Repository entry - Adds the source bound to the key, with
lsb_release -scsupplying your Ubuntu codename such asnoble. - Update - Refreshes the package metadata.
Step 2: Update the Package List
If you did not run the final line above, do so now:
sudo apt update
Step 3: Install Forgejo
Install the package:
sudo apt install forgejo
This installs the forgejo binary, creates the dedicated forgejo system user, sets up the working directory under /var/lib/forgejo, and drops in a systemd service unit.
Step 4: Verify the Installation
Check the version to confirm the install:
forgejo --version
Expected output resembles:
Forgejo version 11.0.1+gitea-1.22.0 (built with go1.23.4)
Getting Started with Forgejo
The package delivers the software; you still start the service and complete a one-time web configuration.
Start and Enable the Service
Enable Forgejo at boot and launch it immediately:
sudo systemctl enable --now forgejo
sudo systemctl status forgejo
Forgejo listens on port 3000 by default. If it does not start, follow the logs:
sudo journalctl -u forgejo -f
Run the Initial Web Setup
Visit http://your-server-ip:3000/ in a browser. Forgejo’s first-run installation page collects the key settings:
- Database - SQLite for a simple instance, or PostgreSQL/MySQL for something larger and more concurrent.
- Site title and base URL - Set the address you will reach the forge on.
- Data paths - The packaged defaults under
/var/lib/forgejoare fine for most people. - Administrator account - Create the first admin in the optional settings section.
Submitting the form writes your choices to /etc/forgejo/app.ini, which becomes the authoritative configuration for the instance.
Configure app.ini
For settings beyond the installer, edit /etc/forgejo/app.ini and restart the service:
sudo -e /etc/forgejo/app.ini
sudo systemctl restart forgejo
Early adjustments worth making include setting [server] DOMAIN and ROOT_URL, turning off open sign-ups with [service] DISABLE_REGISTRATION = true, and adding an SMTP [mailer] block so notification emails work.
Create an Admin User from the CLI
You can create an administrator without the browser form. Run it as the forgejo user so ownership is preserved:
sudo -u forgejo forgejo admin user create \
--admin \
--username root \
--email admin@example.com \
--random-password \
--config /etc/forgejo/app.ini
Put It Behind a Reverse Proxy
For public access, terminate TLS with a reverse proxy. On Ubuntu, nginx is a common choice; a minimal proxy block looks like this:
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
Set ROOT_URL in app.ini to your public HTTPS URL so clone links and generated URLs are correct.
Keeping Forgejo Updated
Upgrades ride along with normal package maintenance:
sudo apt update && sudo apt upgrade
Restart the service after an upgrade so the new binary is loaded. Forgejo applies database migrations automatically at startup, but always back up your data directory and database before a major version bump.
Other Tools from deb.griffo.io
The repository packages other self-hosting and developer tooling that complements a Forgejo instance:
- Forgejo Runner - The CI/CD runner that executes your Forgejo Actions
- Lazygit - A fast terminal UI for everyday Git operations
- Lazydocker - A terminal UI for Docker and docker-compose
- k9s - A terminal UI for managing Kubernetes clusters
Troubleshooting
GPG or Key Errors
If APT cannot verify the repository, re-import the key:
sudo rm -f /etc/apt/keyrings/deb.griffo.io.gpg
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
sudo apt update
Package Not Found
If APT cannot locate the forgejo package:
- Run
sudo apt updateto refresh the index. - Confirm you are on a supported release (Jammy 22.04, Noble 24.04, or newer).
- Inspect the source entry:
cat /etc/apt/sources.list.d/deb.griffo.io.list
Service Fails to Start
If the service will not start, read the journal for the reason:
sudo journalctl -u forgejo -n 50 --no-pager
Typical culprits are an unreachable database, a ROOT_URL mismatch, or bad ownership on the data directory. Fix ownership with:
sudo chown -R forgejo:forgejo /var/lib/forgejo
Uninstalling
To remove Forgejo:
sudo systemctl disable --now forgejo
sudo apt remove forgejo
Your data under /var/lib/forgejo and the config in /etc/forgejo remain until you delete them yourself. To remove the repository:
sudo rm /etc/apt/sources.list.d/deb.griffo.io.list
sudo rm /etc/apt/keyrings/deb.griffo.io.gpg
sudo apt update
Conclusion
Forgejo brings a complete, self-hosted Git forge to your Ubuntu server without the operational weight of a large platform. Installing from deb.griffo.io sets up the binary, the system user and the systemd unit for you, and keeps everything current through your usual apt upgrade.
Start the service, complete the web setup, add TLS, and attach a runner for CI, and you have a private, fully owned home for your projects.
Frequently Asked Questions
How do I install the latest Forgejo on Ubuntu?
Add the deb.griffo.io APT repository and its signing key, then run sudo apt install forgejo. The repository tracks upstream Forgejo releases, so you get the latest packaged version rather than a build frozen when your distribution was released.
Is there a .deb package for Forgejo?
Yes. deb.griffo.io publishes Forgejo as a signed .deb for Ubuntu. You could download that .deb and install it by hand, but adding the repository is the better option: APT then resolves dependencies and picks up new versions on its own.
How do I update Forgejo to the latest version?
Run sudo apt update && sudo apt upgrade. Once Forgejo is installed from APT there is no separate updater to remember, since new releases arrive with the rest of your system updates.
How do I install Forgejo on Debian?
Exactly the same way; lsb_release -sc simply resolves to a different codename. There is a companion guide with the Debian specifics: How to install Forgejo on Debian.
Which Ubuntu releases are supported?
Jammy 22.04 LTS, Noble 24.04 LTS and newer. Because the repository line is built from lsb_release -sc, the matching suite is selected for you.
Resources
Disclaimer: The deb.griffo.io repository is an unofficial community project and is not affiliated with the official Debian or Ubuntu projects, or with the upstream Forgejo project.