1 Answer

answered by
Gitea is an open-source forge software package for hosting software development version control using Git as well as other collaborative features like bug tracking, wikis, and code review.

Prerequisites

Full SSH root access or a user with Sudo privileges is required.

Gitea supports the following databases.

SQLite

PostgreSQL

MySQL

MariaDB

In our guide below, we’ll use SQLite as the database for Gitea. You can pick any of the supported databases in your installation as needed.

Install SQLite use the following command,

apt install sqlite3

To check the version,

sqlite3 --version

Output:

root@vps:~# sqlite3 --version

3.45.1 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257ccalt1 (64-bit)

Install Git

Gitea is a painless self-hosted Git service. With features similar to ones in GitHub, Bitbucket, or GitLab. Git is the standard for distributed version control systems and can be installed on Ubuntu systems using apt.

Check for system updates and install them.

apt update

apt upgrade

Install the Git package using the following command,

apt install git

You can check the version of Git installed with the following command,

git --version

Output:

root@vps:~# git --version

git version 2.43.0

Create a Git user,

We're going to create a Git user with username as git with limited privileges.

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

Download the Gitea binary

Download the Gitea binary from download page and make it executable.

wget -O /tmp/gitea https://dl.gitea.com/gitea/1.22/gitea-1.22-linux-amd64

Move the Gitea binary file to '/usr/local/bin'.

mv /tmp/gitea /usr/local/bin

Make the binary executable.

chmod +x /usr/local/bin/gitea

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

Create a Systemd Unit File, which we can use to run the gitea in background and control with systemctl.

Download the file to the "/etc/systemd/system/" directory using the following command.

wget https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/systemd/gitea.service -P /etc/systemd/system/  

Reload and enable the Gitea service,

systemctl daemon-reload

systemctl start gitea

systemctl enable gitea

Check the status of the Gitea service,

systemctl status gitea

Configure Gitea

If you're running ufw firewall on your server, allow the port 3000

ufw allow 3000/tcp

Navigate to your browser. http://yourserver-ip-address:3000 to access the Gitea dashboard.

Follow the on-screen instructions to complete the Gitea setup. Click on Register to start the database initialization.

Database Settings:

Database Type: SQLite3

Path: Use an absolute path, /var/lib/gitea/data/gitea.db

image

Application General Settings:

Site Title: Enter your preferred site name here.

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 (the git user that was created earlier on).

Server Domain: Enter your domain name or the IP address of the server.

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 (example: http://example.com:3000 or http://192.168.0.2:3000).

Log Path: Leave it as default /var/lib/gitea/log

Replace localhost with either your server's IP address or with your domain name.

Do not leave it with localhost.

image image

Optional Settings:

Create a Administrator user account.

image

Click on Install button to Install and Configure Gitea.

Once the installation completes, you will be logged in as the Administrator and navigated to dashboard.

image

Now, you can create your first Gitea Repository with a cup of tea.

Upgrading Gitea

Below steps will show you how to upgrade to a newer version of Gitea when it is available.

To upgrade to a new version, first, stop the Gitea service.

Stop the Gitea service.

systemctl stop gitea

Download the Gitea binary from download page.

At the time of writing this article, the latest Gitea version is 1.22.

If there is a newer version available on the link above, change the VERSION variable before using the following command.

VERSION=<THE_LATEST_GITEA_VERSION>

wget -O /tmp/gitea https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-amd64

Move the Gitea binary file to /usr/local/bin and make the binary executable.

mv /tmp/gitea /usr/local/bin

chmod +x /usr/local/bin/gitea

To restart the Gitea service,

systemctl restart gitea

This concludes the topic of installing Gitea also also upgrading when newer version is available.

Most popular tags

laravel postgresql laravel-10 replication ha postgresql mongodb laravel-11 mongodb database mongodb tutorial ubuntu 24.04 lts streaming-replication mysql database laravel postgresql backup laravel login register logout database mysql php laravel 11 - login with otp valid for 10 minutes. user and admin registration user and admin login multiauth technlogy asp.net asp.net c# mysql master slave replication centos linux laravel sql server schedule backup autobackup postgresql django python haproxy load balancer install self sign ssl laravel 11 gaurds zabbix 7 how to install graylog on ubuntu 24.04 lts | step-by-step asp.net core mvc .net mvc network upload c# ssl integration sql server on ubuntu 22.04 lts mssql server ms sql server sql server user access in postgres mysql password change cent os linux configure replica laravel 11 socialite login with google account google login kubernetes (k8s) install nginx load balancer install install and configure .net 8.0 in ubuntu 24.04 lts php in iis php with iis php tutorial chirags php tutorials chirags php tutorial chirags tutorial laravel 11 guards mongodb sharding metabase business analytics metabase postgresql 16 to postgresql 17 postgresql migration letsencrypt mongodb crud rocky linux laravel custom captcha laravel 11 captcha laravel captcha mongo dll php.ini debian 12 nginx apache nextcloud gitea in ubuntu git gitea npm error node js mysql ndb cluster mysql cluster ssl oracle login register logout in python debian windows shell batch file bat file time stamp date time shopping cart in laravel centos rhel swap memeory rhel 5.5
...