Home  >  Article  >  Development Tools  >  How to install and configure gitlab on centos (detailed method)

How to install and configure gitlab on centos (detailed method)

PHPz
PHPzOriginal
2023-04-03 11:53:452505browse

When doing software development, version control is an essential task that helps with team collaboration and code management. GitLab is a popular open source software that is popular due to its user-friendly interface and powerful features. This article will introduce how to install and configure GitLab on CentOS.

1. Environment required to install GitLab
Before installing GitLab, we need to install some necessary software packages:

  1. Use the following command to update the yum software repository:
sudo yum -y update
  1. Install Postfix mail server:
sudo yum -y install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
  1. Install OpenSSL:
sudo yum -y install openssl-devel
  1. Install wget:
sudo yum -y install wget

2. Install and set up GitLab

  1. First, update the server to get the latest versions of all packages:
sudo yum -y update
  1. Add GitLab software repository:
sudo wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh
sudo chmod +x script.rpm.sh
sudo ./script.rpm.sh
  1. Install GitLab:
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee

(Note: Change "https://gitlab.example.com" to your own Domain name)

  1. After the installation is complete, use the following command to start the GitLab service:
sudo systemctl start gitlab-runsvdir.service
  1. Set the GitLab administrator password:
sudo gitlab-ctl reconfigure
sudo gitlab-rake gitlab:setup
  1. After the installation is complete, you can visit https://gitlab.example.com to manage GitLab. When logging in for the first time, you will need to log in using your administrator password.

3. Configure GitLab

  1. Modify the default SSH port number of GitLab to the new port
sudo vim /etc/gitlab/gitlab.rb

In the editor, find the following line and modify to the desired port number:

#gitlab_rails['gitlab_shell_ssh_port'] = 22
gitlab_rails['gitlab_shell_ssh_port'] = 1234

(Note: Change 1234 to the new port number you want to use)

  1. Make the changes effective
sudo gitlab-ctl reconfigure
  1. Open new ports in the firewall (if needed)
sudo firewall-cmd --permanent --zone=public --add-port=1234/tcp
sudo firewall-cmd --reload

IV. Summary

When installing and configuring GitLab, always remember to make sure you install Latest version and configure all settings correctly. By using GitLab correctly, you can increase your team's productivity and make it easier to manage and track version control of your code.

The above is the detailed content of How to install and configure gitlab on centos (detailed method). 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