DEVOPS工具之gitlab搭建

gitlab是什么?他有什么作用呢?

gitlab是一个开源的git仓库管理软件,并提供web界面,方便管理git仓库。和github很相似,不过github暂时没有开源版本,项目必须托管到github官方网站,不能本地部署。很多公司考虑到安全费用等因素,搭建自己的gitlab服务器。下面我将一步一步教大家搭建自己的gitlab服务器。我使用的linux版本是centos7。

如果只是学习,可以自己搭建VmWare虚拟服务器,安装centos7系统,小编有完整的虚拟机安装教程,以及系统安装资源,请加关注并且私信我,即可免费获取。如果对你有些许帮助,欢迎分享转发。

/etc/gitlab/gitlab.rb          #gitlab配置文件
/opt/gitlab                    #gitlab的程序安装目录
/var/opt/gitlab                #gitlab目录数据目录
/var/opt/gitlab/git-data       #存放仓库数据
gitlab-ctl reconfigure         #重新加载配置
gitlab-ctl status              #查看当前gitlab所有服务运行状态
gitlab-ctl stop                #停止gitlab服务
gitlab-ctl stop nginx          #单独停止某个服务
gitlab-ctl tail                #查看所有服务的日志

Gitlab的服务构成:
nginx:                 静态web服务器
gitlab-workhorse        轻量级反向代理服务器
logrotate              日志文件管理工具
postgresql             数据库
redis                  缓存数据库
sidekiq                用于在后台执行队列任务(异步执行

安装启动

[root@localhost ~]# yum install -y curl policycoreutils-python openssh-server #安装依赖-- 选择性安装,可以先不装

[root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm #下载安装软件包
[root@localhost ~]# rpm -ivh gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm #安装gitlab
[root@localhost ~]# vim /etc/gitlab/gitlab.rb #编辑配置文件
external_url 'http://192.168.1.21' #然后找到external_url改为服务器自己的IP地址
[root@localhost ~]# gitlab-ctl reconfigure #重新加载配置文件
安装成功。访问192.168.1.21会让设置初始密码,设置后即可登录。记得换成自己服务器ip
第二种安装方式:也可以手动下载后,将安装包上传至服务器。执行yum install gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm

汉化

第二种汉化选择: 也可以生成补丁包进行汉化
如果没有git,先安装git执行
[root@localhost ~]# yum install git
1、下载汉化补丁
[root@localhost ~]# git clone https://gitlab.com/xhang/gitlab.git
[root@localhost ~]# cd gitlab
2、查看全部分支版本
[root@localhost ~]# git branch -a
3、对比版本、生成补丁包
[root@localhost ~]# git diff remotes/origin/10-2-stable remotes/origin/10-2-stable-zh > /tmp/10.2.2-zh.diff
4、停止服务器
[root@localhost ~]# gitlab-ctl stop
5、打补丁
[root@localhost ~]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /tmp/10.2.2-zh.diff
6、启动和重新配置
[root@localhost ~]# gitlab-ctl start
[root@localhost ~]# gitlab-ctl reconfigure

具体使用可以参照gitlab说明文档

posted @ 2022-04-29 09:57  清风6661  阅读(220)  评论(0)    收藏  举报