Home  >  Article  >  Development Tools  >  How to set up GitLab server on CentOS

How to set up GitLab server on CentOS

PHPz
PHPzOriginal
2023-03-31 10:40:251187browse

GitLab is an open source web-based Git repository management application that helps teams better write, manage and collaborate on code. This article will introduce how to set up a GitLab server on CentOS to facilitate team collaboration and development.

Step 1: Install dependencies

Before starting to install GitLab, we need to install some dependent software:

sudo yum install curl policycoreutils-python openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

Step 2: Install GitLab

Installation Before GitLab, we need to add the source of the GitLab package. By default, there are no GitLab packages in CentOS repositories. Therefore, we need to manually add the source to CentOS, as shown below:

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

When adding the source is completed, we need to update the system and install GitLab, execute the following command:

sudo yum install gitlab-ce

This At this time, GitLab is installed under /opt/gitlab/ of the system, and the configuration file is in /etc/gitlab/.

Step 3: Configure GitLab

After installing GitLab, we need to configure it and make relevant settings in the GitLab configuration file. We can do this by editing the following file:

sudo vim /etc/gitlab/gitlab.rb

In this file, we can configure various options for GitLab, such as SMTP for email, backup paths, and more. In some special cases, such as custom domains, further modifications to the configuration file are required. After the settings are completed, execute the following command to make the changes take effect.

sudo gitlab-ctl reconfigure

The GitLab configuration process ends here, and we can start testing whether the GitLab server can be accessed normally.

Step 4: Log in to GitLab

After we complete the previous settings, we can view the GitLab web interface by accessing the following address.

http://<GitLab服务器IP-address>

After accessing the address, you will jump to the login page. Before logging in for the first time, you need to set a default administrator password.

Summary

Through the above steps, we successfully set up the GitLab server on CentOS. After the configuration is successful, you can collaborate with your team members on development. During this process, it should be noted that the effectiveness of the GitLab server always comes from security, and we should reasonably plan and manage accounts, permissions, etc.

The above is the detailed content of How to set up GitLab server on CentOS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn