搭建GitLab
目前公司内网使用的是SVN,之前搭建时项目和开发人员并不多,所以也没走LDAP认证;现在人员增加,加上新来的开发人员比较习惯用GitHub,由于公司业务比较敏感,所幸搭建一套内网GitLab,配置LDAP认证。
1.用bitnami上的封装包部署
https://bitnami.com/redirect/to/90913/bitnami-gitlab-8.4.2-0-linux-x64-installer.run
2.下载完成后,直接在服务器上执行即可
./bitnami-gitlab-8.2.3-4-linux-x64-installer.run
Error: There has been an error.
The installation has detected that the current umask is set to permissions of
0027, the installation is now exiting. You should modify your umask to at least
0022 before launching the installer. After the installation has completed, reset
the umask permissions to your original values.
Press [Enter] to continue:
这里发现报错,按照提示将umask值设置为0022即可.
Welcome to the Bitnami Gitlab Stack Setup Wizard.
----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.
PhpPgAdmin [Y/n] :
*这里选择Y*
GitLab : Y (Cannot be edited)
Is the selection above correct? [Y/n]: y
*确认上述配置*
----------------------------------------------------------------------------
Installation folder
Please, choose a folder to install Bitnami Gitlab Stack
Select a folder [/opt/gitlab-8.2.3-4]:
*填写安装Gitlab的目录*
----------------------------------------------------------------------------
Create Admin account
Bitnami Gitlab Stack admin user creation
Email Address [user@example.com]: ***git@XXX.com.cn***
*配置管理员邮件地址*
Login [root]:
Password :
Please confirm your password :
*配置管理员账户和密码*
Hostname that will be used to create internal URLs. If this value is incorrect,
you may be unable to access your Gitlab installation from other computers. It is
advisable to use a Domain instead of an IP address for compatibility with
different browsers.
Domain [XXX.XXX.XX.XX]: XXX.XXX.XXX.XXX
Do you want to configure mail support? [y/N]: y
*配置访问地址*
----------------------------------------------------------------------------
Configure SMTP Settings
This is required so your application can send notifications via email.
Default email provider:
[1] GMail
[2] Custom
Please choose an option [1] : 2
*选择邮箱类型*
----------------------------------------------------------------------------
Configure SMTP Settings
This data is stored in the application configuration files and may be visible to
others. For this reason, it is recommended that you do not use your personal
account credentials.
Username []: git@XXX.com.cn
Password :
Re-enter :
SMTP Host []: smtp.exmail.qq.com
SMTP Port [587]:
Secure connection
[1] None
[2] SSL
[3] TLS
Please choose an option [3] :
*配置邮箱*
----------------------------------------------------------------------------
Setup is now ready to begin installing Bitnami Gitlab Stack on your computer.
Do you want to continue? [Y/n]: y
----------------------------------------------------------------------------
Please wait while Setup installs Bitnami Gitlab Stack on your computer.
Installing
0% ______________ 50% ______________ 100%
#########################################
----------------------------------------------------------------------------
Setup has finished installing Bitnami Gitlab Stack on your computer.
Info: To access the Bitnami Gitlab Stack, go to
http://10.12.3.21:80 from your browser.
Press [Enter] to continue:
*安装完成*
3.访问GitLab网页
-
登录界面
- 登录成功
[图片上传失败...(image-a211b6-1530496467610)]
4.配置LDAP库
- 修改配置文件,开启LDAP验证:
vim ./config/gitlab.yml
ldap: enabled: true #默认是false label: 'LDAP' host: 'XXX.XXX.XXX.XXX' #填写LDAP服务器ip port: 389 #LDAP服务器端口,默认是389;如加密,则为636 uid: 'sAMAccountName' method: 'plain' #LDAP认证模式,plain是简单认证,加密认证有ssl和tls bind_dn: '$LDAPUSER' #连接LDAP的帐号 password: '$LDAPPASSWD' #连接LDAP的密码 base: 'OU=XXX,DC=corp,DC=XXXX,DC=com,DC=cn' #组织架构,因为用的是总部的LDAP,这里精确到OU
-
配置完成后重启Git
/opt/gitlab-8.2.3-4/ctlscript.sh restart
5.访问gitlab页面
- 显示LDAP登录页,到这里GitLab搭建完成
[图片上传失败...(image-310ad8-1530496467610)]