扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
系统运维
环境centos7,内存至少4G,Gitlab还是挺耗内存的。
GitHub安装参考:https://about.gitlab.com/install/
组件安装参考:https://docs.gitlab.com/ce/development/architecture.html
安装
配置Yum源
使用国内的软件镜像站,这里使用清华大学开源软件镜像站。
cat /etc/yum.repos.d/tsinghua.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
安装
安装相关依赖
yum install curl policycoreutils-python openssh-server
然后执行更新包缓存并安装
yum makecache
yum install gitlab-ce
当安装最后出现一只狐狸头像时,说明安装成功。
启动配置
目录结构
/opt/gitlab 主目录
/etc/gitlab/ 配置文件目录
/var/log/gitlab/ 日志目录
修改配置
vim /etc/gitlab/gitlab.rb
external_url \'http://10.10.10.55\' #这如果nginx 修改端口,external_url 里面也必须带端口
gitlab_rails[\'time_zone\'] = \'Asia/Shanghai\' #时区
unicorn[\'worker_processes\'] = 4 #依据服务器CPU核数
nginx[\'listen_port\'] = 80 #默认Nginx端口80,这里使用gitlab已有的Nginx服务,当然也可使用自己安装的Nginx服务。
修改完配置后需执行,使配置重新加载:
gitlab-ctl reconfigure
gitlab启动:gitlab-ctl start
gitlab查看状态:gitlab-ctl status
run: alertmanager: (pid 28348) 10561s; run: log: (pid 16612) 18335s
run: gitaly: (pid 28362) 10561s; run: log: (pid 16611) 18335s
run: gitlab-exporter: (pid 28383) 10560s; run: log: (pid 16617) 18335s
run: gitlab-workhorse: (pid 28398) 10560s; run: log: (pid 16604) 18335s
run: grafana: (pid 28407) 10559s; run: log: (pid 16621) 18335s
run: logrotate: (pid 9348) 3359s; run: log: (pid 16616) 18335s
run: nginx: (pid 28426) 10559s; run: log: (pid 16613) 18335s
run: node-exporter: (pid 28510) 10558s; run: log: (pid 16619) 18335s
run: postgres-exporter: (pid 28516) 10558s; run: log: (pid 16618) 18335s
run: postgresql: (pid 28523) 10557s; run: log: (pid 16615) 18335s
run: prometheus: (pid 28532) 10557s; run: log: (pid 16599) 18335s
run: Redis: (pid 28550) 10556s; run: log: (pid 16596) 18335s
run: redis-exporter: (pid 28554) 10556s; run: log: (pid 16605) 18335s
run: sidekiq: (pid 28563) 10556s; run: log: (pid 16614) 18335s
run: unicorn: (pid 28569) 10555s; run: log: (pid 16603) 18335s
登录Gitlab
Gitlab默认用户root,第一次登录提示修改密码
git clone https://gitlab.com/xhang/gitlab.git
2.查看clone下载汉化本补丁版本
# cat /opt/src/gitlab/VERSION
12.3.5
3.停止gitlab
gitlab-ctl stop
4.查看已安装的版本:
head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 12.4.2
5.获取汉化包:
cd /opt/src/gitlab
git diff origin/12.3.5-stable origin/12.3.5-stable-zh > /tmp/12.3.5.diff
6.更新补丁到gitlab中:
# yum -y install patch
cd /tmp/
#patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 12.3.5.diff
执行安装patch如果出现如下问题,直接跳过,即一直回车跳过。是因为补丁包有一些较新的补丁文件,gitlab上没有这些文件。
can\'t find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js
|index 976d32a..7967edb 100644
|--- a/app/assets/javascripts/awards_handler.js
|+++ b/app/assets/javascripts/awards_handler.js
7.重新加载配置并启动Gitlab:
gitlab-ctl reconfigure & gitlab-ctl start
重新登录Gitlab。
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流