gitlab 安装_Linux学习14CentOS安装gitlab环境
前言
在学习Gitlab的环境搭建之前,首先需要了解Git,Gitlab,GitHub他们三者之间的关系
Git 它是一个源代码版本控制系统,可让您在本地跟踪更改并从远程资源推送或提取更改。
GitHub 是一项公开可用的免费服务,它要求所有代码(除非您有付费帐户)公开。 任何人都可以看到您推送给GitHub的代码并提供改进建议。
GitLab是一种类似github的服务,组织可以使用它来提供git存储库的内部管理。 它是一个自我托管的Git-repository管理系统,可以保持用户代码的私密性,并且可以轻松地部署代码的更改。
简单来说,github是全世界最大的开源的gay友平台,适合免费公开的代码。gitlab是搭建本公司的代码管理平台,适合私有的平台代码管理。
因为本公司的代码不想被其它人看到,这就需要搭建一个本公司的gitlab平台,供公司内部人员使用。
安装依赖包
GitLab 10.x之后添加多了一些依赖,并且要启动sshd服务,所以我们先添加依赖,启动sshd,为防火墙添加服务
sudo yum install -y curl policycoreutils-python openssh-server openssh-clients sudo systemctl enable sshd sudo systemctl start sshd
# 防火墙这2步可以不用管# sudo firewall-cmd –permanent –add-service=http # sudo systemctl reload firewalld
postfix的产生是为了替代传统的sendmail.相较于sendmail,postfix在速度。性能和稳定性上都更胜一筹。
如今眼下许多的主流邮件服务事实上都在採用postfix. 当我们须要一个轻量级的的邮件server是,postfix不失为一种选择。
postfix想要作用的范围是广大的Internet用户。试图影响大多数的Internet上的电子邮件系统,因此它是免费的。
postfix在性能上大约比sendmail快三倍。一部执行postfix的台式PC每天能够收发上百万封邮件。
postfix是sendmail兼容的,从而使sendmail用户能够非常方便地迁移到postfix。Postfix支持/var[/spool]/mail、/etc/aliases、 NIS、和 ~/.forward 文件。
postfix被设计成在重负荷之下仍然能够正常工作。当处理的邮件数目增长时,postfix执行的进程不会跟着添加。
postfix是由超过一打的小程序组成的,每一个程序完毕特定的功能。
gitlab配置需要用到邮件发送,所以先安装postfix
yum -y install postfix
安装完之后,启动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,修改如下两项,修改之前可以先备份下
# 修改 /etc/postfix/main.cf的设置 inet_protocols = ipv4
inet_interfaces = all
修改完成后,再次启动,就不会报错了,设置postfix为开机自启动
systemctl enable postfix
查看启动状态,看到 Active: active (running) 就是已经正常启动了
[root@yoyo ~]# systemctl status postfix
完整的操作如下
[root@yoyo ~]# yum -y install policycoreutils-python openssh-server openssh-clients[root@yoyo ~]# systemctl enable sshd [root@yoyo ~]# systemctl start sshd[root@yoyo ~]# yum -y install postfix[root@yoyo ~]# 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.
[root@yoyo ~]# cp /etc/postfix/main.cf /etc/postfix/main.cf.bak
[root@yoyo ~]# vim /etc/postfix/main.cf
# 修改inet_protocols = ipv4 和inet_interfaces = all
[root@yoyo ~]# systemctl start postfix
[root@yoyo ~]# systemctl enable postfix[root@yoyo ~]# systemctl status postfix
● postfix.service - Postfix Mail Transport AgentLoaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)Active: active (running) since Tue 2019-01-15 15:37:28 CST; 5min agoProcess: 3171 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)Process: 3167 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)Process: 3164 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)Main PID: 3244 (master)CGroup: /system.slice/postfix.service├─3244 /usr/libexec/postfix/master -w├─3245 pickup -l -t unix -u└─3246 qmgr -l -t unix -uJan 15 15:37:27 yoyo systemd[1]: Starting Postfix Mail Transport Agent...
Jan 15 15:37:28 yoyo postfix/postfix-script[3242]: starting the Postfix mail system
Jan 15 15:37:28 yoyo postfix/master[3244]: daemon started -- version 2.10.1, configuration /etc/postfix
Jan 15 15:37:28 yoyo systemd[1]: Started Postfix Mail Transport Agent.
[root@yoyo ~]#
gitlab安装
GitLab官方文档中有多种安装方式,分别为deb,rpm,node,python,gem。详情请看:https://packages.gitlab.com/gitlab/gitlab-ce/install
centos 7系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
找个最新版去下载gitlab-ce-11.6.3-ce.0.el7.x86_64.rpm
下载rpm包并安装
[root@yoyo ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
[root@yoyo ~]# mkdir /usr/local/gitlab
[root@yoyo ~]# mv gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm /usr/local/gitlab/
[root@yoyo ~]# cd /usr/local/gitlab/
[root@yoyo gitlab]# rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
warning: gitlab-ce-11.6.3-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:policycoreutils-python is needed by gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm# 如果出现上面这个报错就执行yum install policycoreutils-python
[root@yoyo gitlab]# yum -y install policycoreutils-python[root@yoyo gitlab]# rpm -i gitlab-ce-11.6.3-ce.0.el7.x86_64.rpm
warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
It looks like GitLab has not been configured yet; skipping the upgrade script.*. *.*** ******** *****.****** *************** ********,,,,,,,,,***********,,,,,,,,,,,,,,,,,,,,*********,,,,,,,,,,,.,,,,,,,,,,,*******,,,,,,,,,,,,,,,,,,,,,*****,,,,,,,,,.,,,,,,,****,,,,,,.,,,***,,,,,*,._______ __ __ __/ ____(_) /_/ / ____ _/ /_/ / __/ / __/ / / __ `/ __ \/ /_/ / / /_/ /___/ /_/ / /_/ /\____/_/\__/_____/\__,_/_.___/Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:sudo gitlab-ctl reconfigureFor a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
安装完成之后,会出现gitlab官方文档地址https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
配置并启动gitlab-ce
gitlab安装完成后,需要设置一个访问地址(或域名),打开/etc/gitlab/gitlab.rb
,将默认的external_url = 'http://git.example.com'
修改为自己的IP地址:http://xxx.xx.xxx.xx
[root@yoyo conf]# vim /etc/gitlab/gitlab.rb
原来默认的external_url
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url 'http://git.example.com'
修改成自己定义的url地址,端口自己设置一个,别和已有的冲突了
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url 'http://47.104.x.x:8100'
修改完成后:wq保存退出,执行以下命令,让配置生效
[root@yoyo conf]# gitlab-ctl reconfigure
启动Gitlab
[root@yoyo conf]# gitlab-ctl start
[root@yoyo ~]# gitlab-ctl start
ok: run: gitaly: (pid 6638) 186s
ok: run: gitlab-monitor: (pid 6656) 186s
ok: run: gitlab-workhorse: (pid 6659) 186s
ok: run: logrotate: (pid 6703) 185s
ok: run: nginx: (pid 6709) 185s
ok: run: node-exporter: (pid 6715) 184s
ok: run: postgres-exporter: (pid 6720) 184s
ok: run: postgresql: (pid 7324) 44s
ok: run: prometheus: (pid 6752) 171s
ok: run: redis: (pid 6761) 171s
ok: run: redis-exporter: (pid 6765) 170s
ok: run: sidekiq: (pid 7299) 45s
ok: run: unicorn: (pid 7476) 18s
启动完成后,在浏览器输入http://47.104.x.x:8100
,就是gitlab的登录首页了,如果出现502页面,需修改默认的8080端口
502问题
打开gitlab首页出现502问题
出现这个问题,主要是因为8080端口被占用,之前安装tomcat默认的是8080端口,netstat -ntpl查看端口情况
[root@yoyo ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9100 0.0.0.0:* LISTEN 6715/node_exporter
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 801/java
tcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 6709/nginx: master
tcp 0 0 127.0.0.1:9121 0.0.0.0:* LISTEN 6765/redis_exporter
tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN 6752/prometheus
tcp 0 0 127.0.0.1:9187 0.0.0.0:* LISTEN 6720/postgres_expor
tcp 0 0 0.0.0.0:8100 0.0.0.0:* LISTEN 6709/nginx: master
tcp 0 0 127.0.0.1:8101 0.0.0.0:* LISTEN 7495/unicorn master
tcp6 0 0 :::3306 :::* LISTEN 1370/mysqld
杀掉8080端口即可,8080端口对应的pip是801
[root@yoyo ~]# kill -9 801
重启下服务,刷新页面就可以访问了
[root@yoyo ~]# gitlab-ctl restart
为了避免8080端口冲突问题,可以修改下unicorn的默认端口,vim打开/etc/gitlab/gitlab.rb配置文件
新增一项unicorn[‘port’] = 8101,修改后内容如下
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url 'http://47.104.x.x:8100'unicorn['port'] = 8101
修改完成后:wq保存退出,执行gitlab-ctl reconfigure命令,让配置生效,再重新启动服务
[root@yoyo conf]# gitlab-ctl reconfigure
[root@yoyo conf]# gitlab-ctl stop
[root@yoyo conf]# gitlab-ctl start
接着在浏览器访问就能看的gitlab登录首页了
gitlab配置查看
gitlab的配置主要是etc/gitlab/gitlab.rb下的两个地方
external_url 'http://47.104.x.x:8100'unicorn['port'] = 8101
查看更多配置信息可以,在/opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml查看具体的详情
gitlab:## Web server settings (note: host is the FQDN, do not include http://)host: 47.104.x.xport: 8100https: false
相关操作
启动服务:gitlab-ctl start
查看状态:gitlab-ctl status
停掉服务:gitlab-ctl stop
重启服务:gitlab-ctl restart
让配置生效:gitlab-ctl reconfigure
2019年《python全栈自动化测试课程》2月16号开学!
主讲老师:上海-悠悠
上课方式:QQ群视频在线教学
上课时间:每周六、周日晚上20:30-22:30
2019年《python全栈自动化测试课程》2月16号开学!
gitlab 安装_Linux学习14CentOS安装gitlab环境相关推荐
- linux g++ 关闭 ‘typedef’ 警告_Linux学习13CentOS安装mysql5.6环境
前言 在linux上安装mysql5.6版本,并远程连接mysql数据库操作 安装mysql mysql的安装可以用yum安装更方便 [root@yoyo ~]# cd /usr/local/ [ro ...
- python pyplot安装_Python学习-windows安装Python以及matplotlib.pyplot包
引文: Python自带了许多的库文件,其中matplotlib可以做出类似于MATLAB和R语言一样绘制出很好的图形功能,下面介绍下怎么安装这个包,因为自己安装的时候很多地方都出错了. 环境: Wi ...
- linux网卡驱动离线安装_linux系统如何安装网卡驱动
linux系统如何安装网卡驱动 很多初学者都觉得能够在自己的笔记本上安装linux系统是一件很酷的事情,结果两个小时安装好linux系统,却发现缺少各种驱动, 为了让各位少走一些弯路,小编在这里把li ...
- httpd svn 编译安装_linux下php7安装与Apache配置
1 php 1.1 准备工作 需要先安装Apache,已安装的可以跳过,没安装的可以看这里. 1.2 下载 官网 1.3 解压 tar -zxvf php-7.4.3.tar.gz cd php-7 ...
- docker 安装mysql_docker学习4docker安装mysql环境
前言 docker安装mysql环境非常方便,简单的几步操作就可以了 拉取mysql镜像 先拉取mysql的镜像,可以在docker的镜像仓库找到不同TAG标签的版本https://hub.docke ...
- 学习linux要会mysql吗_linux 学习 mysql安装到连接
初始化和配置 顺序执行以下语句 mysqld mysqld --initialize --user=mysql mysqld --initialize --lower-case-table-names ...
- gdbserver yum 安装_linux gdb怎么安装?
1,先下载最新版本的gdb源代码包,我使用的是gdb-7.6.tar.gz,使用tar命令进行解包(tar -xvzf gdb-7.6.tar.gz),cd进gdb-7.6/gdb目录,使用vi找到r ...
- wxwidget编译安装_linux下编译安装wxWidgets-2.8.12和audacity-2.0.3教程
原创内容,转载请注明出处:https://www.myzhenai.com/thread-15778-1-1.html https://www.myzhenai.com.cn/post/1247.ht ...
- linux php 编译安装_linux下编译安装配置php5.6.30过程
在第一次编译安装php5.6.30失败后,参考了http://www.phpworld.cn/system/php/11.html的一些内容,第二次编译安装成功,特此记录过程. 一.编译安装php5. ...
最新文章
- 【Angular4】英雄指南demo
- 断网,启用网络,关机的实现。
- oracle中怎么用累计,oracle实现累加,累计百分比计算
- windows ftp服务器_ftp客户端软件,推荐6个流行的FTP客户端软件
- mysql运用与实践_MySQL开发与实践 PDF 下载
- 一天一道算法题--5.30---递归
- Cron 触发器及相关内容 (第一部分)
- ROS学习笔记四:理解ROS节点
- 我的博客学习记录一箩筐(每天更新)
- 正弦函数_傅里叶为什么会想到把函数展开为正弦波
- 双系统在linux中修复引导文件,windows ubuntu双系统重装后修复grub引导
- shotcut视频压缩
- 9.3 parity概述
- 520到了,教你做个JavaWeb表白墙小项目
- git name consists only of disallowed characters:
- Java程序设计与项目实战(全程实录)全新上市
- 【计算机网络】数据链路层 : 后退 N 帧协议 GBN ( 滑动窗口 | 发送窗口长度 | “发送方“ 累计确认、超时机制 | “接收方“ 按序接收、确认帧发送机制 | 计算示例 )★
- python基于PHP+MySQL的药店药品进销存管理系统
- Jenkins Windons下安装ChangeLog插件获取Git更新日志
- WinForm的控件二次开发
热门文章
- linux命令行蜂鸣声太大,Linux关闭蜂鸣声
- 性能测试(02)-HttpSampler
- C++设计模式--模板方法模式
- 顺序循环队列队满队空的两种判别方式
- python中文件路径格式_Python应用-临床路径格式转换
- 3.1.4 操作系统之内存的分配与回收
- 逆向查找_CTFer成长之路--一道数独逆向题目解题过程(算法分析、查找线索)...
- C/C++之数据类型
- 全志 系统时间同步到RTC Patch
- mysql重置id排序_列替换法重置MySQL自增长ID排序