How to install Gitea repository in Ubuntu


In this tutorial, How to install Gitea repository in Ubuntu.

  • Gitea is a web-based Git repository management tool, similar to GitHub, GitLab, and Bitbucket. It is a self-hosted, open-source software that allows developers to create and manage Git repositories, as well as collaborate with others on software development projects.
  • With Gitea, you can create your own private Git repositories, manage access control and permissions for users and teams, and track issues and bugs with an integrated issue tracker. It also supports pull requests, code reviews, and continuous integration and deployment with built-in integrations for popular tools like Jenkins and Travis CI.
  • It is written in Go, and it’s lightweight and easy to set up and run.

Install the Gitea repository in Ubuntu

Install the necessary dependencies

sudo apt-get install wget get mariadb-server -y

After installed complete, to step secure the database server as command below:

sudo mysql_secure_installation

Create a database and user

Log in to the database console as below:

sudo mysql -u root -p

Create the database

GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY "your_password";

Install Gitea repository

Download and copy to “/usr/local/bin

sudo wget -O /usr/local/bin/gitea

Change the permissions

sudo chmod +x /usr/local/bin/gitea

Create a new system user for running Gitea:

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

Create the folder and change the permission

sudo mkdir -pv /var/lib/gitea/{custom,data,log}
sudo chown -Rv git:git /var/lib/gitea
sudo chmod -Rv 750 /var/lib/gitea
sudo mkdir -v /etc/gitea
sudo chown -Rv root:git /etc/gitea
sudo chmod -Rv 770 /etc/gitea

Create a systemd service file for Gitea.

Create a new systemd service file for Gitea by running the following command:

sudo nano /etc/systemd/system/gitea.service

Paste the following configuration into the service file:



ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea


Save and close the file.

Start and enable the Gitea service by running the following commands:

sudo systemctl start gitea
sudo systemctl enable --now gitea
How to install Gitea repository in Ubuntu

Access the Gitea web-based installer

Open a browser and point it to http://YOUR_SERVER:3000


You have to install Gitea repository in Ubuntu. I hope this will be helpful. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.