GitLab構築

次に、GitLab を構築する。OS は、CentOS8 で。
パッケージの更新やら、ドメインの参加とかは、実施済みってことで進める。
GitLabの設定の際に、アクセスするアカウントとパスワードを設定する必要があるため、事前に、GitLab ユーザを作成しておく。

インストールの参考は以下。
Step 3: Install GitLab CE on CentOS 8 / RHEL 8 (computingforgeeks.com)

# dnf -y install curl \
                 vim \
                 policycoreutils \
                 python3-policycoreutils
# curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
# dnf -y install gitlab-ce

認証をActive Directoryで行うように、GitLab の設定。
設定した個所は以下。


# vi /etc/gitlab/gitlab.rb
# cat /etc/gitlab/gitlab.rb
external_url 'http://gitlab.lab.local'
gitlab_rails['time_zone'] = 'Asia/Tokyo'

gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
  main: # 'main' is the GitLab 'provider ID' of this LDAP server
    label: 'Active Directory'
    host: 'lab.local'
    port: 636
    uid: 'sAMAccountName'
    bind_dn: 'CN=GitLab,CN=Users,DC=lab,DC=local'
    password: 'gitlabuser'
    encryption: 'simple_tls' # "start_tls" or "simple_tls" or "plain"
    verify_certificates: false
    smartcard_auth: false
    active_directory: true
    allow_username_or_email_login: true
    lowercase_usernames: true
    block_auto_created_users: false
    base: 'DC=lab,DC=local'
    user_filter: ''
EOS

# gitlab-ctl reconfigure

確認
# gitlab-rake gitlab:ldap:check RAILS_ENV=production
Checking LDAP ...

LDAP: ... Server: ldapmain
not verifying SSL hostname of LDAPS server 'lab.local:636'
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
        DN: cn=certificate service dcom access,cn=builtin,dc=lab,dc=local        sAMAccountName: Certificate Service DCOM Access
~ 省略 ~
        DN: cn=krbtgt,cn=users,dc=lab,dc=local   sAMAccountName: krbtgt

Checking LDAP ... Finished

Firewall を変更して、アクセスできるようにする。

# firewall-cmd --permanent --add-service={http,https} --permanent
# firewall-cmd --reload



最後に、ブラウザでアクセスして、初期設定。
初回アクセスの場合、root のパスワード設定があるので、設定する。
その後、「Standard」を選択して、root でログインする。
あとは、GitLab の設定をいろいろカスタマイズ。

Active Directory」を選択して、DC のアカウントでもログインできる。