GitLab 接入 LDAP 账号管理系统

CentOS 7.5 搭建LDAP账号管理系统介绍了如何在CentOS上搭建LDAP账号管理系统,本文介绍如何将LDAP与GitLab集成,GitLab集成LDAP的前提是私有化部署GitLab,因此本文先介绍如何私有化部署GitLab,再介绍GitLab集成LDAP。

私有化部署GitLab

私有化部署GitLab分 8 步,本案例使用操作系统是CentOS 7.5。

  1. 安装GitLab的依赖项
vbscript 复制代码
yum -y install policycoreutils openssh-server openssh-clients
  1. 启动ssh服务并将其设置为开机启动
bash 复制代码
systemctl enable sshd
systemctl start sshd
  1. 安装postfix,将其设置为开启启动,立即启动,让它支持gitlab发信功能
swift 复制代码
yum install postfix
systemctl enable postfix
systemctl start postfix
  1. 配置极狐GitLab 软件源镜像
ruby 复制代码
curl -fsSL https://packages.gitlab.cn/repository/raw/scripts/setup.sh | /bin/bash
  1. 安装GitLab

    yum install -y gitlab-jh

上述命令安装的是极狐GitLab,它是GitLab将其技术授权给了一家名为极狐的新独立中国公司开发出的软件包。

  1. 为GitLab实例配置URL
bash 复制代码
vim /etc/gitlab/gitlab.rb

修改上述文件中external_url配置项的值,将其改为你的URL,例如 http://120.151.198.131:81/

  1. 重载配置及启动

    gitlab-ctl reconfigure

当命令行出现 gitlab Reconfigure,便意味着 GitLab 配置重载成功。

  1. 访问私有化部署的 GitLab。在浏览器访问 http://120.151.198.131:81,如果一切顺利将得到如下图所示的内容:

上图所需的临时密码存储在 /etc/gitlab/initial_root_password 文件中。出于安全考虑,24小时后,此文件会被第一次 gitlab-ctl reconfigure 自动删除,因此若使用随机密码登录,建议安装成功初始登录成功之后,立即修改初始密码。

GitLab 集成 LDAP

搭建好 LDAP 账号管理系统且部署好 GitLab,接下来 GitLab 集成 LDAP,只需要2步。

  1. 修改 GitLab 的配置文件 /etc/gitlab/gitlab.rb
csharp 复制代码
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
	main:
         label: 'LDAP'
         host: '127.0.0.1' // 由于GitLab和LDAP部署到同一台服务器的
         port: 389
         uid: 'uid'
	  encryption: 'plain'
	  base: 'dc=ldap,dc=heyudesign,dc=cn'
        verify_certificates: true
EOS
  1. 重新配置极狐GitLab

    gitlab-ctl reconfigure

访问私有化部署的GitLab,将如下图所示的内容

推荐阅读

  1. CentOS 7.5 搭建 LDAP 账号管理系统
  2. 安装私有化部署版极狐GitLab
  3. 通用 LDAP 设置
相关推荐
Cchaofan1 小时前
Git/GitLab日常使用的命令指南来了!
git·gitlab
可乐加.糖7 小时前
项目版本管理和Git分支管理方案
java·git·目标跟踪·gitlab·敏捷流程·源代码管理
xiaobin8899911 小时前
【2025最新版】VMware虚拟机下载安装教程 保姆级图文详解(附安装包+常用镜像Linux,win11,ubuntu,centos)
linux·其他·ubuntu·centos
Fireworkitte15 小时前
CentOS 和 RHEL
linux·centos
Waitccy16 小时前
Tomcat 配置 HTTPS 访问全攻略(CentOS 环境)
https·centos·tomcat·安全整改
孤的心了不冷16 小时前
【Docker】CentOS 8.2 安装Docker教程
linux·运维·docker·容器·eureka·centos
GoodStudyAndDayDayUp17 小时前
gitlab+portainer 实现Ruoyi Vue后端CI/CD
vue.js·ci/cd·gitlab
伊成1 天前
gitlab提交测试分支的命令和流程
gitlab
山师第一深情1 天前
ssh connect to remote gitlab without authority
服务器·ssh·gitlab
默心1 天前
centos7部署mysql5.7
linux·运维·mysql·centos