GitLab
GitLab是一套以Git为中心而发展出来的软件。
安装
官方说明内存一般建议为8 GB,最少4 GB(在这种情况下需要外加4 GB的Swap)[1]。实际测试发现刚装完大约吃1.5 GB的内存,一个人自己用之后会到2.5 GB左右,对于只有自己在使用的服务可以考虑2 GB的机器加上1 GB的Swap。
sudo apt install -y ca-certificates curl openssh-server postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo EXTERNAL_URL="https://gitlab.example.com" apt install gitlab-ee
最近的版本可能会需要处理安装时Let's Encrypt凭证申请失败的相关的问题[3]。
移除
移除需要多个步骤[4]:
sudo gitlab-ctl uninstall
sudo gitlab-ctl cleanse
sudo gitlab-ctl remove-accounts
sudo apt purge -y gitlab-ce
sudo rm -rf /etc/gitlab /opt/gitlab /var/log/gitlab /var/opt/gitlab
设定
- 安装完后马上透过网页连,可以设定密码。设定完后可以用预设账号root与刚刚所设定的密码登入。
- 通常会关闭注册(在网页界面上就可以关闭)。
- 使用LDAP认证的设定需要透过
/etc/gitlab/gitlab.rb
修改:
gitlab_rails['ldap_enabled'] = true
gitlab_rails['prevent_ldap_sign_in'] = false
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
main:
label: 'LDAP'
host: 'ldap.example.com'
port: 389
uid: 'uid'
bind_dn: ''
password: ''
encryption: 'plain'
verify_certificates: true
smartcard_auth: false
active_directory: false
allow_username_or_email_login: true
lowercase_usernames: true
block_auto_created_users: false
base: 'ou=People,dc=example,dc=com'
user_filter: ''
attributes:
email: ['mail', 'email', 'userPrincipalName']
EOS
常用指令
- sudo gitlab-ctl reconfigure
- sudo gitlab-ctl renew-le-certs
- sudo gitlab-ctl restart
参考资料
- ↑ Requirements. [2019-12-10].
- ↑ GitLab Installation. [2019-12-10].
- ↑ Unable to renew letsencrypt certificate anymore. [2019-12-18].
- ↑ Is it fine to remove the /opt/gitlab/ directory manually after removing the gitlab package from the system?. 2016-09-14 [2019-12-10].
外部链接
- 官方网站 (英文)