背景
团队开发文件版本工具升级,在SVN、GIT选型后,选择使用 Git 作为新的代码管理库。以为记录为安装部署过程。
搜索资料
搜索资料后整理安装步骤如下:
- 安装依赖;
- 安装GIT;
- 下载GitLab汉化包;
- 下载GitLab安装包;
- 编译汉化包GitLab1 汉化包;
- 停止 GitLab 服务;
- 开启GitLab 服务;
- 自定义GitLab端口;
开始部署
- 安装依赖;
yum install -y curl policycoreutils-python openssh-server
- 安装GIT(Centos自带没有的时候需要安装,验证是否安装:
git --version
);
yum install -y git
- 汉化GitLab,需提前找到汉化支持的版本号,最新(GitLab 中文社区版 v12.3.5);
git clone git@gitlab.com:xhang/gitlab.git
cat gitlab/VERSION
- 下载安装GitLab安装包( gitlab-ee-12.3.5-ee.0.el7.x86_64.rpm 下载705M,安装后1.54G);
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
yum install -y gitlab-ee-12.3.5-ee.0.el7.x86_64
- 编译汉化包GitLab1 汉化包;
下载汉化包,上面已经下载了,无需再次下载
git clone git@gitlab.com:xhang/gitlab.git
切换到opt/gitlab目录
cd gitlab
获取所有的分支
git branch -a
生成12.3.5的补丁包
git diff remotes/origin/12-3-stable remotes/origin/12-3-stable-zh > /opt/12.3.5-zh.diff
- 停止 GitLab 服务;
gitlab-ctl stop
安装补丁包工具
yum install patch -y
应用补丁包
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /opt/12.3.5-zh.diff
一直回车到完成汉化覆盖
- 开启GitLab 服务;
vim /etc/gitlab/gitlab.rb
external_url ‘http://192.168.1.21’ #改为自己的IP地址或域名
重新编译
gitlab-ctl reconfigure
启动服务
gitlab-ctl start
- 自定义GitLab 端口,处理80、8080端口占用问题;
- 修改默认Gitlab nginx 80端口:
vim /etc/gitlab/gitlab.rb
- external_url 常见的几种设置形式:
– http://gitlab.xxx.com:7801
– http://114.114.114.114
– http://gitlab.xxx.com
改:13 external_url ‘http://gitlab.example.com’
为:13 external_url ‘http://宿主机ip或域名:7801’
改: unicon[‘port’] = 7802
改: nginx[‘listen_port’] = 7801
重新编译
gitlab-ctl reconfigure
启动服务
gitlab-ctl start