In this article, we will have explained the necessary steps to install Gitea on Ubuntu 22.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo
privileges. All the commands in this tutorial should be run as a non-root user.
Gitea is a simplistic, open-source self-hosted Git cross-platform that is recognized as a community-driven model. It is very similar to GitHub and GitLab and offers a rich set of features such as a repository file editor, project issue tracking, user management, notifications, a built-in wiki, and much more.
Prerequisite:
- Operating System with Ubuntu 22.04
- Server IPv4 Address with Superuser Privileges (Root Access)
- Gnome Terminal for Linux Desktop
- PuTTy SSH client for Windows or macOS
- Powershell for Windows 10/11
- Familiar with APT Commands
Install Gitea on Ubuntu 22.04 LTS
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade sudo apt install software-properties-common apt-transport-https wget
Step 2. Install Git.
Installing the Git package by running the following command below:
sudo apt install git
You can check the version of Git installed with the following command:
git --version
Next, create a Git user:
sudo adduser \ --system \ --shell /bin/bash \ --gecos 'Git Version Control' \ --group \ --disabled-password \ --home /home/git \ git
Step 3. Install SQLite.
To Install SQLite using the following command:
sudo apt install sqlite3
You can check the version of SQLite installed with the following command:
sqlite3 --version
Step 4. Install Gitea on Ubuntu Linux.
Go to the Gitea Download page and download the latest binary for your architecture:
wget -O /tmp/gitea https://dl.gitea.io/gitea/1.17.1/gitea-1.17.1-linux-amd64
Move the Gitea binary file to ‘/usr/local/bin
‘:
mv /tmp/gitea /usr/local/bin chmod +x /usr/local/bin/gitea
Next, create the directory structure and set the required permissions and ownership:
mkdir -p /var/lib/gitea/{custom,data,indexers,public,log} chown git: /var/lib/gitea/{data,indexers,log} chmod 750 /var/lib/gitea/{data,indexers,log} mkdir /etc/gitea chown root:git /etc/gitea chmod 770 /etc/gitea
Step 5. Create Gitea Systemd Service File.
Create a systemd
service file to manage the Gitea service with systemd
. You can create it with the following command:
wget https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/systemd/gitea.service -P /etc/systemd/system/
Then, reload the systemd
daemon and start the Gitea service with the following command:
sudo systemctl daemon-reload sudo systemctl enable --now gitea
Step 6. Configure UWF Firewall.
If you’re running ufw firewall on your server, allow the port 3000:
sudo ufw allow 3000/tcp
Step 7. Access Gitea Web UI.
Open your browser, type http://your-ip-server:3000
, and a screen similar to the following will appear:
Application General Settings:
- Site Title: Enter username.
- Repository Root Path: keep the default
/home/git/gitea-repositories
. - Git LFS Root Path: keep the default
/var/lib/gitea/data/lfs
. - Run As Username:
git
- SSH Server Domain: Enter your domain name or your IP address.
- SSH Port: 22, change it if SSH is listening on other Port
- Gitea HTTP Listen Port:
3000
- Gitea Base URL: Use HTTP with your domain name or server IP address.
- Log Path: Leave the default
/var/lib/gitea/log
That’s all you need to do to install Gitea on Ubuntu 22.04 LTS Jammy Jellyfish. I hope you find this quick tip helpful. For further reading on the installation of Gitea, please refer to their official knowledge base. I hope this article was helpful to you. If you find it useful, don’t forget to share it with your friend and family. Also, if you have any questions, please feel free to ask in the comments section. We are always there to assist you.