centos7安裝gitlab 支持帶認證https,開啟郵件功能 超級簡單.


官方安裝說明: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'] = "admin@mail.你填寫的域名.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'] = 'admin@mail.你的域名.com'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
gitlab_rails['gitlab_email_reply_to'] = 'noreply@mail.wutoon.com'
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("XXX@XXX.XX","title","content").deliver_now

測試完成,可以嘗試點擊忘記密碼


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2020 ITdaan.com