cent7安装指定版本gitlab11.4.6并配置邮件服务
bigegpt 2024-10-14 08:24 10 浏览
cent7安装指定版本gitlab11.4.6并配置邮件服务
如果对运维课程感兴趣,可以在b站上或csdn上搜索我的账号: 运维实战课程,可以关注我,学习更多免费的运维实战技术视频
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
上传gitlab包:
[root@localhost ~]# ls
gitlab-ce-11.4.6-ce.0.el7.x86_64.rpm
[root@localhost ~]# yum -y install policycoreutils-python #安装依赖包
[root@localhost ~]# yum install curl openssh-server openssh-clients postfix cronie -y
[root@localhost ~]# systemctl start postfix
[root@localhost ~]# systemctl enable postfix
[root@localhost ~]# rpm -ivh gitlab-ce-11.4.6-ce.0.el7.x86_64.rpm
出现下面界面表示安装成功:
配置gitlab访问地址,配置邮件服务并启动gitlab:
[root@localhost ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.224.130' #若改变端口:http://192.168.224.130:8888 #此后是gitlab访问地址(仓库地址)
……
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com" #修改成使用qq邮箱服务
gitlab_rails['smtp_port'] = 465 #qq邮箱的端口默认465,不用修改
gitlab_rails['smtp_user_name'] = "1441107787@qq.com" #开启smtp服务的qq邮箱
gitlab_rails['smtp_password'] = "txjkxkkocxwqfegf" #qq邮箱开启密保验证时返回的授权码,需要配置qq邮箱开启smtp服务时生成
gitlab_rails['smtp_domain'] = "qq.com" #域名,qq邮箱的域名
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true #修改成true
……
user['git_user_email'] = "1441107787@qq.com" #修改成开启smtp服务的qq邮箱
gitlab_rails['gitlab_email_from'] = '1441107787@qq.com' #修改成开启smtp服务的qq邮箱,作为发件者
wq
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost ~]# gitlab-ctl status
run: alertmanager: (pid 5239) 755s; run: log: (pid 5247) 755s
run: gitaly: (pid 5194) 757s; run: log: (pid 5201) 757s
run: gitlab-monitor: (pid 5212) 756s; run: log: (pid 5215) 756s
run: gitlab-workhorse: (pid 5178) 758s; run: log: (pid 5183) 758s
run: logrotate: (pid 4315) 961s; run: log: (pid 5188) 757s
run: nginx: (pid 4270) 968s; run: log: (pid 5189) 757s
run: node-exporter: (pid 4483) 944s; run: log: (pid 5202) 757s
run: postgres-exporter: (pid 5257) 755s; run: log: (pid 5262) 754s
run: postgresql: (pid 3790) 1077s; run: log: (pid 5165) 759s
run: prometheus: (pid 5224) 756s; run: log: (pid 5227) 756s
run: redis: (pid 3646) 1088s; run: log: (pid 5164) 759s
run: redis-exporter: (pid 4651) 932s; run: log: (pid 5216) 756s
run: sidekiq: (pid 4150) 980s; run: log: (pid 5167) 759s
run: unicorn: (pid 4078) 986s; run: log: (pid 5166) 759s
[root@localhost ~]# netstat -anput |grep 80
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 4136/unicorn master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4270/nginx: master
……
[root@localhost ~]# netstat -anput |grep redis
tcp 0 0 127.0.0.1:9121 0.0.0.0:* LISTEN 4651/redis_exporter
tcp 0 0 127.0.0.1:9121 127.0.0.1:56818 ESTABLISHED 4651/redis_exporter
[root@bogon ~]# ps -ef |grep unicorn
有进程
[root@bogon ~]# ps -ef |grep nginx
有进程
[root@bogon ~]# ps -ef |grep redis
有进程
#注意:第一次启动服务需用命令:gitlab-ctl reconfigure配置和启动服务,此后,可以用命令:gitlab-ctl status查看状态,gitlab-ctl stop停止服务,gitlab-ctl start启动服务等操作。(且自动会启动两个端口80和8080端口,自动从自身nginx代理到后面8080端口服务,gitlab服务配置启动后,会自带启动一些服务,内置nginx服务和unicorn服务(web服务)和redis服务,若gitlab-ctl stop后,gitlb服务和自带的服务也就跟着停止了,当再gitlab-ctl start后,自带的服务也跟着起来)
客户端访问:http://192.168.224.130 回车后跳转到下面页面:
重置管理员用户密码:1234567890(不能短于8位),默认管理员是root
重置root密码后可用root管理员登陆gitlab,如下:
测试邮箱服务功能:
[root@localhost ~]# gitlab-rails console #进入控制台(比较慢)
irb(main):001:0> Notify.test_email('1036981484@qq.com','this is title','hello').deliver_now #回车即可
上面是指定收件人的邮箱,使用配置的发件人1441107787@qq.com给收件人:1036981484@qq.com 邮箱发消息
此时:收件人1036981484@qq.com会收到邮件,表示邮件服务配置成功。
gitlab的使用:注意:下面通用:
管理员用户:root,密码:123456.com,配置文件配置了邮件服务,发邮件人:1441107787@qq.com
普通用户shi,密码:123456789 1036981481@qq.com随意一个邮箱(开启邮箱验证前可以随便注册的邮箱)
普通用户shi2,密码:1234567890 1036981484@qq.com (开启邮箱验证后,需要通过验证才可以注册的邮箱)
1.gitlab管理员root用户更改密码:
登录gitlab后,点击最右上角的用户图标——Settings——Password——填写当前密码和新密码——save password即可。
2.gitlab普通用户shi更改密码:
登录gitlab后,点击最右上角用户图标——Settings——Password——填写当我密码和新密码——save password即可。
3.gitlab管理员root用户查看所注册的gitlab普通用户情况(查看所有的普通用户)
点击Admin area——Users可查看所有注册的gitlab普通用户。
4.用户在gitlab创建仓库(以root用户为例,其他用户类似)
[root@localhost ~]# yum -y install git #客户端机器,也可用服务器作为客户端
[root@localhost ~]# git config --global user.name "Administrator"
[root@localhost ~]# git config --global user.email "admin@example.com"
[root@localhost ~]# mkdir /test1
[root@localhost ~]# cd /test1/
[root@localhost test1]# ls -a
. ..
[root@localhost test1]# git clone http://192.168.224.130/root/test.git
输入root用户名和密码:123456.com
[root@localhost test1]# ls -a
. .. test
[root@localhost test1]# ls test/
空 #克隆的空仓库
[root@localhost test1]# cd test/
[root@localhost test]# echo 111 > 1.txt
[root@localhost test]# ls
1.txt
[root@localhost test]# git add .
[root@localhost test]# git commit -m "add 1.txt"
[root@localhost test]# git push http://192.168.224.130/root/test.git master #推送到远程仓库master分支
输入root用户名和密码:123456.com
远程仓库即可查看到推送来的文件:
4.用户在gitlab创建仓库其他分支dev(以root用户为例,其他用户类似)
先进入指定仓库——Reporitory——Branches——New branche——填写新分支名dev——create branch即可。
5.gitlab管理员root给指定仓库添加成员:
先进入指定仓库——Settins——Members——Invite member——填写选择邀请的普通用户(搜索后会显示出所有注册的普通用户),填写赋予用户的权限角色(Maintainer/Developer),日期等——Add to project即可邀请了该普通用户加入该项目,且因为配置了邮件服务,该普通用户会收到一封邀请加入该项目的邮件提示,不用确认,只是通知一个信息。
6.gitlab管理员root给指定仓库添加分支保护(只是添加分支保护,其他合并分支配合是后面的事情,此处是独立的只是开启分支保护功能)
先进入指定仓库——Settings——Repository——Protected Branches(点击Expand进入),填写选择要保护的分支:Master,Allowed to merge: Maintainer(指定谁合并的角色),Allowed to push: Maintainer(指定允许谁推送的角色)——Protect即可开启了保护分支。
7.gitlab管理员root开启邮箱认证功能(不允许随便一个用户就能注册gitlab账号)
作用:用户注册时,填写注册邮箱,点击注册后,需要先登录自己填写的邮箱进行验证确认后才可注册完gitlab账号进行登录。
root管理员登录gitlab后,点击Admin area——Settings——Sign-up restrictions——勾选:Send confirmation email on sign-up——点击save changes即可。
8.gitlab管理员root创建一个组,将普通用户加入该组,该普通用户就拥有了改组的权限
创建组:test1:
root管理员登录gitlab后,点击Groups——Expolore groups——New group——Group path: http://.....git: test1(填写组名),权限:默认私有即可——Create group即可。
邀请成员:shi2:
root管理员登录gitlab后,点击Groups——Your groups——选择创建的组test1——members——在Add new member to test1处:搜索填写要加入该组的成员shi2,分配所需要的权限——Add to group即可。因为配置了邮件服务,该普通用户会收到一封加入组的通知邮件,不用同意确认,只是通知信息邮件。
9.gitlab管理员root在创建的组test1里创建项目仓库:
root管理员登录gitlab后,点击Groups——Your groups——选择创建的组test1——Overview——Details——New project——group-test(填写的项目名),选择权限——Create project即可。
10.开启qq邮箱的smtp服务(建议使用qq邮箱,不建议163邮箱)
登录qq邮箱——设置——账户——找到POP3/IMAP/SMTP… 服务下的:POP3/SMTP服务(…),点击开启——进行手机号(密保验证)——根据提示发短信内容到相应号码(有提示)——发送后点击:我已发送——返回一个授权码,需要保存记下,gitlab.rb配置邮箱服务时候需要用到,授权码是:"txjkxkkocxwqfegf",存下授权码后,点击确定即可。
注意:下面账号都是通用的
管理员用户:root,密码:123456.com,配置文件配置了邮件服务,发邮件人:1441107787@qq.com
普通用户shi,密码:123456789 1036981481@qq.com随意一个邮箱(开启邮箱验证前可以随便注册的邮箱)
普通用户shi2,密码:1234567890 1036981484@qq.com (开启邮箱验证后,需要通过验证才可以注册的邮箱)
11.gitlab设置保护分支master,普通用户需要创建合并请求并经过管理员同意后才能合并到master分支
概述:gitlab开启分支保护功能和邮箱验证功能和配置邮件服务,普通用户shi2先在本地修改代码,然后合并本地dev分支到本地master上,切换到本地master分支直接推送到远程gitlab的master分支不允许,需要在本地dev分支上先推送到远程gitlab的dev分支,然后登陆gitlab自己的的账号后创建合并请求并自动给gitlab管理员root发邮件,root管理员合并请求后,才可合并代码到远端的gitlab的master分支。
1)开启qq邮箱的smtp服务(建议使用qq邮箱,不建议163邮箱)
登录qq邮箱——设置——账户——找到POP3/IMAP/SMTP… 服务下的:POP3/SMTP服务(…),点击开启——进行手机号(密保验证)——根据提示发短信内容到相应号码(有提示)——发送后点击:我已发送——返回一个授权码,需要保存记下,gitlab.rb配置邮箱服务时候需要用到,授权码是:"txjkxkkocxwqfegf",存下授权码后,点击确定即可。
2)gitlab配置邮件服务:
[root@localhost ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.224.130' #若改变端口:http://192.168.224.130:8888 #此后是gitlab访问地址(仓库地址)
……
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com" #修改成使用qq邮箱服务
gitlab_rails['smtp_port'] = 465 #qq邮箱的端口默认465,不用修改
gitlab_rails['smtp_user_name'] = "1441107787@qq.com" #开启smtp服务的qq邮箱
gitlab_rails['smtp_password'] = "txjkxkkocxwqfegf" #qq邮箱开启密保验证时返回的授权码,需要配置qq邮箱开启smtp服务时生成
gitlab_rails['smtp_domain'] = "qq.com" #域名,qq邮箱的域名
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true #修改成true
……
user['git_user_email'] = "1441107787@qq.com" #修改成开启smtp服务的qq邮箱
gitlab_rails['gitlab_email_from'] = '1441107787@qq.com' #修改成开启smtp服务的qq邮箱,作为发件者
wq
[root@localhost ~]# gitlab-ctl reconfigure
3)测试邮箱服务功能:
[root@localhost ~]# gitlab-rails console #进入控制台(比较慢)
irb(main):001:0> Notify.test_email('1036981484@qq.com','this is title','hello').deliver_now #回车即可
上面是指定收件人的邮箱,使用配置的发件人1441107787@qq.com给收件人:1036981484@qq.com 邮箱发消息
此时:收件人1036981484@qq.com会收到邮件,表示邮件服务配置成功。
4)gitlab管理员root开启邮箱认证功能(不允许随便一个用户就能注册gitlab账号)
作用:用户注册时,填写注册邮箱,点击注册后,需要先登录自己填写的邮箱进行验证确认后才可注册完gitlab账号进行登录。
root管理员登录gitlab后,点击Admin area——Settings——Sign-up restrictions——勾选:Send confirmation email on sign-up——点击save changes即可。
5)用户在gitlab创建一个仓库并将添加普通用户成员shi2管理仓库的权限(先以root用户初始化仓库的两个分支)
[root@localhost ~]# yum -y install git #客户端机器,也可用服务器作为客户端
[root@localhost ~]# git config --global user.name "Administrator"
[root@localhost ~]# git config --global user.email "admin@example.com"
[root@localhost ~]# mkdir /test1
[root@localhost ~]# cd /test1/
[root@localhost test1]# ls -a
. ..
[root@localhost test1]# git clone http://192.168.224.130/root/test.git
输入root用户名和密码:123456.com
[root@localhost test1]# ls -a
. .. test
[root@localhost test1]# ls test/
空 #克隆的空仓库
[root@localhost test1]# cd test/
[root@localhost test]# echo 111 > 1.txt
[root@localhost test]# ls
1.txt
[root@localhost test]# git add .
[root@localhost test]# git commit -m "add 1.txt"
[root@localhost test]# git push http://192.168.224.130/root/test.git master #推送到远程仓库master分支
输入root用户名和密码:123456.com
[root@localhost test]# git checkout -b dev #从master再创建一个新分支dev
Switched to a new branch 'dev'
[root@localhost test]# git branch
* dev
master
[root@localhost test]# ls
1.txt
[root@localhost test]# cat 1.txt
111
[root@localhost test]# git push http://192.168.224.130/root/test.git dev
输入root用户名和密码:123456.com
6)远程仓库即可查看到推送来的文件,并且有两个分支了:master和dev分支
7)给仓库中加入成员shi2: 权限;Developer权限,权限不能太大了。此时用户shi2即有了该仓库的权限。
8)给项目设置保护分支:
先进入指定仓库——Settings——Repository——Protected Branches(点击Expand进入),填写选择要保护的分支:Master,Allowed to merge: Maintainer(指定谁合并的角色),Allowed to push: Maintainer(指定允许谁推送的角色)——Protect即可开启了保护分支。
客户端本地开发代码后,通过直接push到远程gitlab的master分支没有权限:(shi2用户)
1)远端gitlab的master仓库设置了保护,直接合并到master,没有权限合并
[root@localhost test]# pwd
/test1/test
[root@localhost test]# git branch
* dev
master
[root@localhost test]# ls
1.txt
[root@localhost test]# echo 2222 > 2.txt
[root@localhost test]# ls
1.txt 2.txt
[root@localhost test]# git add .
[root@localhost test]# git commit -m "add 2.txt"
[root@localhost test]# git checkout master
[root@localhost test]# ls
1.txt
[root@localhost test]# git merge dev
[root@localhost test]# ls
1.txt 2.txt
[root@localhost test]# git push http://192.168.224.130/root/test.git master #使用shi2用户无法直接合并到远程master分支
Username for 'http://192.168.224.130': shi2
Password for 'http://shi2@192.168.224.130': 输入密码:1234567890
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 268 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: You are not allowed to push code to protected branches on this project.
To http://192.168.224.130/root/test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://192.168.224.130/root/test.git'
[root@localhost test]# git checkout dev
[root@localhost test]# ls
1.txt 2.txt
[root@localhost test]# git push http://192.168.224.130/root/test.git dev #可以推送到远程的dev分支
Username for 'http://192.168.224.130': shi2
Password for 'http://shi2@192.168.224.130': 输入密码:1234567890
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 268 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for dev, visit:
remote: http://192.168.224.130/root/test/merge_requests/new?merge_request%5Bsource_branch%5D=dev
remote:
To http://192.168.224.130/root/test.git
7f83857..8837af6 dev -> dev
2)shi2用户登录gitlab,创建合并请求:
Shi2用户登录gitlab——进入该项目——Repository——Files——选项dev分支(要合并的分支)——点击Create merge request即可。此时管理员邮箱:1441107787@qq.com正常会收到一封提醒邮件,有时可能网络原因收不到,也无所谓,只是一个提醒邮件,即是没有收到邮件,登录管理员的gitlab账号也能看到合并请求的信息。
3)管理员root账号登录gitlab同意合并请求:
管理员root登录gitlab后,进入该项目——Merge Requests——点开open处,——可看到请求合并的消息,点击请求标题进去,——可以点击Merge或选择Merge imadiately版本不同可能有出入——点击后,即可查看出合并状态,到master分支查看,是否已经合并过来即可。
如果审核有错误,可以提交评论,让开发修改,填写评论后,点击comment,可以给开发者的gitlab普通账号shi2留言(shi2用户登录gitlab账号即可查看到),同时因为配置了邮件服务,还给开发者的邮箱发送提醒邮件。
如果对运维课程感兴趣,可以在b站上或csdn上搜索我的账号: 运维实战课程,可以关注我,学习更多免费的运维实战技术视频
相关推荐
- 或者这些Joplin插件也可以帮助你的笔记应用再一次强大
-
写在前面距离上次分享《搭建私有全平台多端同步笔记,群晖NAS自建JoplinServer服务》已过去一段时间,大家是否开始使用起来了呢?如果你和我一样已经使用过Joplin有一段时间了,那或许你也会...
- Three.JS教程4 threejs中的辅助类
-
一、辅助类简介Three.js提供了一些辅助类(Helpers)以帮助我们更容易地调试、可视化场景中的元素。ArrowHelepr:创建箭头辅助器;AxisHelper:创建坐标轴辅助器;BoxH...
- 第2章 还记得点、线、面吗(二)(第二章还能敲钟吗)
-
glbgltf模型(webvrmodel)-gltf模型下载定制,glb模型下载定制,三维项目电商网站在线三维展示,usdz格式,vr模型网,网页VR模型下载,三维模型下载,webgl网页模型下载我...
- 如何检查Linux系统硬件信息?从CPU到显卡,一网打尽!
-
你可能会问:“我为什么要关心硬件信息?”答案很简单:硬件是Linux系统的根基,了解它可以帮你解决很多实际问题。比如:性能调优:知道CPU核心数和内存大小,才能更好地调整程序运行参数。故障排查:系统卡...
- SpriteJS:图形库造轮子的那些事儿
-
从2017年到2020年,我花了大约4年的时间,从零到一,实现了一个可切换WebGL和Canvas2D渲染的,跨平台支持浏览器、SSR、小程序,基于DOM结构和支持响应式的,高...
- 平时积累的FPGA知识点(6)(fpga经典应用100例)
-
平时在FPGA群聊等积累的FPGA知识点,第六期:1万兆网接口,发三十万包,会出现掉几包的情况,为什么?原因:没做时钟约束,万兆网接口的实现,本质上都是高速serdes,用IP的话,IP会自带约束。...
- 芯片逻辑调度框架设计 都需要那些那些软件工具
-
设计芯片逻辑调度框架通常需要使用以下软件工具:1.逻辑设计工具:例如Vivado、Quartus、SynopsysDesignCompiler等,用于设计和实现逻辑电路。2.仿真工具:例如Mo...
- ZYNQ与DSP之间EMIF16通信(正点原子领航者zynq之fpga开发指南v3)
-
本文主要介绍说明XQ6657Z35-EVM高速数据处理评估板ZYNQ与DSP之间EMIF16通信的功能、使用步骤以及各个例程的运行效果。[基于TIKeyStone架构C6000系列TMS320C6...
- 好课推荐:从零开始大战FPGA(从零开始的冒险4399)
-
从零开始大战FPGA引子:本课程为“从零开始大战FPGA”系列课程的基础篇。课程通俗易懂、逻辑性强、示例丰富,课程中尤其强调在设计过程中对“时序”和“逻辑”的把控,以及硬件描述语言与硬件电路相对应的“...
- 业界第一个真正意义上开源100 Gbps NIC Corundum介绍
-
来源:内容由「网络交换FPGA」编译自「FCCM2020」,谢谢。FCCM2020在5月4日开始线上举行,对外免费。我们有幸聆听了其中一个有关100G开源NIC的介绍,我们对该文章进行了翻译,并对其中...
- 高层次综合:解锁FPGA广阔应用的最后一块拼图
-
我们为什么需要高层次综合高层次综合(High-levelSynthesis)简称HLS,指的是将高层次语言描述的逻辑结构,自动转换成低抽象级语言描述的电路模型的过程。所谓的高层次语言,包括C、C++...
- Xilinx文档编号及其内容索引(部分)
-
Xilinx文档的数量非常多。即使全职从事FPGA相关工作,没有几年时间不可能对器件特性、应用、注意事项等等有较为全面的了解。本文记录了我自使用Xilinx系列FPGA以来或精读、或翻阅、或查询过的文...
- Xilinx Vivado联合Modelsim软件仿真
-
引言:Xilinx公司Vivado开发软件自带仿真工具,可以实现一般性能的FPGA软件仿真测试,其测试执行效率以及性能都不如第三方专用仿真软件Modelsim强。本文我们介绍下如何进行Vivado20...
- 体育动画直播是怎么做出来的?从数据到虚拟赛场的科技魔法!
-
你是否见过这样的比赛直播?没有真实球员,却能看梅西带球突破?足球比赛变成动画版,但数据100%真实?电竞比赛用虚拟形象直播,选手操作实时同步?这就是体育动画直播——一种融合实时数据、游戏引擎和AI的...
- Dialogue between CPC and political parties of neighboring countries held in Beijing
-
BEIJING,May26(Xinhua)--TheCommunistPartyofChina(CPC)inDialoguewithPoliticalPartiesof...
- 一周热门
- 最近发表
- 标签列表
-
- mybatiscollection (79)
- mqtt服务器 (88)
- keyerror (78)
- c#map (65)
- resize函数 (64)
- xftp6 (83)
- bt搜索 (75)
- c#var (76)
- mybatis大于等于 (64)
- xcode-select (66)
- mysql授权 (74)
- 下载测试 (70)
- linuxlink (65)
- pythonwget (67)
- androidinclude (65)
- libcrypto.so (74)
- logstashinput (65)
- hadoop端口 (65)
- vue阻止冒泡 (67)
- jquery跨域 (68)
- php写入文件 (73)
- kafkatools (66)
- mysql导出数据库 (66)
- jquery鼠标移入移出 (71)
- 取小数点后两位的函数 (73)