一、获取gitlab汉化包
1.1 安装git
yum install -y git
1.2 克隆获取汉化版本库
下载最新的汉化包
git clone https://gitlab.com/xhang/gitlab.git
如果是要下载老版本的汉化包,需要加上老版本的分支,比如今天已经是10.0.4,我依旧想下载10.0.2,可以运行下面的语句
git clone https://gitlab.com/xhang/gitlab.git -b v10.0.2-zh
1.3 查看该汉化补丁的版本
cat gitlab/VERSION
二、部署社区版gitlab
2.1 安装gitlab的依赖项
yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python
// 10.x以后开始依赖policycoreutils-python,我之前在使用9.x时还没有依赖该项。
2.2 启动postfix,并设置为开机启动
systemctl start postfix
systemctl enable postfix
2.3 设置防火墙
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
2.4 获取gitlab的rpm包
通过清华开源镜像站
查看清华开源镜像站,有我需要的10.0.2的rpm包。
获取rpm包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm
2.5 安装rpm包
rpm -i gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm
根据提示,继续执行指令配置gitlab。
gitlab-ctl reconfigure
如果死掉
1、按住CTRL+C强制结束;
2、运行:sudo systemctl restart gitlab-runsvdir;
3、再次执行:sudo gitlab-ctl reconfigure
2.6 修改配置文件gitlab.rb
vim /etc/gitlab/gitlab.rb
external_url 'http://39.106.154.53:8050'
unicorn['port'] = 8051
因为修改了配置文件,故需要重新加载配置内容。
gitlab-ctl reconfigure
gitlab-ctl restart
2.7 查看gitlab版本
head -1 /opt/gitlab/version-manifest.txt
三、覆盖汉化包
3.1 停止gitlab服务
gitlab-ctl stop
3.2 切换到gitlab汉化包所在的目录(即步骤二获取的汉化版gitlab)
cd /root/gitlab
3.3 比较汉化标签和原标签,导出 patch 用的 diff 文件到/root下
git diff v10.0.2 v10.0.2-zh > ../10.0.2-zh.diff
3.4 回到/root目录
cd
3.5 将10.0.2-zh.diff作为补丁更新到gitlab中
yum install patch -y
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.0.2-zh.diff
3.6 启动gitlab
gitlab-ctl start
3.7 重新配置gitlab
gitlab-ctl reconfigure
等一会,进入gitlab,安装完毕。
-----------------------------------------------------
整体操作涉及命令简化合集
--------------------gitlab---------------------------
sudo gitlab-ctl stop
sudo rpm -e gitlab-ce
ps -ef|grep gitlab
kill -9 4572
ps -ef|grep gitlab
find / -name *gitlab*|xargs rm -rf #多跑几遍
git clone https://gitlab.com/xhang/gitlab.git
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.8.2-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-10.8.2-ce.0.el7.x86_64.rpm
gitlab-ctl reconfigure
如果死掉
1、按住CTRL+C强制结束;
2、运行:sudo systemctl restart gitlab-runsvdir;
3、再次执行:sudo gitlab-ctl reconfigure
vim /etc/gitlab/gitlab.rb
external_url 'http://139.106.154.153:8050'
unicorn['port'] = 8051
gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-ctl stop
cd /root/gitlab
cat gitlab/VERSION
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
git diff v10.8.2 v10.8.2-zh > ../10.8.2-zh.diff
cd
yum install patch -y
ls
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.8.2-zh.diff
gitlab-ctl start
gitlab-ctl reconfigure
gitlab-ctl restart
等一会,进入gitlab
http://139.106.154.153:8050/
--------------------gitlab---------------------------