How to Install Gitea on Rocky Linux 9
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
- Rocky Linux 9 installed
- Full SSH root access.
- Gitea supports the following databases.
- SQLite
- PostgreSQL
- MySQL
- MariaDB
- TiDB
- MSSQL
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.
To Install SQLite using the following command.
dnf install sqlite
To check the version.
[root@server ~]# sqlite3 --version
3.34.1 2021-01-20 14:10:07 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ealt1
Install Git
To Install Git
, use the following command.
dnf install git
To check the version of Git, run the following command.
git --version
Output:
[root@server ~]# git --version
git version 2.31.1
Add the user that will run the Git application.
[root@server ~]# adduser --system --shell /bin/bash --comment 'Git Version Control' --create-home --home /home/git git
Download the Gitea Binary.
Gitea is a painless self-hosted Git service. With features similar to ones in GitHub, Bitbucket, or GitLab.
Download the Gitea binary from download page and make it executable.
At the time of this article, the latest Gitea version is 1.18.3. If there is a the newer version is available on the link above, change the VERSION variable before using the following command.
dnf install wget
wget -O /tmp/gitea https://dl.gitea.com/gitea/1.18.3/gitea-1.18.3-linux-amd64
Output:
[root@vps ~]# wget -O /tmp/gitea https://dl.gitea.com/gitea/1.18.3/gitea-1.18.3-linux-amd64
--2023-02-16 19:24:55-- https://dl.gitea.com/gitea/1.18.3/gitea-1.18.3-linux-amd64
Resolving dl.gitea.com (dl.gitea.com)... 13.225.142.72, 13.225.142.115, 13.225.142.83, ...
Connecting to dl.gitea.com (dl.gitea.com)|13.225.142.72|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 116523304 (111M) [application/octet-stream]
Saving to: ‘/tmp/gitea’
/tmp/gitea 100%[==================================>] 111.12M 77.2MB/s in 1.4s
2023-02-16 19:24:57 (77.2 MB/s) - ‘/tmp/gitea’ saved [116523304/116523304]
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
To give the file permission using the following command.
restorecon -rv /usr/local/bin/gitea
To create a Systemd Unit File.
Download the file to the "/etc/systemd/system/" directory using the following command.
wget https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service -P /etc/systemd/system/
To reload a Gitea service.
systemctl daemon-reload
To enable a Gitea service.
systemctl enable --now gitea
Output:
[root@server ~]# systemctl enable --now gitea
Created symlink /etc/systemd/system/multi-user.target.wants/gitea.service → /etc/systemd/system/gitea.service.
To check the status of the Gitea service.
systemctl status gitea
Output:
[root@server ~]# systemctl status gitea
● gitea.service - Gitea (Git with a cup of tea)
Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2022-07-20 18:25:45 CEST; 23s ago
Main PID: 14699 (gitea)
Tasks: 8 (limit: 11120)
Memory: 127.1M
CPU: 896ms
CGroup: /system.slice/gitea.service
└─14699 /usr/local/bin/gitea web --config /etc/gitea/app.ini
Configure Gitea
To allow port using the following command.
firewall-cmd --permanent --zone=public --add-port=3000/tcp
firewall-cmd --reload
Navigate to your browser. http://yourserver-ip-address:3000 to access the Gitea application.
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
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 and your domain or server IP address.
- Log Path: Leave the default /var/lib/gitea/log
Click on Install to Install Gitea.
Once the installation is completed then create the first user. Open http://yourip:3000/user/sign_up in a web browser and fill in the required details.
Once the form has been submitted, you are logged into your Gitea account.
Done.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS