Gitlab
安装
环境
192.168.48.52 gitlab
准备
yum install -y curl policycoreutils-python openssh-server
yum install postfix
systemctl enable postfix
systemctl start postfix
yum源
vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
安装
yum makecache
yum install gitlab-ce
yum install git
查看版本号
[root@gitlab ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
12.1.4
编辑配置文件
设置访问ip
[root@gitlab ~]# vim /etc/gitlab/gitlab.rb
...
external_url 'http://192.168.48.52'
设置邮件
[root@gitlab ~]# vim /etc/gitlab/gitlab.rb
...
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "tangwei@tk8s.com"
gitlab_rails['smtp_password'] = "邮箱密码"
gitlab_rails['smtp_domain'] = "tk8s.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = "tangwei@tk8s.com"
user['git_user_email'] = "tangwei@tk8s.com"
gitlab_rails['gitlab_email_reply_to'] = 'tangwei@tk8s.com'
加载配置文件
[root@gitlab ~]# gitlab-ctl reconfigure
重启gitlab
[root@gitlab ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 14472) 1s
ok: run: gitaly: (pid 14483) 1s
ok: run: gitlab-monitor: (pid 14504) 0s
ok: run: gitlab-workhorse: (pid 14517) 1s
ok: run: logrotate: (pid 14531) 0s
ok: run: nginx: (pid 14538) 0s
ok: run: node-exporter: (pid 14620) 1s
ok: run: postgres-exporter: (pid 14626) 0s
ok: run: postgresql: (pid 14635) 1s
ok: run: prometheus: (pid 14644) 0s
ok: run: redis: (pid 14654) 1s
ok: run: redis-exporter: (pid 14658) 0s
ok: run: sidekiq: (pid 14665) 0s
ok: run: unicorn: (pid 14678) 0s
测试邮箱
[root@gitlab ~]# gitlab-rails console
irb(main):016:0> Notify.test_email('1247549534@qq.com', 'test', 'test').deliver_now
Notify#test_email: processed outbound mail in 194.3ms
Sent mail to 1247549534@qq.com (2424.0ms)
Date: Tue, 07 May 2019 21:52:56 +0800
From: GitLab <tangwei@tk8s.com>
Reply-To: GitLab <noreply@192.168.48.52>
To: 1247549534@qq.com
Message-ID: <5cd18db86dffb_38183fc6042d65f42823e@gitlab.mail>
Subject: test
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>test</p></body></html>
=> #<Mail::Message:70119381048200, Multipart: false, Headers: <Date: Tue, 07 May 2019 21:52:56 +0800>, <From: GitLab <tangwei@tk8s.com>>, <Reply-To: GitLab <noreply@192.168.48.52>>, <To: 1247549534@qq.com>, <Message-ID: <5cd18db86dffb_38183fc6042d65f42823e@gitlab.mail>>, <Subject: test>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
访问gitlab,设置root密码
root登录