gitlab 搭建(基於現有nginx)


普通搭建請看:gitlab 搭建

一.gitlab搭建

1.添加GitLab鏡像源並安裝gitlab服務器

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

2.安裝gitlab 安裝命令:安裝過程需要些時間

rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

 3.修改gitlab配置文件指定服務器ip和自定義端口:

vim  /etc/gitlab/gitlab.rb
external_url 'http://localhost:8099'
nginx['enable'] = false
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "127.0.0.1:8098"  //這個端口號一會和Nginx代理的端口號要一致

4.漢化gitlab

安裝git

yum install -y git

克隆獲取漢化版本庫

項目地址為:https://gitlab.com/xhang/gitlab
我的gitlab版本為10.5.1
git clone https://gitlab.com/xhang/gitlab.git -b v10.0.0-zh
想要其他版本的gitlab:
git clone https://gitlab.com/xhang/gitlab.git -b vX.X.X-zh即可

停止gitlab服務

gitlab-ctl stop

進入git下載的gitlab項目

cd gitlab 

比較漢化標簽和原標簽,導出 patch 用的 diff 文件到/root下 

git diff v10.0.0 v10.0.0-zh > ../10.0.0-zh.diff

回到/root目錄

cd 

將10.0.0-zh.diff作為補丁更新到gitlab中 

patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.0.0-zh.diff

啟動gitlab

gitlab-ctl reconfigure
gitlab-ctl start

二、nginx配置

vi /etc/nginx/conf/vhost/gitlab-http.conf
server {
    listen       8099;  #我的gitlab一般使用8099端口訪問
    server_name  localhost;

    location / {
        root  html;
        index index.html index.htm;
        proxy_pass http://127.0.0.1:8098; #這里與前面設置過的端口一致
    }
}
重啟nginx
systemctl restart nginx
開機自啟動gitlab
systemctl enable gitlab-runsvdir

輸入地址:192.168.233.135:8099訪問gitlab
進入后會提示添加密碼
默認賬號:root 或admin@example.com

參考:gitlab自帶的Nginx與原Nginx沖突的解決方案


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM