The cart is empty

In today's digital age, version control management is essential for efficient software development. Git, one of the most widely used version control systems, allows developers to track changes in code and collaborate with others. To facilitate the management of Git repositories on the server side, platforms like Gogs and Gitea exist. This article will provide a detailed guide to configuring and managing a Git server using Gogs or Gitea on the CentOS operating system.

Installation and Initial Setup of CentOS

Before getting started, it is essential to have a fully updated CentOS system. By running the following commands in the terminal, you can ensure that your system is up to date:

sudo yum update -y
sudo yum upgrade -y

It is also important to have Git installed. If Git is not yet installed, you can install it using the command:

sudo yum install git -y

Choosing Between Gogs and Gitea

Gogs and Gitea are both lightweight Git servers that are easily configurable and suitable for small to medium-sized teams. Gogs is known for its minimal resource requirements, while Gitea is often perceived as a faster-evolving alternative with richer features.

  • Gogs is ideal for smaller teams or individual projects where easy installation and minimal resource requirements are important.
  • Gitea is more suitable for teams requiring more advanced features and a faster development cycle.

Installing Gogs/Gitea

1. Installing Gogs:

To install Gogs, visit the project's official website and download the latest version for CentOS. You can then install Gogs using the RPM package:

wget https://dl.gogs.io/0.11.91/gogs_0.11.91_linux_amd64.rpm
sudo rpm -i gogs_0.11.91_linux_amd64.rpm

2. Installing Gitea:

Similar to Gogs, visit the official Gitea website and download the latest version. You can install Gitea using the command:

wget -O gitea https://dl.gitea.io/gitea/1.12.3/gitea-1.12.3-linux-amd64
chmod +x gitea
sudo mv gitea /usr/local/bin

Setting Up the Web Server

Both Gogs and Gitea can run either with their own web server or behind a reverse Proxy server such as Nginx or Apache for better performance and security.

Configuring Firewall and SELinux

For the Git server to function correctly, it is necessary to open the required ports in the firewall and configure SELinux if it is active. To open port 3000 (the default port for Gogs and Gitea), use:

sudo firewall-cmd --permanent --add-port=3000/tcp
sudo firewall-cmd --reload

If you are using SELinux, you may need to set up appropriate rules to allow network access and ensure the application functions correctly. This may include creating new rules or temporarily disabling SELinux for testing:

sudo setenforce 0

Basic Configuration of Gogs/Gitea

After installing Gogs or Gitea, access the web interface to complete the basic configuration. This typically involves setting up the database (Gogs and Gitea support SQLite, MySQL, PostgreSQL, and others), configuring the repository path, and setting up the administrator account.

Management and Maintenance

To ensure the security and reliability of your Git server, it is important to regularly update Gogs or Gitea to the latest version. It is also recommended to regularly back up data, including databases and repositories.

Security

  • HTTPS: It is strongly recommended to use HTTPS to secure communication between clients and the server. This can be achieved using Let's Encrypt certificates or custom SSL/TLS certificates.
  • Authentication: Gogs and Gitea support various authentication methods, including OAuth2, LDAP, and SMTP. Thoroughly configuring these options can significantly enhance the security of your server.
  • Firewall and SELinux: As mentioned earlier, proper firewall and SELinux configuration are crucial for protecting your system.

 

After completing the installation and basic configuration, your Git server with Gogs or Gitea is ready for use. Keep in mind that regular maintenance and updates are necessary to ensure the security and reliability of the platform.

By implementing the above steps, you can create a robust and efficient solution for managing Git repositories that will serve your team and improve your development workflow.