码迷,mamicode.com
首页 > 其他好文 > 详细

centos 安装gitlab

时间:2019-05-27 16:36:23      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:port   html4   网站   password   message   utf-8   mirrors   软件   utils   

1.开始安装依赖软件:yum -y install policycoreutils openssh-server openssh-clients postfix

2.设置postfix开机自启动,postfix支持gitlab发信功能:systemctl enable postfix && systemctl start postfix

如果出现:

Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.

vim /etc/postfix/main.cf

inet_protocols = ipv4
inet_interfaces = all

3.下载gitlab包(建议去网站下载最新版本https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/?C=M&O=A)

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

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

  如果报错:

   error: Failed dependencies:

        policycoreutils-python is needed by gitlab-ce-10.7.3-ce.0.el7.x86_64

   安装环境

   yum install policycoreutils-python

 

  别的网站下载后有时候会报错

   技术图片

 

 

技术图片

4.修改gitlab 端口和ip

   vim /etc/gitlab/gitlab.rb

   IP地址+端口号: external_url ‘http://192.168.0.217:8010‘

5.配置并启动gitlab

   gitlab-ctl reconfigure (可能会一段时间)

   gitlab-ctl restart

  下图表示成功

技术图片 

6.页面打开 如果出现这个错误

 技术图片

   1.更改端口号 vim  /etc/gitlab/gitlab.rb(更改后要重新运行)   

      gitlab-ctl reconfigure (可能会一段时间)

      gitlab-ctl restart

   2.权限问题,解决方法:chmod -R 755 /var/log/gitlab

   3.内存大于4G

7.首次进入会让你修改密码:修改后进入

.后来把端口改为8081后就可以了

技术图片

9.创建用户 

    1.点击小工具

    2.添加user

  技术图片

技术图片

10.关于发送邮箱。postfix默认用的25端口,但是阿里云又不让开启25端口。

 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] = "2833xxx@qq.com"  # 你自己QQ号
gitlab_rails[smtp_password] = "*************"             # QQ授权码
gitlab_rails[smtp_domain] = "smtp.qq.com"
gitlab_rails[smtp_authentication] = "login"
gitlab_rails[smtp_enable_starttls_auto] = true
gitlab_rails[smtp_tls] = true
gitlab_rails[gitlab_email_from] = 2833xxx@qq.com   # 你自己QQ号

3.打开自己的qq邮箱

 打开QQ邮箱-设置-账户-帐户安全-开启服务-POP3/SMTP服务-生成授权码-发个短信

gitlab-ctl reconfigure 重新配置

4.进入gitlab-rails console

  Notify.test_email(‘yoyo_你自己随便邮箱@qq.com‘, ‘邮件标题_test‘, ‘邮件正文_test‘).deliver_now

[root@iZ2ze9m7ocdxc43mxwv5uwZ ~]# gitlab-rails console
-------------------------------------------------------------------------------------
 GitLab:       11.11.0 (3e8ca2fb781)
 GitLab Shell: 9.1.0
 PostgreSQL:   9.6.11
-------------------------------------------------------------------------------------
Loading production environment (Rails 5.1.7)
irb(main):001:0> Notify.test_email(‘1003487863@qq.com‘,‘标题党‘,‘正文‘).deliver_now
Notify#test_email: processed outbound mail in 189.3ms
Sent mail to 1003487863@qq.com (1514.7ms)
Date: Mon, 27 May 2019 15:56:21 +0800
From: GitLab <1003487863@qq.com>
Reply-To: GitLab <noreply@39.97.187.87>
To: 1003487863@qq.com
Message-ID: <5ceb9825445e3_3d873ff6a9dd65f0390e9@iZ2ze9m7ocdxc43mxwv5uwZ.mail>
Subject: =?UTF-8?Q?=E6=A0=87=E9=A2=98=E5=85=9A?=
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>正文</p></body></html>

=> #<Mail::Message:70328290558700, Multipart: false, Headers: <Date: Mon, 27 May 2019 15:56:21 +0800>, <From: GitLab <1003487863@qq.com>>, <Reply-To: GitLab <noreply@39.97.187.87>>, <To: 1003487863@qq.com>, <Message-ID: <5ceb9825445e3_3d873ff6a9dd65f0390e9@iZ2ze9m7ocdxc43mxwv5uwZ.mail>>, <Subject: 标题党>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):002:0> exit()
[root@iZ2ze9m7ocdxc43mxwv5uwZ ~]# 

5.现在创建用户就会发送邮件

 

centos 安装gitlab

标签:port   html4   网站   password   message   utf-8   mirrors   软件   utils   

原文地址:https://www.cnblogs.com/elsons/p/10931288.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!