系統(tǒng)環(huán)境:
~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
搭建gitlab
1. 創(chuàng)建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
注:如果無(wú)法解析地址挠蛉,請(qǐng)配置?/etc/resolv.conf 文件
3. 安裝社區(qū)版gitlab
~]# yum -y install gitlab-ce
注:如果有些包無(wú)法安裝楷怒,需要配置Base源,執(zhí)行如下命令:
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4. 修改gitlab配置項(xiàng)
~]#?vim /etc/gitlab/gitlab.rb
### 找到 external_url 'http://192.168.1.157:8081'
###?external_url修改成你的地址
5. 對(duì)gitlab進(jìn)行編譯
~]# gitlab-ctl reconfigure
......? ? ?### 出現(xiàn)如下提示表示編譯成功
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. 啟動(dòng)所有 gitlab 組件
~]# gitlab-ctl? restart
~]#?service iptables stop? ? ? ###關(guān)閉防火墻
登陸地址:http://192.168.1.157:8081
gitlab漢化
先查看gitlab版本(gitlab漢化包的版本需要和gitlab一致凌盯,否則有可能導(dǎo)致gitlab癱瘓)
~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
11.1.3
下載中文補(bǔ)丁包
~]# 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
可以確認(rèn)一下漢化包的版本號(hào)
~]# cat gitlab-11-1-stable-zh/VERSION
11.1.3
先備份狸剃,避免漢化失敗后gitlab癱瘓
~]# cp -r /opt/gitlab/embedded/service/gitlab-rails{,.ori}
復(fù)制并覆蓋
]# 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
訪問(wèn) http://192.168.1.157:8081