How to Install Gitea on Fedora Server Latest
In this tutorial, we will show you how to install Gitea on Fedora Server. Gitea is an open-source Git service similar to GitHub, Bitbucket, and GitLab. It is written in Golang, lightweight, and easy to use.
Prerequisites
- A running Fedora Server latest version.
- A user with sudo access.
Step 1: Install Necessary Packages
First, update the system packages and install necessary packages:
sudo dnf update
sudo dnf install git wget tar
Step 2: Install Database
Gitea requires a database, and in this tutorial, we will be using MariaDB.
Install MariaDB server and client:
sudo dnf install mariadb mariadb-server
Enable MariaDB service at boot time:
sudo systemctl enable mariadb
Start MariaDB service:
sudo systemctl start mariadb
Secure MariaDB installation with the following command:
sudo mysql_secure_installation
The script will prompt you for several questions, including setting the root password and removing anonymous user accounts.
Step 3: Install Gitea
Download the latest version of the Gitea package from the official website:
cd /tmp
wget https://dl.gitea.io/gitea/1.15.3/gitea-1.15.3-linux-amd64.tar.gz
tar xvfz gitea-1.15.3-linux-amd64.tar.gz
sudo mkdir /opt/gitea
sudo mv gitea-1.15.3-linux-amd64/* /opt/gitea/
Create a new system user and group for Gitea:
sudo useradd --system --shell /usr/sbin/nologin --comment "Git Version Control" --user-group git
sudo chown -R git:git /opt/gitea
Step 4: Configure Gitea
Create a new configuration file for Gitea:
sudo mkdir /etc/gitea
sudo nano /etc/gitea/app.ini
Add the following lines to the configuration file:
[server]
ROOT_URL = https://localhost:3000/
HTTP_PORT = 3000
RUN_MODE = prod
[database]
DB_TYPE = mysql
HOST = 127.0.0.1:3306
NAME = gitea
USER = gitea
PASSWD = *password*
SSL_MODE = disable
[repository]
ROOT = /home/git/gitea-repositories
Replace the password with the password you set during the previous MariaDB setup.
Step 5: Create a Systemd Service
Create a systemd service file:
sudo nano /etc/systemd/system/gitea.service
Copy and paste:
[Unit]
Description=Gitea (Git with a cup of tea)
After=network.target
After=mariadb.service
Requires=mariadb.service
[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/opt/gitea/
ExecStart=/opt/gitea/gitea web
Restart=always
Environment=USER=git HOME=/home/git
[Install]
WantedBy=multi-user.target
Save and close the file.
Reload systemd daemon and enable the Gitea service:
sudo systemctl daemon-reload
sudo systemctl enable gitea
Start the Gitea service:
sudo systemctl start gitea
Step 6: Configure Firewall
If you have a firewall running, you need to allow HTTP and HTTPS traffic:
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
sudo firewall-cmd --reload
Step 7: Access Gitea
Open your web browser and go to https://
You should see the Gitea login page.
Conclusion
Congratulations! You have successfully installed and configured Gitea on your Fedora server. Now you can start working with Gitea and manage your Git repositories.