一.
安装Omnibus gitlab-ce package
1.安装gitlab组件
yum install curl policycoreutils openssh-server openssh-clients postfix -y
2.配置yum仓库
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash yum install -y gitlab-ce
3.启动postfix邮件服务
systemctl start postfix && systemctl enable postfix
4.证书创建与配置加载
mkdir -p /etc/gitlab/ssl openssl genrsa -out "/etc/gitlab/ssl/gitlab.example.com.key" 2048
openssl x509 -req -days 365 -in "/etc/gitlab/ssl/gitlab.example.com.csr" -signkey "/etc/gitlab/ssl/gitlab.example.com.key" -out "/etc/gitlab/ssl/gitlab.example.com.crt" openssl dhparam -out /etc/gitlab/ssl/dhparams.pem 2048 chmod 600 /etc/gitlab/ssl/* [root@yanglin1 ~]# ll /etc/gitlab/ssl/ 总用量 16 -rw-r--r-- 1 root root 424 9月 18 16:33 dhparams.pem -rw-r--r-- 1 root root 1281 9月 18 16:33 gitlab.example.com.crt -rw-r--r-- 1 root root 1074 9月 18 16:16 gitlab.example.com.csr -rw-r--r-- 1 root root 1679 9月 12 19:10 gitlab.example.com.key
5.nginx SSL代理服务配置:
vim /etc/gitlab/gitlab.rb #修改下面内容 external_url 'https://gitlab.example.com' nginx['redirect_http_to_https'] = true nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.example.com.crt" nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.example.com.key" nginx['ssl_dhparam'] = "/etc/gitlab/ssl/dhparams.pem"
6.初始化gitlab相关服务并完成安装
gitlab-ctl reconfigure #第一个 server_name gitlab.example.com; 下添加该行 vim /var/opt/gitlab/nginx/conf/gitlab-http.conf rewrite ^(.*)$ https://$host$1 permanent; #重启gitlab gitlab-ctl restart
7.
完