How to Install Gitea on Fedora CoreOS Latest?
Gitea is a self-hosted Git service which is written in Go language. It is similar to Gitlab or Github. In this tutorial, we will discuss how to install Gitea on Fedora CoreOS latest.
Prerequisites
Before proceeding with the installation, ensure that you have the following requirements:
- A running instance of Fedora CoreOS
- A root or sudo-access user
Step 1: Update the System
First, update the system by running the following commands:
sudo dnf upgrade -y
sudo reboot
The reboot command will restart the system after the updates have been applied.
Step 2: Install Gitea
To install Gitea, navigate to the temporary directory:
cd /tmp
Download the latest version of Gitea using the following command:
wget https://dl.gitea.io/gitea/1.14.4/gitea-1.14.4-linux-amd64
Rename the downloaded binary to gitea and make it executable:
mv gitea-1.14.4-linux-amd64 gitea
sudo chmod +x gitea
Move the Gitea binary to /usr/local/bin:
sudo mv gitea /usr/local/bin/
Step 3: Create a Systemd Service
Create a new systemd service for Gitea by creating a new file called gitea.service in the /etc/systemd/system/ directory:
sudo nano /etc/systemd/system/gitea.service
Paste the following content into the file:
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
After=postgresql.service
[Service]
RestartSec=2s
Type=simple
User=gitea
Group=gitea
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web
Restart=always
Environment=USER=gitea HOME=/var/lib/gitea
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
Save and close the file.
Step 4: Create a Gitea User and Group
Create a new user and group for Gitea by running the following commands:
sudo useradd -r -s /bin/false gitea
sudo groupadd git
sudo useradd -r -g git gitea
Step 5: Create Directories for Gitea
Create the required directories for Gitea by running the following commands:
sudo mkdir -p /var/lib/gitea/
sudo chown -R gitea.git /var/lib/gitea/
sudo chmod -R 770 /var/lib/gitea/
Step 6: Start and Enable the Gitea Service
Start and enable the Gitea service by running the following commands:
sudo systemctl start gitea.service
sudo systemctl enable gitea.service
You can verify the status of the Gitea service by running the following command:
sudo systemctl status gitea.service
Step 7: Configure Firewall
Gitea listens on port 3000 by default. Allow incoming traffic to this port by running the following command:
sudo firewall-cmd --add-port=3000/tcp --permanent
sudo firewall-cmd --reload
Step 8: Test Gitea
Open your web browser and navigate to http://<your-server-ip>:3000/, where <your-server-ip> is the IP address of your Fedora CoreOS instance. You should see the Gitea login page.
Enter the username and password of the Gitea administrator account and click the "Sign In" button. You will be redirected to the Gitea dashboard. Congratulations! You have successfully installed and configured Gitea on your Fedora CoreOS instance.
Conclusion
In this tutorial, we have discussed how to install Gitea on Fedora CoreOS latest. Gitea is now installed as a systemd service and can be started, stopped, and managed like any other service using the systemctl command.