How To

Install Gogs on Ubuntu 18.04: Self-Hosted Git Server Setup Guide

Gogs is a free, self-hosted Git service written in Go. It gives you a private GitHub-like environment on your own server, complete with repository browsing, issue tracking, pull requests, team management, and a built-in wiki. It is a lighter-weight alternative to GitLab and uses significantly less memory. Gogs runs comfortably on a small VPS or even a Raspberry Pi.

This guide walks you through installing Gogs on Ubuntu 18.04 from the official binary, running it as a systemd service, and configuring Nginx as an SSL reverse proxy.

<strong>Prerequisites:</strong>&nbsp;You need sudo access. This guide uses SQLite as the database. Install it if it is not already present:
bashsudo apt install sqlite3

Install Gogs on Ubuntu

Install Git and create the service user

Install Git first:

bashsudo apt update &amp;&amp; sudo apt install git

Create a dedicated system user to run the Gogs process. This account has no login password and cannot SSH in directly, which limits the attack surface if the service is ever compromised:

bashsudo adduser --system --group --disabled-password --shell /bin/bash --home /home/git --gecos 'Git Version Control' git

Download and set up the Gogs binary

Check the Gogs download page for the latest release and download the archive. Replace the VERSION value if a newer release is available:

bashVERSION=0.11.86wget https://dl.gogs.io/${VERSION}/gogs_${VERSION}_linux_amd64.tar.gz -P /tmpsudo tar xf /tmp/gogs_*_linux_amd64.tar.gz -C /home/gitsudo chown -R git: /home/git/gogs

Start the Gogs service

Gogs ships with a pre-built systemd unit file. Copy it to the system directory, then start and enable the service:

bashsudo cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/sudo systemctl start gogssudo systemctl enable gogs

Complete the Setup via the Web Installer

Open http://YOUR_SERVER_IP:3000 in a browser. The web installer prompts you to configure:

  • Database Settings: Select SQLite3 and set the path to /home/git/gogs/gogs.db
  • Application Settings: Enter your application name, confirm the repository root (/home/git/gogs-repositories), set Run User to git, and enter your domain or server IP
  • HTTP Port: Leave as 3000 unless you need a different port

Click Install Gogs. The process finishes instantly and redirects you to the login page. Click Sign up now to register. The first account created is automatically assigned admin privileges.

Configure Nginx as an SSL Reverse Proxy

Running Gogs behind Nginx with a valid SSL certificate is strongly recommended for any public-facing server. You will need a domain name pointing to the server and a Let’s Encrypt certificate already installed on Nginx.

Configure Nginx to proxy port 3000 over HTTPS, then update the Gogs configuration to use the new domain:

bashsudo nano /home/git/gogs/custom/conf/app.ini

Update the server section:

[server]DOMAIN   = gogs.example.comROOT_URL = https://gogs.example.com/

Restart Gogs to apply the change:

bashsudo systemctl restart gogs

Gogs also supports email notifications via any SMTP provider. Configure the [mailer] block in app.ini with your SMTP credentials and restart the service. For Slack notifications, use Gogs’s built-in webhook integration under each repository’s settings page.

Upgrading Gogs: Stop the service, rename the old directory, download and extract the new binary, copy customdatalog, and gogs.db from the old directory using rsync, then restart Gogs.

Gogs is now installed and running on your Ubuntu 18.04 server. Create your first repository, invite your team, and start using your private Git server today. Leave a comment below if you run into any issues.

Cyber Defence

Recent Posts

Install PHP on Ubuntu 26.04: Apache, Nginx, and Multiple Versions

PHP 8.5 is included in Ubuntu 26.04's default repositories and is the recommended version for…

2 days ago

Upgrade to Ubuntu 26.04 from 25.10 and 24.04 LTS: Complete Guide

Ubuntu 26.04 LTS "Resolute Raccoon" arrived on April 23, 2026 with Linux kernel 7.0, GNOME 50,…

2 days ago

Install Kubernetes on Ubuntu 26.04 with kubeadm and containerd

Kubernetes is the standard platform for running containerized workloads across multiple servers with self-healing, rolling…

2 days ago

Install Ubuntu 26.04: Bootable USB, Partitioning, and First Steps

Ubuntu 26.04 LTS "Resolute Raccoon" was released on April 23, 2026 with Linux kernel 7.0, GNOME desktop, and standard security support until April 2031. A clean install gives you a known-good starting point on new hardware, when replacing another operating system, or when an upgrade path is not practical. This guide walks through how to install Ubuntu 26.04: downloading and verifying the ISO, writing a bootable USB drive, completing the installer, and doing the initial setup after the first boot. Before you start: You need a USB drive with at least 12 GB of free space. Back up any existing data on the target machine — the installer can erase the entire disk. Install Ubuntu 26.04: Download the ISO…

2 days ago

Change Timezone on Ubuntu: timedatectl and Desktop GUI Guide

The correct timezone affects more than the clock on your screen. It drives cron job scheduling, systemd timer execution, log file timestamps, database record timing, and SSL certificate validity checks. A mismatched timezone can cause scheduled jobs to fire at the wrong hour and make log timestamps impossible to match with real-world events. This guide shows how to change timezone on Ubuntu using the timedatectl command (the recommended approach for servers and remote machines) and through the graphical Date & Time settings on desktop systems. The steps apply to all current Ubuntu releases including 24.04 and 26.04. <strong>Prerequisite:</strong>&nbsp;Only&nbsp;the&nbsp;root&nbsp;user&nbsp;or&nbsp;a&nbsp;user&nbsp;with&nbsp;sudo&nbsp;access&nbsp;can&nbsp;change&nbsp;the&nbsp;system&nbsp;timezone. Check the Current Timezone Before You Change It Run timedatectl with no arguments to see the active timezone and clock status: bashtimedatectl Sample output: Local…

2 days ago

Install Atom on Ubuntu 18.04: GitHub’s Code Editor APT Setup

Atom is a free, open-source, cross-platform code editor developed by GitHub. Built on Electron, it uses…

2 days ago