官方安装说明:https://about.gitlab.com/install/#centos-7
自定义yum源 自行搞定
下载gitlab
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.10.4-ce.0.el7.x86_64.rpm
yum install gitlab-ce-11.10.4-ce.0.el7.x86_64.rpm -y
关防火墙 和 selinux
vim /etc/selinux/config
修改配置文件
vim /etc/gitlab/gitlab.rb
设置 https支持
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url 'https://gitlab.你的域名.com'
设置证书
再也不用忽略证书问题了,因为证书没问题了.
证书可以从 letsencrypt 生成免费的证书..(默认浏览器和工具都不会提示不安全警告的.)
详情参考:https://github.com/Neilpang/acme.sh/wiki/%E8%AF%B4%E6%98%8E
##! Most root CA's are included by default
nginx['ssl_client_certificate'] = "/home/centos/sslkeys/ca.crt"
##! enable/disable 2-way SSL client authentication
# nginx['ssl_verify_client'] = "off"
##! if ssl_verify_client on, verification depth in the client certificates chain
# nginx['ssl_verify_depth'] = "1"
nginx['ssl_certificate'] = "/home/centos/sslkeys/fullchain.cer"
nginx['ssl_certificate_key'] = "/home/centos/sslkeys/gitlab.你的域名.com.key"
设置Email支持
### GitLab email server settings
###! Docs: https://docs.gitlab.com/omnibus/settings/smtp.html
###! **Use smtp instead of sendmail/postfix.**
#这里使用的是阿里云推送 每日免费200封.
# 详细开通 这里哦 ---> https://dm.console.aliyun.com/?spm=5176.12818093.my.ddm.488716d0ezCKP2#/directmail/Home/cn-hangzhou
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtpdm.aliyun.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]你填写的域名.com"
gitlab_rails['smtp_password'] = "密码"
gitlab_rails['smtp_domain'] = "smtpdm.aliyun.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
### Email Settings
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]你的域名.com'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
gitlab_rails['gitlab_email_subject_suffix'] = ''
阿里云邮件推送 需要设置的项目
先添加域名,不明白看他们的文档, 配置好后要按照要求修改dns解析项目
配置完成执行
gitlab-ctl reconfigure
然后浏览器登录你的 gitlab 第一次它会要求你创建一个管理员密码.
配置觉得有问题可以 vim /etc/gitlab/gitlab.rb
保存之后 在执行 gitlab-ctl reconfigure
重新配置完成即可.
测试email 命令. []
进入控制台gitlab-rails console (测试邮件服务是否正常)
Notify.test_email("[email protected]","title","content").deliver_now
测试完成,可以尝试点击忘记密码
原文地址:https://www.cnblogs.com/lovesKey/p/10896268.html
时间: 2024-09-30 04:44:44