环境 centos7.6,gitlab-ce 12.3.5版本
①了解gitlab的服务构成
②了解gitlab的优点
一:1.1安装依赖包
yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python
1.2:启动postfix,设置为开启自启
systemctl start postfix
systemctl enable postfix
1.3:设置防火墙规则,重启防火墙,有些需要自行启动防火墙,不然往下会提示web访问失败
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
二:2.1下载安装gitlab rpm包,rpm安装
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm
2.2修改里面的配置文件gitlab.rb
vim /etc/gitlab/gitlab.rb
## GitLab configuration settings
##! This file is generated during initial installation and **is not** modified
##! during upgrades.
##! Check out the latest version of this file to know about the different
##! settings that can be configured by this file, which may be found at:
##! https://gitlab.com/gitlab-org/omnibus-gitlab/raw/master/files/gitlab-config-template/gitlab.rb.template
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
#external_url 'http://gitlab.example.com'
external_url 'http://192.168.3.120:8081' # 修改这个地方为你主机的ip地址,这里我设置了8081端口,不加端口即默认80
重新加载配置文件,重新启动gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
2.3接下来我们就可以在浏览器输入http://192.168.3.120:8081
进去后会叫你修改密码,如果无法访问出现502
①可能是gitlab端口号被占用,修改为其它端口即可;
②主机内存不足
查看端口情况,找到自己设置的8081端口
netstat -ntpl
以上是正常,如果被其它程序占用即kill -9pid掉
gitlab-ctl restart
重新启动一下即可
二:汉化,ce版需要下载汉化配置文件,ee版则在web端即可实现汉化(自带)
2.1查看gitlab版本,注意汉化版本需与安装的gitlab版本一致
head -1 /opt/gitlab/version-manifest.txt
git clone https://gitlab.com/xhang/gitlab.git -b v12.3.5-zh
进入刚刚clone下来的目录
cd gitlab/
用diff将英文原版与中文版的对比生成.diff文件
git diff v12.3.5 v12.3.5-zh > /root/v12.3.5-zh.diff
[root@gitlab gitlab]# gitlab-ctl stop #停止gitlab
[root@gitlab gitlab]# yum -y install patch
[root@gitlab gitlab]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../v12.3.5-zh.diff
#将刚才的diff文件做为补丁导入到gitlab中
#该命令执行过程中,输入一次y然后一路回车跳过即可
[root@gitlab gitlab]# gitlab-ctl start #启动gitlab
[root@gitlab gitlab]# gitlab-ctl reconfigure #重新配置gitlab
2.2web访问gitlab即可成功,如果还是无法访问就把防火墙重启一下,有些只是部分汉化了,需要自行到偏好设置里去调一下,切换为中文即可