1、添加gitlab源
vi /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever
gpgcheck=0
enabled=1
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever
gpgcheck=0
enabled=1
2、安裝gitlab
yum -y install openssh-server cronie git wget patch gitlab-ce-10.5.1
3、初始化gitlab
gitlab-ctl reconfigure
在卸載gitlab然後再次安裝執行sudo gitlab-ctl reconfigure的時候往往會出現:ruby_block[supervise_redis_sleep] action run,會一直卡無法往下進行!
解決方案:
1、按住CTRL+C強制結束;
2、運行:sudo systemctl restart gitlab-runsvdir;
3、再次執行:sudo gitlab-ctl reconfigure
PS:可以在/etc/gitblab/gitlab.rb修改external_url,改成自己的url
4、查看服務
gitlab-ctl status
5、重啓、停止或啓動服務
gitlab-ctl restart/stop/start
安裝完成,可以通過瀏覽器訪問IP測試(如訪問不了,請檢查iptables、selinux)
gitlab漢化
Gitlab中文社區版地址:https://gitlab.com/xhang/gitlab
1、克隆版本庫(時間會很長,可以考慮掛代理,或者用自己的海外服務器中轉下)
cd /usr/src/
git clone https://gitlab.com/xhang/gitlab.git
2、確定當前Gitlab版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
3、比較原標籤和漢化標籤,導出patch用的diff文件
cd gitlab
git diff v10.5.1 v10.5.1-zh> ../10.5.1-zh.diff
4、先停止gitlab
gitlab-ctl stop
5、上傳10.5.1-zh.diff文件到服務器
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../10.5.1-zh.diff
6、然後啓動gitlab
gitlab-ctl start
7,修改Gitlab默認訪問端口
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf
vim /etc/gitlab/gitlab.rb
輸入內容:
external_url 'http://gitlab.example.com:88'
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf
查找如下內容並修改:
server {
listen *:88;
修改完成後,執行
gitlab-ctl reconfigure
gitlab-ctl restart
此時訪問http://IP就是全中文頁面了(啓動後馬上打開頁面可能會顯示502,稍等幾秒刷新就好了)
創建gitlab-runner
https://docs.gitlab.com/runner/install/linux-manually.html