UbuntuUbuntu Based

How To Install Gogs on Ubuntu 22.04 LTS

Install Gogs on Ubuntu 22.04

In this tutorial, we will show you how to install Gogs on Ubuntu 22.04 LTS. Gogs, short for Go Git Service, is a lightweight, self-hosted Git service that mirrors many of the functionalities of platforms like GitHub and GitLab. It’s written in Go, making it a highly efficient and portable solution for all your version control needs.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Gogs on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • Basic knowledge of the Linux command-line interface (CLI). This guide assumes you’re comfortable with executing commands in a terminal.
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Gogs.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Gogs on Ubuntu 22.04 LTS Jammy Jellyfish

Step 1. Before we dive into the installation process, it’s essential to ensure your system is up-to-date. Run the following commands to update your system packages:

sudo apt update
sudo apt upgrade

Next, install the necessary dependencies. For this guide, we’ll be using Git and SQLite. Install them using the following commands:

sudo apt install git sqlite3

Step 2. Installing Gogs on Ubuntu 22.04.

To install Gogs, first, download the latest binary from the official Gogs website. You can use the wget command to download it directly to your server:

wget https://github.com/gogs/gogs/releases/download/v0.13.0/gogs_0.13.0_linux_amd64.tar.gz

Next, extract the downloaded archive using the tar command:

tar -xvf gogs_0.13.0_linux_amd64.tar.gz

For security reasons, it’s recommended to create a dedicated system user for running Gogs. You can do this with the adduser command:

sudo adduser --system --group --disabled-password --shell /bin/bash --home /home/gogs --gecos 'Gogs' gogs

Step 3. Configure Gogs.

Gogs come with a sample configuration file that you can use as a starting point. Copy this file to the actual configuration file:

cp /path/to/gogs/conf/app.ini.sample /path/to/gogs/conf/app.ini

Open the configuration file with your preferred text editor and modify the necessary fields according to your preferences. For example, you might want to change the DOMAIN, HTTP_PORT, ROOT_URL, and database settings.

Gogs support several databases, including MariaDB, PostgreSQL, and SQLite3. For this guide, we’ll be using SQLite3, which we installed earlier. In the Gogs configuration file, ensure the following settings are present under the [database] section:

TYPE = sqlite3
PATH = /path/to/gogs/data/gogs.db

Now that Gogs is installed and configured, it’s time to start the service. You can do this using the systemctl command:

sudo systemctl start gogs

To ensure Gogs starts automatically whenever your system boots, enable the service:

sudo systemctl enable gogs

Step 4. Accessing Gogs Web Interface.

You can access the Gogs web interface through a web browser using your server’s IP address or domain, followed by the port number you specified in the configuration file. The default port is 3000. So, if your server’s IP address is 192.168.1.100, you would navigate to http://192.168.1.100:3000.

Congratulations! You have successfully installed Gogs. Thanks for using this tutorial for installing the Gogs on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official Gogs website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button