RHEL7 部署 汉化版 gitlab

一、获取gitlab汉化包(要部署非汉化版,可以跳过这一块内容)

1、安装git

yum install -y git


2、克隆获取汉化版本库

git clone https://gitlab.com/xhang/gitlab.git

如果是要下载老版本的汉化包,需要加上老版本的分支,比如今天已经是10.4.2,我依旧想下载10.0.2,可以运行下面的语句

git clone https://gitlab.com/xhang/gitlab.git -b v10.0.2-zh


3、查看该汉化补丁的版本

cat gitlab/VERSION


二、部署社区版gitlab

1、安装gitlab的依赖项

yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python


2、启动postfix,并设置为开机启动 

systemctl start postfix
systemctl enable postfix

3、设置防火墙 

firewall-cmd --add-service=http --permanent
firewall-cmd --reload


4、获取gitlab的rpm包

途径1:通过清华开源镜像站

   查看清华开源镜像站,有我需要的10.4.2的rpm包。

获取rpm包 

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.4.2-ce.0.el7.x86_64.rpm

途径2:从官方获取RPM包后上传到/root目录下

  官方下载:https://packages.gitlab.com/gitlab/gitlab-ce/


5、安装rpm包

rpm -ivh gitlab-ce-10.4.2-ce.0.el7.x86_64.rpm


6、修改配置文件gitlab.rb

vim /etc/gitlab/gitlab.rb
将external_url变量的地址修改为gitlab所在服务器的ip地址。

因为修改了配置文件,故需要重新加载配置内容。

gitlab-ctl reconfigure
gitlab-ctl restart

6、查看gitlab版本 

head -1 /opt/gitlab/version-manifest.txt

三、覆盖汉化包

1、停止gitlab服务

gitlab-ctl stop


2、切换到gitlab汉化包所在的目录(即步骤一获取的汉化版gitlab) 

cd /root/gitlab

3 比较汉化标签和原标签,导出 patch 用的 diff 文件到/root下 

git diff v10.4.2 v10.4.2-zh > ../10.4.2-zh.diff


4、回到/root目录

cd

5、将10.4.2-zh.diff作为补丁更新到gitlab中 

yum install patch -y
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.4.2-zh.diff

6、启动gitlab

gitlab-ctl start


7、重新配置gitlab 

gitlab-ctl reconfigure

四、设置管理员密码

   管理员账号登录的用户名:root

   (虽然登录后管理员的用户名为Administrator,但是实际登录的用户名是root)

方法一:网页方式

   浏览器访问gitlab所在的ip,输入密码后点击 “Change your password”(如果进行汉化,点击“修改密码”)。

方法二:指令方式

gitlab-rails console production        #这里要稍等一会
irb(main):001:0> user = User.where(id: 1).first     // id为1的是超级管理员
irb(main):002:0>user.password = 'yourpassword' // 密码必须至少8个字符
irb(main):003:0>user.save! // 如没有问题 返回true
exit                                               // 退出

猜你喜欢

转载自blog.csdn.net/yan7895566/article/details/79299331