GitLab社区版安装步骤

系统准备工作

关闭系统防火墙

systemctl stop firewalld
systemctl disable firewalld

关闭SELINUX并重启系统

vim /etc/sysconfig/selinux

修改内容:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

重启服务器

reboot

安装Omnibus Gitlab-ce package

安装依赖包

yum -y install curl policycoreutils openssh-server openssh-clients postfix

配置yum仓库

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

启动postfix邮件服务

systemctl start postfix && systemctl enable postfix

安装Gitlab-ce社区版本

yum install -y gitlab-ce

Gitlab相关配置初始化

证书创建与配置加载

创建保存证书目录
mkdir -p /etc/gitlab/ssl
生成秘钥和证书
openssl genrsa -out /etc/gitlab/ssl/gitlab.example.com.key 2048
openssl req -new -key "/etc/gitlab/ssl/gitlab.example.com.key" -out "/etc/gitlab/ssl/gitlab.example.com.csr"

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-S8LGFYbT-1597377750119)(/Users/lijiabin/Library/Application Support/typora-user-images/image-20200813185525456.png)]

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/dhparam.pem 2048
修改证书权限(在证书目录执行)
chmod 600 *
修改Gitlab配置文件
vim /etc/gitlab/gitlab.rb
external_url 中的链接  将http改为https
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = 生成的crt证书路径
nginx['ssl_certificate_key'] = 生成的key路径
nginx['ssl_dhparam'] = 生成的pem证书路径
初始化配置
gitlab-ctl reconfigure

Nginx SSL代理服务器配置并重启

修改nginx配置
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf

在server_name gitlab.example.com下面添加 rewrite将https请求重定向

rewrite ^(.*)$ https://$host$1 permanent;
重启服务
gitlab-ctl restart
修改本机的DNS hosts文件
此处替换为gitlab的IP地址 gitlab.example.com

在浏览器访问测试

https://gitlab.example.com
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

果丶果

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值