CentOS8安裝gitlab

開發(fā)環(huán)境:

操作系統(tǒng) CentOS Linux release 8.2.2004 (Core)
CPU Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GH
內(nèi)存 3590MB (安裝后內(nèi)存水位在2800M,2G內(nèi)存就別玩了)

1,安裝依賴
yum install -y curl policycoreutils-python openssh-server

centos8沒有policycoreutils-python yum源,不用管

2,啟動ssh并設(shè)置為開機自啟動
systemctl enable sshd

systemctl start sshd

3,添加http服務(wù)到firewalld,pemmanent表示永久生效,若不加--permanent系統(tǒng)下次啟動后就會失效
systemctl start firewalld

firewall-cmd --permanent --add-service=http

systemctl reload firewalld

4,啟動postfix

Failed to start postfix.service: Unit postfix.service not found
首先看一下服務(wù)列表里有沒有這個服務(wù):
systemctl list-unit-files --type=service
如果有的話:
systemctl daemon-reload
沒有的話 :
sudo yum install -y postfix

systemctl enable postfix

systemctl start postfix

5,下載gitlab
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-12.10.1-ce.0.el8.x86_64.rpm

6,安裝
rpm -i gitlab-ce-12.10.1-ce.0.el8.x86_64.rpm
成功如圖:

image

7,編輯ip和端口
vim /etc/gitlab/gitlab.rb

這個文件大致都是注釋掉的,只有這一句,大概在29行,改成自己的地址
external_url 'http://localhost:8081'

這一步會很長
gitlab-ctl reconfigure

gitlab-ctl restart

增加NGINX配置,將你的網(wǎng)址 xxx.xxxxxxxx.xx 綁定到 http://localhost:8081

server{
    listen 80 ;
    server_name xxx.xxxxxxxx.xx ;
        client_max_body_size 200m;
        location / {
            root  html;
            index index.html index.htm;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header REMOTE-HOST $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://127.0.0.1:8081;
        }
}
http{        
    client_max_body_size 200m; // nginx 配置文件 http層級也要加 否則不生效
}

8,訪問
如果一直無法響應(yīng),可以關(guān)閉防火墻
systemctl stop firewalld

重新配置并啟動

gitlab-ctl reconfigure
gitlab-ctl restart

GitLab 常用命令

gitlab-ctl start 啟動所有 gitlab 組件;
gitlab-ctl stop 停止所有 gitlab 組件;
gitlab-ctl restart 重啟所有 gitlab 組件;
gitlab-ctl status 查看服務(wù)狀態(tài);

9,成功如圖:


image

10,第一次登錄需要修改root密碼, 密碼8位以上,修改完就可以登錄
使用設(shè)置的新密碼,登錄


image

11,修改project的默認域名和端口


image.png

注意:gitlab安裝時自帶了一個NGINX。
vim /etc/gitlab/gitlab.rb

external_url 'http://git.xxx.com'    //域名:nginx端口  此處80為獨立nginx端口
nginx['enable'] = false       //禁用自帶nginx
gitlab_workhorse['listen_network'] = "tcp"  //允許gitlab-workhorse監(jiān)聽TCP
gitlab_workhorse['listen_addr'] = "127.0.0.1:8081" //設(shè)置gitlab端口為8091 注意自己的 8091未占用
gitlab_rails['trusted_proxies'] = ['git.xxx.com']  // 設(shè)置gitlab域名

gitlab-ctl reconfigure
gitlab-ctl restart


完全卸載刪除gitlab

1、停止gitlab

gitlab-ctl stop

2、卸載gitlab(注意這里寫的是gitlab-ce)

rpm -e gitlab-ce

3、查看gitlab進程

ps aux | grep gitlab

image

4、殺掉第一個進程(就是帶有好多.............的進程)

kill -9 714

殺掉后,在ps aux | grep gitlab確認一遍,還有沒有g(shù)itlab的進程

5、刪除所有包含gitlab文件

find / -name gitlab | xargs rm -rf

參考鏈接:
https://www.cnblogs.com/stronger-xsw/p/12802069.html

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容