How to install Gitea on a fresh Ubuntu/Debian server

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"

Gitea an open source easy-to-use self hosted git server written in Go. It has many features like time tracking, repository branching, file logging, notifications, built-in wiki and much more. Gitea is an lightweight application meaning that it can be run on lower spec systems too. It is an great lightweight alternative to GitLab. It’s really easy to setup and you will find most of the features that you will find in typical source control platform. This tutorial will show you how to install Gitea on Ubuntu Or Debian Systems

Requirements :

  • 1-2GB of RAM or more (Will be sufficient for small teams)
  • 2 Core CPU or more (Sufficient for small teams)
  • VPS with Ubuntu 18.04 or greater or Debian 9 or 10

Step 1 : Updating the Server

First step will be to update the server and look for any new security patches or updates etc

apt-get update -y
apt-get upgrade -y

Step 2 : Installing MariaDB & Apache

We will need a database for our Gitea Server to store its content, In our case we will be using MariaDB Server

apt-get install mariadb-server mariadb-client
apt-get install apache

To continue further installation of MariaDB Server run the following command


You will see a prompt enter the details as shown in pictures or in text below

Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Then, Run the following commands to create a database for Gitea

mysql -u root -p

CREATE USER ‘giteauser’@localhost IDENTIFIED BY ‘giteapassword’;
GRANT ALL PRIVILEGES ON giteadb.* TO ‘giteauser’@localhost;

Step 3 : Installing Git & Creating User

We need to install GIT in our server to install files for Gitea directly from its source link, To install GIT run the following command

apt-get install git

Create a user for Gitea

adduser \
–system \
–shell /bin/bash \
–gecos ‘Git Version Control’ \
–group \
–disabled-password \
–home /home/git \

Step 4 : Installing Gitea

We have almost installed everything we need in order to run self-hosted gitea server on our VPS. To further install Gitea we can download or clone the latest release file through the official repository link


Move the files to /usr/local/bin

mv gitea-1.15.10-linux-amd64 /usr/local/bin/gitea

Create the following directory structure for Gitea and give permissions to folders

mkdir -p /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log}
chown git:git /var/lib/gitea/{data,indexers,log}
chmod 750 /var/lib/gitea/{data,indexers,log}
chown root:git /etc/gitea
chmod 770 /etc/gitea

Create a new service file for Gitea and paste the following content into the file

nano /etc/systemd/system/gitea.service

Description=Gitea (Git with a cup of tea)
# Don't forget to add the database service dependencies
# If using socket activation for main http/s
# (You can also provide gitea an http fallback and/or ssh socket too)
# An example of /etc/systemd/system/gitea.main.socket
## [Unit]
## Description=Gitea Web Socket
## PartOf=gitea.service
## [Socket]
## Service=gitea.service
## ListenStream=<some_port>
## NoDelay=true
## [Install]

# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
# If you install Git to directory prefix other than default PATH (which happens
# for example if you install other versions of Git side-to-side with
# distribution version), uncomment below line and add that prefix to PATH
# Don't forget to place git-lfs binary on the PATH below if you want to enable
# Git LFS support
# If you want to bind Gitea to a port below 1024, uncomment
# the two values below, or use socket activation to pass Gitea its ports as above


Press CTRL+O and enter to save the file and reload the daemon and start Gitea and also enable Gitea on Boot

systemctl daemon-reload
systemctl enable gitea
systemctl start gitea

Check whether if Gitea is running or not

systemctl status gitea

Step 5 : Configuring Gitea using WebInstaller

We have fully installed Gitea and the required packages that was needed to run our Git Server. To further complete the installation of the server we need to run the Web Installer. Access your Installer at


  1. You will see a screen like this, Enter your database details which you created in Step 2

2. You will see a screen like this now which indicates it is being installed

3. Now you can create go to link http://localhost:3000/user/login to access your login page.

Gitea login screen
Gitea login screen

4. You can create an administrative user in the first installation step also if you forgot to do that, You can register an account now which will become an administrator user automatically

5. You will see a prompt like this meaning that the user has been created.

Conclusion :

You have successfully installed Gitea server on your Ubuntu or Debian server!

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"
I'm a freelancer and a semi-professional VALORANT Player from Pakistan, Expert in Network & System Administration & WordPress Developing.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook