How to Install Gitea on AlmaLinux 8
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
- AlmaLinux 8 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@vps ~]# sqlite3 --version
3.26.0 2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238alt1
Installing Gitea
Gitea is a painless self-hosted Git service. With features similar to ones in GitHub, Bitbucket, or GitLab.
To Install the Gitea using 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 Gitea application.
[root@server ~]# adduser --system --shell /bin/bash --comment 'Git Version Control' --create-home --home /home/git git
Download the Gitea binary.
Download the Gitea binary from download page and make it executable.
At the time of this article, the latest Gitea version is 1.17.3. If there is a newer version available on the link above, change the VERSION variable before using the following command.
dnf install wget
wget -O /tmp/gitea https://dl.gitea.io/gitea/1.17.3/gitea-1.17.3-linux-amd64
Output:
[root@vps ~]# wget -O /tmp/gitea https://dl.gitea.io/gitea/1.17.3/gitea-1.17.3-linux-amd64
--2022-11-26 22:42:42-- https://dl.gitea.io/gitea/1.17.3/gitea-1.17.3-linux-amd64
Resolving dl.gitea.io (dl.gitea.io)... 143.244.50.209, 2400:52e0:1a01::852:1
Connecting to dl.gitea.io (dl.gitea.io)|143.244.50.209|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 112413616 (107M) [application/octet-stream]
Saving to: ‘/tmp/gitea’
/tmp/gitea 100%[===========================================================>] 107.21M 82.6MB/s in 1.3s
2022-11-26 22:42:43 (82.6 MB/s) - ‘/tmp/gitea’ saved [112413616/112413616]
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@vps:~# 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@vps ~]# 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 Sat 2022-11-26 22:44:46 UTC; 7s ago
Main PID: 9005 (gitea)
Tasks: 9 (limit: 4928)
Memory: 133.4M
CGroup: /system.slice/gitea.service
└─9005 /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