Gitea is a painless self-hosted Git Service. It is a fork of Gogs and is similar to GitHub. You can easily install Gitea on Ubuntu 20.04 as the process is hassle-free and has a freely available source code for hosting written in Go.
Gitea is a lightweight application that installs on low-powered operations and provides an amazing substitute for GitLab. In addition, it is available as a binary package to run across all the distributions. You can install it on all major operating systems and perform many operations such as track time, issues, repository branching, file locking, and merging.

In this article, you will learn how to install Gitea on your Ubuntu 20.04 in the easiest and fastest way.
What You’ll Need
Before starting with the installation, let’s take a look at what you need to do for this process:
- A running Ubuntu 20.04 System
- A sudo privilege or root access
- A wget command utility installed on your server
Make sure that your system meets the requirements mentioned above before you start to install Gitea on Ubuntu.
Installing Gitea
To install Gitea on Ubuntu, there are steps involved that are discussed below. The steps are numbered for your convenience.
1. Update the System to Install Gitea
Gitea supports various databases such as SQLite, PostgreSQL, and MySQL. For smaller installations, it is recommended to use SQLite. However, you must use MySQL or PostgreSQL for larger installations.
In this tutorial, you will use SQLite as the database. First, you will update packages using the command apt
. After that, you will install SQLite using the command given below:
sudo apt update

This command will successfully update the packages. The next step is to install SQLite 3.
sudo apt install sqlite3
Gitea has an automated updated docker image in its docker hub. You can either use the binary release or source release and install it.
2. Configure Git to Install Gitea
To install git on your system, run the command given below:
sudo apt install git
It may ask you if you want to continue. Type “Y” and hit “Enter” key.
Check the git version to verify the installation using the git
command:
git --version
3. Create a Git User to Install Gitea
To install Gitea on your system, you first need to add a user that will run the Git application.
You can create a git user and a git group using the adduser
utility as shown below:
adduser \
> --system \
> --shell /bin/bash \
> --gecos 'Git Version Control' \
> --group \
> --disabled-password \
> --home /home/git \
> git
The above command will create a user “git”, and set its home directory to /home/git
. You will see a similar output as shown in the image below:

4. Download and Install Gitea Binary
Now go to the Gitea download page and download the latest Gitea Binary depending on your system architecture. Currently, the latest version is 1.15.
Write the variable according to the latest version when you are executing the command given below:
sudo wget -O /tmp/Gitea https://dl.Gitea.io/Gitea/${VERSION}/Gitea-${VERSION}-linux-amd64
However, it will take some time for the installation to complete. After the installation is done, you can check its permissions.

To check the permissions, use the ls
command:
ls -lrt Gitea
Secondly, change the permissions using this command.
chmod +x Gitea
After that, move the Gitea binary to the /usr/local/bin
directory.
mv Gitea /usr/local/bin/
Lastly, make the binary executable.
sudo chmod +x /usr/local/bin/Gitea
5. Verify GPG Signature
To verify the GPG Signature for Gitea, you will import the Teabot public key and then verify the Gitea package. To perform this step, execute the command given below:
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
In addition, execute this command to verify Gitea.
gpg --verify Gitea-1.14.2-linux-amd64.asc Gitea
6. Create a Directory Structure
In this step, you will create a Gitea directory structure. Run the commands below to create the directories and set the required permissions and ownership :
sudo mkdir -p /var/lib/Gitea/{custom,data,log}
sudo chown -R git:git /var/lib/Gitea/
sudo chmod -R 750 /var/lib/Gitea/
sudo mkdir /etc/Gitea
sudo chown root:git /etc/Gitea
sudo chmod 770 /etc/Gitea
After all, this is the recommended directory structure on official Gitea documentation.
7. Create a Systemd Unit Service for Gitea
Now that Gitea is downloaded, the next step is to create a systemd
service. Download the sample systemd
unit file to the /etc/systemd/system
directory by running this command:
sudo wget https://raw.githubusercontent.com/go-Gitea/Gitea/main/contrib/systemd/Gitea.service -P /etc/systemd/system/
You don’t have to make any changes to systemd
file.
Secondly, you will reload the daemon. You can use systemctl daemon-reload
command to reload the daemon.
systemctl daemon-reload
In addition, you will have to enable the service. For this step, use systemctl enable --now
command.
systemctl enable --now Gitea
Lastly, you will start the Gitea service. In addition, you will also check its status. For this step, you will run the commands given below:
systemctl start Gitea
systemctl status Gitea
You will get a similar output:

8. Allow the Port
Now that Gitea is running, you can finalize the installation using the web interface.
If you are using a firewall, you need to allow TCP port 3000 by using the ufw
command because Gitea listens to port 3000 by default.
For this step, run the command given below.
ufw allow 3000/tcp
9. Configure Gitea
Now, open your browser and type “http://YOUR_DOMAIN_IR_IP:3000
” or “http://localhost:3000
“. This will open the Gitea homepage as shown below.
After that, click on “Sign In” and adjust the settings as stated below:
Database Settings:
Database Type: SQLite3
Path: Use an absolute path, /var/lib/Gitea/data/Gitea.db
Application General Settings:
Site Title: Enter your organization name.
Repository Root Path: Leave the default var/lib/Gitea/data/Gitea-repositories
.
Git LFS Root Path: Leave the default /var/lib/Gitea/data/lfs
.
Run As Username: git
SSH Server Domain: Enter your domain or server IP address.
SSH Port: 22, change it if SSH is listening on other Port
Gitea HTTP Listen Port: 3000
Gitea Base URL: Use HTTP and your domain or server IP address.
Log Path: Leave the default /var/lib/Gitea/log
Then click on “Install Gitea”. Once the installation has finished, it will redirect you to the home page again.

After that, click on the “Need an account? Register now” link.
When you register for the account, the first account is automatically added to the Admin group.
The next step is to change the permissions using the chmod
command. Execute the following command:
sudo chmod 750 /etc/Gitea
sudo chmod 640 /etc/Gitea/app.ini
That is it! You have successfully installed Gitea on your system.
Update Gitea
To upgrade Gitiea on your system, you will have to install the current service first. Execute the following command to stop the service:
sudo systemctl stop Gitea
Secondly, download the latest Gitea version. After downloading, move it to the /usr/local/bin
directory
VERSION=<THE_LATEST_GITEA_VERSION>
wget -O /tmp/Gitea https://dl.Gitea.io/Gitea/${VERSION}/Gitea-${VERSION}-linux-amd64
sudo mv /tmp/Gitea /usr/local/bin
After that, change the binary permissions to make it executable:
sudo chmod +x /usr/local/bin/Gitea
And then, restart the Gitea service again:
sudo systemctl restart Gitea
By following this article, you have learned all the basic steps of the installation of Gitea on Ubuntu 20.04. Furthermore, you can refer to official Gitea documentation for more information on advanced configuration and usage guides.
If you have questions, feel free to leave a comment below.
If this guide helped you, please share it.