Centos7安装gitlab私服

GitLab简介

GitLab一个开源的git仓库管理平台,方便团队协作开发、管理。在GitLab上可以实现完整的CI(持续集成)、CD(持续发布)流程。而且还提供了免费使用的Plan,以及免费的可以独立部署的社区版本(https://gitlab.com/gitlab-org/gitlab-ce )。
 

准备

安准依赖

#安装技术依赖
yum install -y curl policycoreutils-python openssh-server

远程连接

#启动ssh服务&设置为开机启动(一般都是开启的,如果关闭的请打开)
systemctl enable sshd && systemctl start sshd

安装Postfix

Postfix是一个邮件服务器,GitLab发送邮件需要用到
#安装postfix
yum install -y postfix
 
#启动postfix并设置为开机启动
systemctl enable postfix && systemctl start postfix

防火墙

#为了安全,建议开启防火墙
systemctl enable firewalld && systemctl start firewalld
 
#开放ssh、http服务
firewall-cmd --add-service=ssh --permanent
firewall-cmd --add-service=http --permanent
 
#重载防火墙规则
firewall-cmd --reload

部署

本次部署的是社区版:gitlab-ce,如果要部署商业版可以把关键字替换为:gitlab-ee

Yum安装GitLab

#添加GitLab社区版Package
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
#安装GitLab社区版(通常是仓库中最新的版本)
sudo EXTERNAL_URL="https://192.168.31.120:8888" yum install -y gitlab-ce

配置GitLab站点Url

上面安装的时候也可以指定这个url
当然了也可以不用https
GitLab默认的配置文件路径是/etc/gitlab/gitlab.rb
默认的站点Url配置项是: external_url 'http://gitlab.example.com'
将GitLab站点Url修改为https://IP:PORT
如果自己有域名可以设成自己可解析的域名
#修改配置文件
vi /etc/gitlab/gitlab.rb
 
#配置首页地址
external_url 'https://192.168.31.120:8888'

启动并访问GitLab

#重新配置并启动
gitlab-ctl reconfigure

#开放服务端口
firewall-cmd --zone=public --add-port=8888/tcp --permanent
 
#重载防火墙规则
firewall-cmd --reload
 
#启动 
gitlab
-ctl restart
#访问GitLab https:
//192.168.31.120:8888
这时候会提示为管理员账号设置密码。设置完之后就会跳转到登录页面让你登录。(忘记 截图了)
管理员账号默认username是root。登陆后会进入欢迎界面。

gitlab-ctl常用命令

##检查在gitlab中是否有任何配置。在指定版本中删除的rb
gitlab-ctl check-config
##安装部署页面 gitlab
-ctl deploy-page
##将用户配置与包可用配置进行比较 gitlab
-ctl diff-config
##删除所有用户和组 gitlab
-ctl remove-accounts
##升级 gitlab
-ctl upgrade
##查看所有服务 gitlab
-ctl service-list
##如果GitLab服务停止了就启动服务,如果已启动就不做任何操作 gitlab
-ctl once
##重启GitLab服务 gitlab
-ctl restart
##如果GitLab服务停止了就启动服务,如果已启动就重启服务 gitlab
-ctl start
##停止GitLab服务 gitlab
-ctl stop
##查看GitLab服务状态 gitlab
-ctl status
##重新配置GitLab并启动 gitlab
-ctl reconfigure
 

猜你喜欢

转载自www.cnblogs.com/jockming/p/12229311.html
今日推荐