在签署证书是报错了,根据报错信息得知在签署证书时会在当前目录下去寻找“ ./demoCA/private/cakey.pem”这个CA的密钥文件,所以应该切换到“/etc/ssl”目录下去执行上边的命令,如下:
root@test1:/etc/ssl# openssl ca -in /etc/gitlab/ssl/test.gitlab.net.csr -out /etc/gitlab/ssl/test.gitlab.net.crt -days 3650
Using configuration from /usr/lib/ssl/openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: Jan 6 01:13:40 2016 GMT
Not After : Jan 3 01:13:40 2026 GMT
Subject:
countryName = CN
stateOrProvinceName = ChongQing
organizationName = SJKJ
organizationalUnitName = Operation Services
commonName = test.gitlab.net
emailAddress = test@admin.com
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
52:95:81:FD:1D:D9:CE:40:D8:22:9C:95:8D:D0:8D:1C:A8:7D:78:4D
X509v3 Authority Key Identifier:
keyid:05:0A:A9:09:33:18:C3:99:71:19:BD:3F:EA:92:EB:A5:D2:30:72:EB
Certificate is to be certified until Jan 3 01:13:40 2026 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
root@test1:/etc/ssl# ls /etc/gitlab/ssl/
test.gitlab.net.crt test.gitlab.net.csr test.gitlab.net.key
root@test1:/etc/ssl# rm -f /etc/gitlab/ssl/test.gitlab.net.csr #证书签署请求文件可以删除
root@test1:/etc/ssl# chmod 700 /etc/gitlab/ssl # 更改目录权限
root@test1:/etc/ssl# ls -ld /etc/gitlab/ssl
drwx------ 2 root root 4096 1月 6 09:24 /etc/gitlab/ssl
2.3.3、开启GitLab的https支持
root@test1:/etc/ssl# vim /etc/gitlab/gitlab.rb
# note the 'https' below
external_url 'https://test.gitlab.net'
##### open htts #####################
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/test.gitlab.net.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/test.gitlab.net.key"
"nginx['redirect_http_to_https'] = true"表示将所有的http流量转发到https上, 下边两行代表GitLab和密钥和证书所在路径,从这里我猜测存放密钥和证书的路径是可以自定义的,只要在这里正确指定即可,这个我没有验证。
root@test1:/etc/ssl# gitlab-ctl reconfigure #重新编译配置
运行上边的命令会重新编译配置文件并会重新启动GitLab的各个组件的服务,现在再来访问一下我们的GitLab,如下:
直接访问“”也会被强制定向到https的安全链接。
2.3.4、启用SMTP服务
当在GitHub上注册一个新用户时你会收到一封邮件,邮件里会有一些提示性的信息或者点击一个链接让你更改登陆密码,GitLab也一样可以配置这样的邮件提醒功能,如果你没有自己的邮件服务器,那一般都是配置启用第三方SMTP服务。详情请参照官方https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md。官方资料中没有介绍怎样配置163邮箱的SMTP配置方法,这里我就以它为例。
123456789101112 root@test1:~# vim /etc/gitlab/gitlab.rb #把以下内容追加到最后
##### open smtp ############
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "XXXXX@163.com"
gitlab_rails['smtp_password'] = "***********"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = "XXXX@163.com"
在启用SMTP时花了不少时间,因为各个参数之间要配合使用,而这个也只能自己不断尝试才行。
root@test1:~# gitlab-ctl reconfigure #重新编译
现在我们的GitLab就启用了SMTP功能。
如何在Ubuntu Server 14.04下安装Gitlab中文版