centos7安装gitlab

转载自:https://www.cnblogs.com/wenwei-blog/p/5861450.html

1. 安装依赖软件

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

2.设置postfix开机自启,并启动,postfix支持gitlab发信功能

systemctl enable postfix && systemctl start postfix

3.下载gitlab安装包,然后安装

centos 7系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7

下载rpm包并安装:

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.6.10-ce.0.el7.x86_64.rpm

rpm -i gitlab-ce-11.6.10-ce.0.el7.x86_64.rpm

4.修改gitlab配置文件指定服务器ip和自定义端口:

vim  /etc/gitlab/gitlab.rb

 修改为我们自己的ip和端口,默认为80端口:

centos7安装gitlab_第1张图片

5.重置并启动GitLab

执行:

gitlab-ctl reconfigure

gitlab-ctl restart

6.邮件配置

vim /etc/gitlab/gitlab.rb

修改配置如下所示:
 

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "scoyewaixaszbebs"
gitlab_rails['smtp_domain'] = "qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]'

注意:1.gitlab_email_from参数不要忘记设置了,不然会抛出异常,邮件发送不成功。

           2. smtp_password为邮箱配置POP3生成的授权码。centos7安装gitlab_第2张图片

修改完后重启配置:

gitlab-ctl reconfigure

打开邮件测试控制台:

gitlab-rails console 

测试邮件发送:

Notify.test_email(‘接收方邮件地址’,’邮件标题’,’邮件内容’).deliver_now 

按回车,测试发送。 

centos7安装gitlab_第3张图片

邮件已经收到:

centos7安装gitlab_第4张图片

你可能感兴趣的:(centos7安装gitlab)