标签:gitlab 邮件发送
centos6.3配置gitlab-7.10.0-omnibus(使用smtp服务进行邮件发出)
1.依赖包安装
yum install openssh-server cronie -y
#yum install postfix //使用sendmail进行发送邮件需要安装,但是没有配置成功,这里采取smtp服务器进行邮件发出,故不再安装postfix。
#service postfix start
#chkconfig postfix on
lokkit -s http -s ssh
2.下载安装包
curl -O https://downloads-packages.s3.amazonaws.com/centos-6.6/gitlab-ce-7.10.1~omnibus.2-1.x86_64.rpm
3.安装
rpm -i gitlab-ce-7.10.1~omnibus.2-1.x86_64.rpm
==============================
有可能会包rpm(lib*)的错误。请升级rpm软件 yum install rpm -y
==============================
4.配置gitlab e-mail功能
===========================================================
external_url ‘http://117.78.7.X‘
############################
# gitlab.yml configuration #
############################
#E-mail config Date:2015-05-04 Author:qingbo.song
gitlab_rails[‘time_zone‘] = ‘UTC‘
gitlab_rails[‘gitlab_email_enabled‘] = true
gitlab_rails[‘gitlab_email_from‘] = ‘gitlab2015@163.com‘
gitlab_rails[‘gitlab_email_display_name‘] = ‘APICloud_Gitlab‘
gitlab_rails[‘gitlab_email_reply_to‘] = ‘gitlab2015@163.com‘
################################
# GitLab email server settings #
################################
#use smtp to E-mail you Date:2015-05-04 Author:qingbo.song
gitlab_rails[‘smtp_enable‘] = true
gitlab_rails[‘smtp_address‘] = "smtp.163.com"
gitlab_rails[‘smtp_port‘] = 25
gitlab_rails[‘smtp_user_name‘] = "gitlab2015@163.com"
gitlab_rails[‘smtp_password‘] = "nxgfvizafijytymx"
gitlab_rails[‘smtp_domain‘] = "163.com"
gitlab_rails[‘smtp_authentication‘] = "login"
gitlab_rails[‘smtp_enable_starttls_auto‘] = true
gitlab_rails[‘smtp_tls‘] = false
#################################
# application.yml configuration #
#################################
#Date:2015-05-04 Author:qingbo.song
gitlab_ci[‘smtp_enable‘] = true
gitlab_ci[‘smtp_address‘] = "smtp.163.com"
gitlab_ci[‘smtp_port‘] = 25
gitlab_ci[‘smtp_user_name‘] = "gitlab2015@163.com"
gitlab_ci[‘smtp_password‘] = "nxgfvizafijytymx"
gitlab_ci[‘smtp_domain‘] = "163.com"
gitlab_ci[‘smtp_authentication‘] = "login"
gitlab_ci[‘smtp_enable_starttls_auto‘] = true
=============================================================
5.重置配置,使修改失效
gitlab-ctl reconfigure
6.登录、测试
打开浏览器,输入 external_url ‘http://117.78.7.X‘
Username: root (管理员账号)
Password: 5iveL!fe
使用其他邮箱进行注册测试,看看能不能收到邮件。
gitlab_rails[‘gravatar_plain_url‘] = ‘http://117.78.7.X/avatar/%{hash}?s=%{size}&d=identicon‘
解决用户头像不能正常显示的问题。
Linux下可以直接用mail命令发送邮件,但是发件人是user@servername,如果机器没有外网的dns,其他人就无法回复。此时,有一个可以使用网络免费邮箱服务的邮件发送程序就比较重要了。msmtp就是这样的一个程序。
#1、下载源码包
wget http://sourceforge.net/projects/msmtp/files/msmtp/1.4.32/msmtp-1.4.32.tar.bz2
#2、解压
tar -jxvf msmtp-1.4.32.tar.bz2 && cd msmtp-1.4.32
#build and install
./configure --prefix=/usr/local/msmtp && make && make install
#link to /usr/bin
ln -s /usr/local/msmtp/bin/msmtp /usr/bin/msmtp
#3、新建msmtp的配置文件
mkdir /usr/local/msmtp/etc && vim /usr/local/msmtp/etc/msmtprc
#4、输入如下内容
# Set default values for all following accounts.
defaults
logfile /var/log/msmtp/msmtp.log
# The SMTP server of the provider.
account 163
# SMTP邮件服务器地址
host smtp.163.com
# 发送的邮件Email
from gitlab2015@163.com
auth login
# 邮件服务器登录账号
user gitlab2015@163.com
tls off
# 邮件服务器登陆密码
password nxgfvizafijytymx
# Set a default account
account default : 163
#############################################
报错:550 user is lock -->需要添加 tls off
authentication failed (method LOGIN)
将password修改为163服务器开启smtp服务时生成的客户端独立授权密钥
#############################################
#5、测试msmtp是否配置正确
msmtp test@163.comtest
[ctrl+d]
#6、安装配置mutt
yum install -y mutt
#vim /etc/Muttrc
#输入如下内容:
set sendmail=‘/usr/local/msmtp/bin/msmtp‘
set use_from=yes
set realname=‘APICloud_Gitlab‘
set from=gitlab2015@163.com
set envelope_from=yes
auto_view text/html
set charset=‘utf-8‘
set send_charset=‘utf-8‘
set locale =‘zh_CN.UTF-8‘
set content_type = ‘text/html\;charset=utf-8‘
set rfc2047_parameters=yes
#vim /etc/Muttrc.local
# Local configuration for Mutt.
set sendmail="/usr/local/msmtp/bin/msmtp"
set use_from=yes
set realname="gitlab2015@163.com"
set editor="vim"
#6、配置完毕,测试一下吧!
echo "Test"|mutt -s "test" user@163.com
收到测试邮件即为成功!
本文出自 “守望海豚” 博客,谢绝转载!
centos6.3配置gitlab-7.10.0-omnibus && msmtp+mutt发送邮件
标签:gitlab 邮件发送
原文地址:http://swht1278.blog.51cto.com/7138082/1643939