Gitea is a powerful open-source forge software package that allows you to host software development version control using Git. It also provides various collaborative features such as bug tracking, wikis, and code review. In this guide, we will walk you through the step-by-step process of installing Gitea on AlmaLinux 8.
Prerequisites
Before we dive into the installation process, make sure you have the following prerequisites:
- AlmaLinux 8 installed on your system
- Full SSH root access to your server
Gitea supports multiple databases, including SQLite, PostgreSQL, MySQL, MariaDB, TiDB, and MSSQL. In this guide, we will be using SQLite as the database for Gitea. However, you can choose any of the supported databases based on your requirements.
To install SQLite, use the following command:
dnf install sqlite
You can verify the installation by checking the version:
sqlite3 --version
The output should display the installed version of SQLite.
Installing Gitea
Gitea is a painless self-hosted Git service that offers features similar to popular platforms like GitHub, Bitbucket, or GitLab. To install Gitea on your AlmaLinux 8 system, follow the steps below:
Step 1: Install Git
Before installing Gitea, you need to ensure that Git is installed on your system. If Git is not already installed, use the following command:
dnf install git
To check the version of Git, run the following command:
git --version
The output should display the installed version of Git.
Step 2: Add a User for Gitea
Next, you need to create a user that will run the Gitea application. Use the following command to add a system user:
adduser --system --shell /bin/bash --comment 'Git Version Control' --create-home --home/home/git git
This command will create a system user named “git” with the necessary permissions.
Step 3: Download the Gitea Binary
To download the Gitea binary, visit the Gitea download page and obtain the latest version. At the time of writing this article, the latest version is 1.17.3. You can use the following command to download the binary:
wget -O /tmp/gitea https://dl.gitea.io/gitea/1.17.3/gitea-1.17.3-linux-amd64
Make sure to replace the URL with the link to the latest version if it has changed. Once the download is complete, move the binary to the “/usr/local/bin” directory and make it executable:
mv /tmp/gitea /usr/local/bin/gitea chmod +x /usr/local/bin/gitea
Step 4: Set up Directory Structure and Permissions
Now, you need to create the necessary directory structure for Gitea and set the required permissions and ownership. Use the following commands:
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
These commands will create the required directories and set the appropriate ownership and permissions.
Step 5: Configure Gitea
To configure Gitea, you need 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/
Once the file is downloaded, reload the Systemd daemon:
systemctl daemon-reload
You can now enable and start the Gitea service using the following command:
systemctl enable --now gitea
To check the status of the Gitea service, use the following command:
systemctl status gitea
If everything is set up correctly, the output should indicate that the Gitea service is active and running.
Step 6: Configure Firewall
To allow access to Gitea, you need to configure your firewall to allow incoming connections to port 3000. Use the following commands:
firewall-cmd --permanent --zone=public --add-port=3000/tcp firewall-cmd --reload
These commands will open port 3000 for incoming traffic.
Step 7: Access Gitea
You can now access Gitea by navigating to the following URL in your web browser:
http://yourserver-ip-address:3000
Replace “yourserver-ip-address” with the actual IP address of your server. This will take you to the Gitea application.
Follow the on-screen instructions to complete the Gitea setup. You will be prompted to provide various settings, including the database type, site title, repository root path, SSH server domain, and more.
Once the installation is complete, you can create the first user by visiting the following URL in your web browser:
http://yourip:3000/user/sign_up
Fill in the required details and submit the form to create your Gitea account.
Congratulations! You have successfully installed Gitea on AlmaLinux 8. You can now start leveraging its powerful features for your software development projects.
Conclusion
Gitea is a versatile and user-friendly open-source Git service that provides seamless version control and collaboration features. By following the steps outlined in this guide, you can easily install Gitea on your AlmaLinux 8 system and begin managing your software development projects effectively.
Remember to regularly update your Gitea installation to benefit from the latest features and security enhancements. If you encounter any issues during the installation process, refer to the official Gitea documentation or seek assistance from the vibrant Gitea community.
Shape.host offers reliable and scalable Linux SSD VPS hosting solutions for businesses of all sizes. With our robust infrastructure and exceptional support, we ensure your Gitea installation runs smoothly and securely. Visit us at Shape.host to explore our hosting services and take your software development to new heights.