centos6.3配置gitlab-7.10.0-omnibus(使用smtp服务进行邮件发出)
一、安装部署(目前官网最新版本为8.1.4)
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 #(/opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml)
############################
#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'
#/opt/gitlab/embedded/service/gitlab-rails/config/environments/production.rb#
################################
# 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
#/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb#
#################################
# 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.登录、测试
打开浏览器,输入 'http://117.78.7.X'
Username: root (管理员账号)
Password: 5iveL!fe
使用其他邮箱进行注册测试,看看能不能收到邮件。
解决用户头像不能正常显示的问题。
gitlab_rails['gravatar_plain_url'] = 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon'
gitlab_rails['gravatar_ssl_url'] = 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon'
二、开机启动设置
开机自启动脚本设置:
vim /opt/startGitlab.sh
==========================
#! /bin/bash
sudo lokkit -s http -s ssh
==========================
echo "/opt/startGitlab.sh" >> vim /etc/rc.d/rc.local
================================================
三、数据备份与恢复
数据备份及恢复命令:备份path:/var/opt/gitlab/backups (备份和恢复文件都是git用户)
数据备份:gitlab-rake gitlab:backup:backup
数据恢复:gitlab-rake gitlab:backup:restore
================================================
四、gitlab.rb配置
2015.11.20更新:开启自建gitlab平台导入github平台项目功能 (gitlab与github实现认证功能)
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_providers'] = [
{
"name" => "github",
"app_id" => "048eb8c1fbd9c5fa8d4a",
"app_secret" => "49e950c095d0d98758316db1d15f109657fb8532",
"url" => "https://github.com/",
"args" => { "scope" => "user:email" }
}
]
操作步骤:1.现在github.com官网创建一个公共的github管理账号,之后进入账户设置,然后根据下面图示进行操作:
2.实现原理分析:利用第三方(github.com第三方账户)认证证书与个人账户进行认证。涉及到一些不安全的问题,此处不做深入追究。从官方教程来看,是个人账户之间进行认证,为了个人账户安全,这里采用的是第三方账户,官方文档参考:https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/integration/github.md
==========================================================================
升级教程:http://jingyan.baidu.com/article/72ee561ab1b333e16038df63.html
历史版本下载:https://packages.gitlab.com/gitlab/gitlab-ce
========================================================
2016.03.15 重置root用户密码
参考链接:http://blog.csdn.net/needkane/article/details/44802511
控制台:shell>gitlab-rails console production
irb(main):001:0 > u=User.where(id:1).first
> u.password = 'my_password'
> u.password_confirmation = 're_my_password'
> u.save
修改成功!
=========================================================
数据库这个地方默认位置,否则会报错
postgresql['dir'] = postgresql['data_dir'] = postgresql['log_directory'] = postgresql['home'] =
=========================================================
转载于:https://blog.51cto.com/nanfeibobo/1643939