gitlab汉化及关联LDAP

gitlab汉化及关联LDAP

Ø  环境说明

公司新增AI部门,要为前端项目搭建gitlab平台,但是公司的jiraconfluence等公共服务都是用LDAP来同一认证进行登录的,由于gitlab社区版本安装后是英文版,使用不是很方便,在汉化上,百度了好多办法最后终于解决了

Ø  服务器环境

系统版本

cat /etc/redhat-release

CentOS Linux release 7.4.1708 (Core)

关闭防火墙

systemctl status firewalld

firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)

   Active: inactive (dead)

     Docs: man:firewalld(1)

关闭selinux

getenforce

Disabled

第1章 安装gitlab-ce

上传rpm包然后进行安装,三条命令即可

yum localinstall gitlab-ce-9.1.4-ce.0.el7.x86_64.rpm

gitlab-ctl reconfigure

gitlab-ctl status

第2章 gitlab汉化

Ø  说明 : gitlab  9.X版本使用此方法均可

下载汉化包,本地网络如果不是太好的话,有云主机可以在云主机上下载能快一点,我这里是下载不了,最后在云服务器上下好,拉到本地,下面是下载地址

git clone https://gitlab.com/xhang/gitlab.git

如果已经克隆过,则进行更新

git fetch

查看已经安装的gitlab版本

cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

9.1.4

进入到汉化包目录

cd gitlab

生成patch用的diff文件

git diff v9.1.4 v9.1.4-zh > ../9.1.4-zh.diff

安装patch命令

yum install patch

使用patch命令将文件导入

patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /root/9.1.4-zh.diff

重新加载配置

gitlab-ctl reconfigure

image.png

汉化后的页面

第1章 关联LDAP

152行后加入以下关联的数据

vim /etc/gitlab/gitlab.rb +152

gitlab_rails['ldap_enabled'] = true

###! **remember to close this block with 'EOS' below**

gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'

   main: # 'main' is the GitLab 'provider ID' of this LDAP server

     label: 'LDAP'

     host: '192.168.3.67'

     port: 389

     uid: 'uid'

     method: 'plain' # "tls" or "ssl" or "plain"

     bind_dn: 'cn=root,dc=hello,dc=cn'

     password: '2018'

     active_directory: true

     allow_username_or_email_login: false

     block_auto_created_users: false

     base: 'dc=hello,dc=cn'

     user_filter: ''

     attributes:

       username: ['uid', 'userid', 'sAMAccountName']

       email:    ['mail', 'email', 'userPrincipalName']

       name:       'cn'

       first_name: 'givenName'

       last_name:  'sn'

EOS

重新加载配置

gitlab-ctl reconfigure

登录页面已经增加了LDAP登录选项

image.png


猜你喜欢

转载自blog.51cto.com/13520772/2133739
今日推荐