Home > Development Tools > git > Detailed explanation of CentOS GitLab installation and configuration tutorial

Detailed explanation of CentOS GitLab installation and configuration tutorial

PHPz
Release: 2023-03-31 13:48:02
Original
794 people have browsed it

CentOS GitLab Installation and Configuration Tutorial

GitLab is an open source Git warehouse management system that supports multi-person collaborative development, code warehouse management and version control. GitLab comes with a variety of features, such as code hosting, CI/CD, issue tracking, and more. This tutorial explains how to install and configure GitLab Server on CentOS.

1. CentOS system environment preparation

  1. Installation dependencies: GitLab requires PostgreSQL and Redis database support, we need to install them:
# 安装 PostgreSQL 和 Redis 
sudo yum install -y postgresql-server postgresql-contrib redis
Copy after login
  1. Start the PostgreSQL and Redis services:
sudo systemctl start postgresql 
sudo systemctl start redis
Copy after login
  1. Configure the PostgreSQL database: GitLab needs a database to store data, we need to create a GitLab database in PostgreSQL:
sudo -i -u postgres 
psql
Copy after login
postgres=# CREATE USER git CREATEDB;
postgres=# CREATE DATABASE gitlabhq_production OWNER git;
postgres=# ALTER USER git WITH ENCRYPTED password 'password';
postgres=# \q
exit
Copy after login

2. Install GitLab

  1. Install GitLab:
# 添加 GitLab 源
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash 
sudo yum install -y gitlab-ee
Copy after login
  1. Modify GitLab configuration file:
sudo vim /etc/gitlab/gitlab.rb
Copy after login
  1. Modify as follows:
## 配置 GitLab 的外部 URL
external_url 'http://{YOUR_SERVER_NAME_OR_IP}'

## 配置SMTP
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "your-email@qq.com" # 发送人邮箱
gitlab_rails['smtp_password'] = "your-password" # 发送人 QQ 邮箱授权码
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = 'your-email@qq.com' # 发件人邮箱

# 配置 Nginx
nginx['enable'] = false

#################
# OAUTH2 CONFIGS #
#################
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = true
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_auto_link_ldap_user'] = false
gitlab_rails['ldap_enabled'] = false

# 支持中文
gitlab_workhorse['env'] = {
"LANG" => "zh_CN.UTF-8",
"LC_ALL" => "zh_CN.UTF-8"
}
Copy after login
  1. Make the changes effective:
sudo gitlab-ctl reconfigure
Copy after login

3. Visit GitLab

  1. Visit the following URL:
http://{YOUR_SERVER_NAME_OR_IP}
Copy after login
  1. Use default administrator access:
用户名: root
密码: 5iveL!fe
Copy after login

4. Solving common problems

  1. How to start, stop or reconfigure GitLab?
# 启动
sudo gitlab-ctl start

# 停止
sudo gitlab-ctl stop

# 更改
sudo gitlab-ctl reconfigure
Copy after login
  1. How to upgrade GitLab server?
## 1. 升级软件源
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash 

## 2. 安装新版
sudo yum install -y gitlab-ee

## 3. 在更新配置文件和升级后重新配置
sudo gitlab-ctl reconfigure
Copy after login

5. Summary

This article introduces the steps to install and configure GitLab server in CentOS system. I hope this article can help developers manage and version control Git repositories on their own servers.

The above is the detailed content of Detailed explanation of CentOS GitLab installation and configuration tutorial. 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