一、环境准备
1.1 下载wget
yum install -y vim
yum install -y wget
cd /usr/local
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.1.6-ce.0.el7.x86_64.rpm
1.2 关闭防火墙
CentOS 7.0默认使用的是firewall作为防火墙
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service
查看防火墙状态
firewall-cmd --state (not running为关闭,running为开启)
二、获取GitLab汉化包(要部署非汉化版,可以跳过这一块内容)
2.1 安装Git
yum install -y git
2.2 克隆获取汉化版本库
cd /usr/local
git clone https://gitlab.com/xhang/gitlab.git
三、部署社区版GitLab
3.1 安装GitLab的依赖项
yum -y install policycoreutils openssh-server openssh-clients postfix cronie policycoreutils-python
3.2 启动postfix,并设置为开机启动
service postfix start
chkconfig postfix on
3.3 安装rpm包
cd /usr/local
rpm -ivh gitlab-ce-11.1.6-ce.0.el7.x86_64.rpm
3.4 修改配置文件gitlab.rb
vim /etc/gitlab/gitlab.rb
将external_url变量的地址修改为gitlab所在centos的ip地址 eg:external_url 'http://192.168.157.128:9092'
因为修改了配置文件,故需要重新加载配置内容
gitlab-ctl reconfigure
gitlab-ctl restart
四、覆盖汉化包
4.1 停止GitLab服务
gitlab-ctl stop
4.2 比较汉化标签和原标签,导出 patch 用的 diff 文件到/root下
cd /usr/local/gitlab
git diff v11.1.6 v11.1.6-zh > ../11.1.6-zh.diff
4.3 将10.0.2-zh.diff作为补丁更新到GitLab中
cd /usr/local
yum install patch -y
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 11.1.6-zh.diff
回车覆盖
gitlab-ctl reconfigure
gitlab-ctl restart
gitlab仓库存储位置的修改方法
例如我这里把数据存放到/data/gitlab目录下
1.创建/data/gitlab目录 mkdir -p /data/gitlab
2.修改配置文件路径 vim /etc/gitlab/gitlab.rb
git_data_dirs({
"default" => {
"path" => "/data/gitlab"
}
})
3.停止当前gitlab,重新加载配置
gitlab-ctl stop
gitlab-ctl reconfigure
网友评论