1

gitlab 搭建

安装CentOS 7

用U盘安装 CentOS 7

CentOS 7 跟以前的版本有些不同,使用老毛桃,软碟通或者其他的启动U盘制作工具制作的镜像无法启动,需要使用Fedora Media Writer 制作安装镜像

https://wiki.centos.org/zh/Ho...

安装gitlab

按照官方的安装方法通过增加yum.repo源来安装
https://about.gitlab.com/inst...

yum.repo 地址

也可以手工增加repo地址 /etc/yum.repo.d/gitlab-ce.repo

https://packages.gitlab.com/i...

[gitlab_gitlab-ce]
name=gitlab_gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[gitlab_gitlab-ce-source]
name=gitlab_gitlab-ce-source
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

使用ldap登录

在企业里面一般使用ldap来管理内部用户,使用ldap用户登录就可以不用注册了,一套用户登录所有系统。

配置文件

/etc/gitlab/gitlab.rb

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: '_your_ldap_server'
    port: 3268
    uid: 'sAMAccountName'
    method: 'plain' # "tls" or "ssl" or "plain"
    bind_dn: '_the_full_dn_of_the_user_you_will_bind_with '
    password: '_the_password_of_the_bind_user '
    active_directory: true
    allow_username_or_email_login: false
    block_auto_created_users: false
    base: ''
    user_filter: ''
    attributes:
      username: ['sAMAccountName']
      email:    ['mail']
      name:       'cn'
      first_name: 'givenName'
      last_name:  'sn'
EOS

/var/opt/gitlab/gitlab-rails/etc/gitlab.yml

ldap:
    enabled: true
    sync_time:
    host: _your_ldap_server
    port: 3268
    uid: sAMAccountName
    method:  plain # "tls" or "ssl" or "plain"
    bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
    password: '_the_password_of_the_bind_user'
    active_directory: true
    allow_username_or_email_login: false
    base: ''
    user_filter:

测试配置文件

sudo gitlab-rake gitlab:ldap:check

参考

https://docs.gitlab.com/ee/ad...

gitlab 服务

查看服务状态和重启服务

sudo gitlab-ctl status
sudo gitlab-ctl restart

openmartin
71 声望3 粉丝

古典占星 。师从台湾杨国正老师。|| 占星看盘请私信。|| 伟大的灵魂都是雌雄同体 || 开放心态,契约精神