搭建本地GitLab
阿新 • • 發佈:2021-09-28
安裝GitLab
注意:
安裝使用GitLab需要至少
4GB
可用記憶體(RAM + Swap)! 由於作業系統和其他正在執行的應用也會使用記憶體, 所以安裝GitLab前一定要注意當前伺服器至少有4GB
的可用記憶體. 少於4GB記憶體會導致在reconfigure的時候出現各種問題, 而且在使用過程中也經常會出現500錯誤。
1、安裝依賴
sudo yum install curl policycoreutils openssh-server openssh-clients policycoreutils-python sudo systemctl enable sshd sudo systemctl start sshd sudo yum install postfix sudo systemctl enable postfix sudo systemctl start postfix
2、獲取rpm安裝包
[root@VM-0-15-centos /]# cd /usr/local/src/
[root@VM-0-15-centos src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm
3、安裝
[root@VM-0-15-centos src]# rpm -ivh gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm warning: gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY Preparing... ################################# [100%] Updating / installing... 1:gitlab-ce-11.2.3-ce.0.el7 ################################# [100%] It looks like GitLab has not been configured yet; skipping the upgrade script. *. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ \ / /_/ / / /_/ /___/ /_/ / /_/ / \____/_/\__/_____/\__,_/_.___/ Thank you for installing GitLab! GitLab was unable to detect a valid hostname for your instance. Please configure a URL for your GitLab instance by setting `external_url` configuration in /etc/gitlab/gitlab.rb file. Then, you can start your GitLab instance by running the following command: sudo gitlab-ctl reconfigure For a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md [root@VM-0-15-centos src]#
4、配置
修改配置檔案:
/etc/gitlab/gitlab.rb
修改
external_url
的地址為:http://IP地址修改完主配置檔案後,使用
gitlab-ctl reconfigure
重新配置gitlab
5、啟動
1、重新配置gitlba後,在瀏覽位址列中輸入 http://IP地址
命令功能 | 執行命令 |
---|---|
重啟配置,並啟動gitlab服務 | gitlab-ctl reconfigure |
啟動所有 gitlab | gitlab-ctl start |
重新啟動GitLab | gitlab-ctl restart |
停止所有 gitlab | gitlab-ctl stop |
檢視服務狀態 | gitlab-ctl status |
檢視Gitlab日誌 | gitlab-ctl tail |
修改預設的配置檔案 | vim /etc/gitlab/gitlab.rb |
檢查gitlab | gitlab-rake gitlab:check SANITIZE=true --trace |
2、配置root使用者的密碼,完成後進入系統:
至此我們的GitLab安裝已經完成
6、解除安裝
1、停止gitlab
gitlab-ctl stop
2、解除安裝gitlab(注意這裡寫的是gitlab-ce)
rpm -e gitlab-ce
3、檢視gitlab程序
ps aux | grep gitlab
4、殺掉第一個程序(就是帶有好多.............的程序)
kill -9 PId
殺掉後,在ps aux | grep gitlab確認一遍,還有沒有gitlab的程序
5、刪除所有包含gitlab檔案
find / -name gitlab | xargs rm -rf