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
# 安装 PostgreSQL 和 Redis sudo yum install -y postgresql-server postgresql-contrib redis
sudo systemctl start postgresql sudo systemctl start redis
sudo -i -u postgres psql
postgres=# CREATE USER git CREATEDB; postgres=# CREATE DATABASE gitlabhq_production OWNER git; postgres=# ALTER USER git WITH ENCRYPTED password 'password'; postgres=# \q exit
2. Install GitLab
# 添加 GitLab 源 curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash sudo yum install -y gitlab-ee
sudo vim /etc/gitlab/gitlab.rb
## 配置 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" }
sudo gitlab-ctl reconfigure
3. Visit GitLab
http://{YOUR_SERVER_NAME_OR_IP}
用户名: root 密码: 5iveL!fe
4. Solving common problems
# 启动 sudo gitlab-ctl start # 停止 sudo gitlab-ctl stop # 更改 sudo gitlab-ctl reconfigure
## 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
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!