Ubuntu Linux

How to Install Gogs on Ubuntu 24.04

Richard
Written by
Richard
Mar 19, 2025 Updated Mar 20, 2026 5 min read

This article explains how to install Gogs, a self-hosted Git service on Ubuntu 24.04.

Gogs is a self-hosted Git service that provides a simple and efficient way to manage your Git repositories. It provides a smooth experience for hosting your version control system without relying on cloud services.

Gogs integrates with development workflow tools and services, including webhooks and CI/CD systems. As an open-source platform, Gogs allows code modifications and supports community contributions.

The steps below walk you through installing Gogs on Ubuntu 24.04.

Set up Ubuntu

Gogs requires a Git service, so you need Git installed. Additionally, you must create an account to run Gogs services on your machine.

To get all these done, run the command below to install Git.

🐧Bash / Shell
sudo apt update
sudo apt install git

Next, create a Git account to run Gogs by executing the command below.

🐧Bash / Shell
sudo adduser --system --group --disabled-password --shell /bin/bash --home /home/git --gecos 'Git Version Control' git

If the command above was successful, you should see a similar output.

💻Code
info: Selecting GID from range 100 to 999 ...
info: Adding system user `git' (UID 122) ...
info: Adding new group `git' (GID 124) ...
info: Adding new user `git' (UID 122) with group `git' ...
info: Creating home directory `/home/git' ...

Install MariaDB

Gogs needs a database server to store its content. A good open-source database server to use is MariaDB.

Run the command below to install MariaDB.

🐧Bash / Shell
sudo apt install mariadb-server

After installing MariaDB, create an empty database for Gogs.

Run the command below to log on the the MariaDB database server.

🐧Bash / Shell
sudo mariadb

Then, run the command below to change the [GLOBAL innodeb_file_per_table] to On.

💻Code
SET GLOBAL innodb_file_per_table = ON;

Next, create a Gogs database called gogsdb

💻Code
CREATE DATABASE gogsdb;

Then, create a database user called gogsuser with a new password

💻Code
CREATE USER 'gogsuser'@'localhost' IDENTIFIED BY 'Type_new_password_here';

After that run the command below to grant the user full access to the database.

💻Code
GRANT ALL ON gogsdb.* TO 'gogsuser'@'localhost' WITH GRANT OPTION;

Next, run the commands below to update the database character set.

💻Code
ALTER DATABASE gogsdb CHARACTER SET = utf8mb4 COLLATE utf8mb4_unicode_ci;

Finally, save your changes and exit.

💻Code
FLUSH PRIVILEGES;
EXIT;

Download and install Gogs

After setting up Ubuntu and installing MariaDB with a database, you can proceed to download the Gogs file for installation.

To download the latest files, use the link below.

https://github.com/gogs/gogs/releases

Run the commands below to download the Gogs file. Replace the version number with the latest.

Command Prompt
cd /tmp
wget https://github.com/gogs/gogs/releases/download/v0.13.2/gogs_0.13.2_linux_amd64.tar.gz

Then extract the downloaded file into the Git user’s home directory created above by running the commands below:

🐧Bash / Shell
sudo tar xvf gogs_0.13.2_linux_amd64.tar.gz
-C /home/git

After that, give the Git user ownership of the Gogs folder.

🐧Bash / Shell
sudo chown -R git: /home/git/gogs

Next, create Gogs service scripts by transferring them from the user directory to the system directory.

🐧Bash / Shell
sudo cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/

When all is done, reload the systemd and start Gogs services.

🐧Bash / Shell
sudo systemctl daemon-reload
sudo systemctl enable gogs
sudo systemctl start gogs

To check Gogs’ status, run the commands below:

🐧Bash / Shell
sudo systemctl status gogs

You should see a similar message below:

💻Code
gogs.service - Gogs
Loaded: loaded (/etc/systemd/system/gogs.service; enabled; preset: enabled)
Active: active (running) since Wed 2025-03-19 10:33:58 CDT; 6s ago
Main PID: 4839 (gogs)
Tasks: 6 (limit: 4551)
Memory: 34.2M (peak: 34.5M)
CPU: 109ms
CGroup: /system.slice/gogs.service
└─4839 /home/git/gogs/gogs web

Gogs should be installed and ready to configure.

Open your browser and browse to the server hostname or IP address followed by port 3000.

💻Code
http://localhost:3000/install

You should see Gogs set up initial web portal.

On the page, select the database type, enter the database name, and provide the user account and password.

Gogs database connection

Then, expand the admin account settings and create an admin account. Then, click ‘Install Gogs.’

Gogs admin account

Gogs should be ready to use. Login.

Gogs admin account dashboard

That should do it!

Conclusion:

In summary, Gogs is a powerful self-hosted Git service that simplifies repository management. By following the steps outlined in this article, you can successfully install and configure Gogs on your Ubuntu 24.04 machine. Here are the key points to remember:

  • Gogs provides a user-friendly interface for managing Git repositories.
  • Installation involves setting up Git, MariaDB, and the Gogs application itself.
  • Ensure database setup includes creating a dedicated user and granting proper access rights.
  • Access the Gogs installation portal through your web browser to complete the configuration.
  • Regularly check the service status to ensure everything is running smoothly.

Gogs is now ready for you to use, enhancing your development workflow efficiently!

Frequently Asked Questions

What is Gogs and why should I use it?

Gogs is a self-hosted Git service that allows you to manage your Git repositories efficiently. It provides a simple interface and integrates well with development tools, making it an excellent choice for those who prefer not to rely on cloud services.

How do I install Git on Ubuntu 24.04?

To install Git on Ubuntu 24.04, open your terminal and run the command 'sudo apt update' followed by 'sudo apt install git'. This will install the latest version of Git available in the Ubuntu repositories.

What database does Gogs use and how do I set it up?

Gogs uses MariaDB as its database server. You can set it up by installing MariaDB with 'sudo apt install mariadb-server', then creating a database and user for Gogs using the provided SQL commands.

How can I download the latest version of Gogs?

You can download the latest version of Gogs by visiting the official GitHub releases page at 'https://github.com/gogs/gogs/releases'. Make sure to replace the version number in the download command with the latest one available.

What are the system requirements for running Gogs?

Gogs requires a server running Ubuntu 24.04 with Git and a database server like MariaDB. Additionally, you should have sufficient disk space and memory to handle your repositories and user load.

Was this guide helpful?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version