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

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

PHPz
Release: 2023-04-03 13:41:14
Original
2556 people have browsed it

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
Copy after login
Copy after login
  1. Install Postfix mail server:
sudo yum -y install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
Copy after login
  1. Install OpenSSL:
sudo yum -y install openssl-devel
Copy after login
  1. Install wget:
sudo yum -y install wget
Copy after login

2. Install and set up GitLab

  1. First, update the server to get the latest versions of all packages:
sudo yum -y update
Copy after login
Copy after login
  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
Copy after login
  1. Install GitLab:
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee
Copy after login

(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
Copy after login
  1. Set the GitLab administrator password:
sudo gitlab-ctl reconfigure
sudo gitlab-rake gitlab:setup
Copy after login
  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
Copy after login

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
Copy after login

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

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

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template