CentOS7 + Gitlab

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值