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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章