GitLab Install¶
- OS: Ubuntu 22.04
- Gitlab: v17.10.5
1. Install gitlab¶
- 1.1 Use the following command to install related dependent components
- 1.2 Download gitlab installation package to the tmp directory
gitlab-ce download url: https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/jammy/gitlab-ce_17.10.5-ce.0_amd64.deb
- 1.3 Install gitlab
2. Create gitlab certificate¶
2.1 Create CSR file¶
create private key, and CSR (Certificate Signing Request) file
mkdir /etc/gitlab/ssl && cd /etc/gitlab/ssl
openssl genrsa -out wzs-sat-poc-gitlab.wistron.com.key 2048
openssl req -new -key ./wzs-sat-poc-gitlab.wistron.com.key -out wzs-sat-poc-gitlab.wistron.com.csr
Common Name: wzs-sat-poc-gitlab.wistron.com
2.2 Create SSL certificate¶
2.2.1 login wistron ADCA, and click Request a certificate
2.2.2 click Submit a certificate request by using a base-64-encoded CMC or PKCS #10 file, or submit a renewal request by using a base-64-encoded PKCS #7 file
2.2.3 view and copy gitlab CSR file content
2.2.4 paste gitlab CSR file content to Saved Request, select Certificate Template with Wistron Client and Server Authentication, and entry Additional Attributes -> san:dns=wzs-sat-poc-gitlab.wistron.com
2.2.5 download certificate, and rename to wzs-sat-poc-gitlab.wistron.com.cer
2.3 Download CA cert¶
2.3.1 login wistron ADCA, and click Download a CA certificate, certificate chain, or CRL
2.3.2 select Base 64, and click Download CA certificate
save CA certificate with named:
cacerts.crt
2.3.3 upload certificate and CA certificate to gitlab server
3. Modify config file¶
- 3.1 Prepare gitlab config file
- change gitlab url ->
https://wzs-sat-poc-gitlab.wistron.com
- change gitlab time zone ->
gitlab_rails['time_zone'] = 'Asia/Shanghai'
- config LDAPs
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'LDAP'
host: 'cnzhsdc2.wzs.wistron'
port: 3269
uid: 'sAMAccountName'
bind_dn: 'wzsse@wzs.wistron'
password: 'password'
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: false
block_auto_created_users: false
base: 'dc=wistron'
user_filter: '(objectCategory=Person)(sAMAccountName=*)'
EOS
- enable Nginx https
nginx['enable'] = true
nginx['redirect_http_to_https'] = true
nginx['redirect_http_to_https_port'] = 80
nginx['ssl_client_certificate'] = "/etc/gitlab/ssl/cacerts.crt"
nginx['ssl_certificate'] = "/etc/gitlab/ssl/wzs-sat-poc-gitlab.wistron.com.cer"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/wzs-sat-poc-gitlab.wistron.com.key"
- 3.2 Reload gitlab, and start gitlab
get initial password
4. Config gitlab¶
- 4.1 Login gitlab web UI
use initial password
- 4.2 Deactivate system sign-up restrictions
click
Deactivate
un-select
Sign-up enabled&Require admin approval for new sign-upsthen click
Save changes
- 4.3 Re-set root password
Click user icon ->
Preferences->Password, and inputCurrent password、New password、Password confirmation, then clickSave password
5. Setup gitlab¶
5.1 Create project¶
- create group
re-login gitlab and go to the gitlab homepage, and click
Create a group->Create group
click
Creat group
input group name:
CCOE, and select visibility level toPublic, then clickCreate group
- Create project
click
New project
click
Create blank project
input project name:
ReleaseManagement, select visibility level toPublic, and un-checkInitialize repository with a README, then clickCreate project
5.2 Setup mirror¶
- User permission settings
source and target gitlab account must have maintain level permissions
first you need to login to gitlab once with your AD account, then switch back to use admin account
switch project
ReleaseManagement, and clickManage->Members->Invite members
click username, select your AD account, and select role to
Maintainer, then clickIvnite
- Copy site gitlab project URL
click project
ReleaseManagement->Code->Copy URL
- Config mirror on source gitlab (HQ gitlab)
login source gitlab (HQ gitlab) project
ReleaseManagement, clickSettings->Repositoryand expand
Mirroring repositories, then clickAdd newto input mirror info
- Waiting HQ gitlab push project
CCOE/Releasemanagementto site gitlab
- Confirm site gitlab was mirror successful

































