系统环境:
~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
搭建gitlab
1. 创建gitlab yum镜像源
~]# vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
2. 更新yum缓存
~]# yum makecache
注:如果无法解析地址,请配置 /etc/resolv.conf 文件
3. 安装社区版gitlab
~]# yum -y install gitlab-ce
注:如果有些包无法安装,需要配置Base源,执行如下命令:
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4. 修改gitlab配置项
~]# vim /etc/gitlab/gitlab.rb
### 找到 external_url 'http://192.168.1.157:8081'
### external_url修改成你的地址
5. 对gitlab进行编译
~]# gitlab-ctl reconfigure
...... ### 出现如下提示表示编译成功
Running handlers:
Running handlers complete
Chef Client finished, 525/555 resources updated in 35 seconds
gitlab Reconfigured!
6. 清除缓存
~]# gitlab-rake cache:clear RAILS_ENV=production
7. 启动所有 gitlab 组件
~]# gitlab-ctl restart
~]# service iptables stop ###关闭防火墙
登陆地址:http://192.168.1.157:8081
gitlab汉化
先查看gitlab版本(gitlab汉化包的版本需要和gitlab一致,否则有可能导致gitlab瘫痪)
~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
11.1.3
下载中文补丁包
~]# wget https://gitlab.com/xhang/gitlab/repository/11-1-stable-zh/archive.tar.bz2 -O gitlab-11-1-stable-zh.tar.bz2
或者用git clone获取最新版
git clone https://gitlab.com/xhang/gitlab.git
解压
~]# tar -jxvf gitlab-11-1-stable-zh.tar.bz2
可以确认一下汉化包的版本号
~]# cat gitlab-11-1-stable-zh/VERSION
11.1.3
先备份,避免汉化失败后gitlab瘫痪
~]# cp -r /opt/gitlab/embedded/service/gitlab-rails{,.ori}
复制并覆盖
]# cp -rf gitlab-10-3-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/
cp: cannot overwrite non-directory `/opt/gitlab/embedded/service/gitlab-rails/log' with directory `gitlab-11-1-stable-zh/log'
cp: cannot overwrite non-directory `/opt/gitlab/embedded/service/gitlab-rails/tmp' with directory `gitlab-11-1-stable-zh/tmp'
再一次配置gitlab
~]# gitlab-ctl reconfigure
重启gitlab
~]# gitlab-ctl restart
访问 http://192.168.1.157:8081
网友评论