1.安装依赖包

  yum install -y curl policycoreutils-python
  firewall-cmd --permanent --add-service=http
  systemctl reload firewalld

2.安装程序包

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

3.启动

sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
sudo gitlab-ctl status

4.访问页面报错502

在这里插入图片描述

(1)试过加权限,无效

sudo chmod -R 755 /var/log/gitlab
sudo gitlab-ctl reconfigure

(2)改端口,有效

sudo vi /etc/gitlab/gitlab.rb
external_url 'http://x.x.x.x:9999'
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
\\关闭防火墙
sudo systemctl stop firewalld
sudo systemctl disable firewalld
\\或者开放端口
firewall-cmd --zone=public --add-port=9999/tcp(永久生效再加上 --permanent)

5.页面设置root密码

如有问题,可修改root密码

gitlab-rails console production 或 gitlab-rails console -e production
u = User.where(id:1).first
u.password='12345678'​​​​​​​
u.password_confirmation='12345678'
u.save!
exit

6.注册新账号后登录报错:

Your account is pending approval from your GitLab administrator and hence blocked. Please contact your GitLab administrator if you think this is an error.

需要用root账号通过下
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

7.接入ldap

修改配置文件 /etc/gitlab/gitlab.rb

vi /etc/gitlab/gitlab.rb
----------------------------------------------------------------------
gitlab_rails['ldap_enabled'] = true
gitlab_rails['prevent_ldap_sign_in'] = false
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
   main: # 'main' is the GitLab 'provider ID' of this LDAP server
     label: 'LDAP'
     host: 'ip'
     port: 389
     uid: 'cn'
     bind_dn: 'cn=Manager,dc=yt,dc=com'     #管理员dn信息
     password: '123456'     #管理员密码
     encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
     verify_certificates: true
     smartcard_auth: false
     active_directory: true
     allow_username_or_email_login: false
     lowercase_usernames: false
     block_auto_created_users: false
     base: 'ou=People,dc=yt,dc=com' 
     user_filter: ''
     attributes:
       username: ['cn']
       email: ['Email']
       name: ['cn']
     ## EE only
     group_base: ''
     admin_group: ''
     sync_ssh_keys: false
EOS
----------------------------------------------------------------------
# 测试ldap是否成功
gitlab-rake gitlab:ldap:check
sudo gitlab-ctl restart

8.查看代码仓库存放地址

https://blog.csdn.net/qq_37858386/article/details/108980682

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐