CentOS7.2安裝GitLab-CE

GitLab是一個很好的git的web管理系統,其免費版本GitLab-CE也足夠滿足一般的需求。這裏記錄下GitLab-CE的安裝過程。

GitLab官網:https://about.gitlab.com

GitLab中文網:https://www.gitlab.cc

1.根據官方文檔安裝

1)選擇相應的版本

image

2)安裝基礎軟件依賴包

sudo yum install curl policycoreutils openssh-server openssh-clients

3)開啓sshd服務

sudo systemctl enable sshd
sudo systemctl start sshd

4)開放GitLab web的端口

firewall-cmd --permanent --add-port=80/tcp

5)添加gitlab國內yum源,並安裝gitlab-ce

curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
(GitLab-CE中國鏡像源 清華大學TUNA開源鏡像站, 浙江大學開源鏡像站)

6)配置/etc/gitlab/gitlab.rb,可參考https://doc.gitlab.cc/omnibus/

image

image

image

若使用HTTPS方式,還需證書:

image

若使用smtp方式收發郵件,需要修改此處 

vim /opt/gitlab/embedded/service/gitlab-rails/config/environments/production.rb

wKiom1f_nxvgmyxfAAAoeIUHOp8451.png

7)執行命令:gitlab-ctl reconfigure

如果報如下錯誤,用戶不存在:

image

則手動添加用戶(不知道別人是不是也有這種情況)

useradd -d /var/opt/gitlab -s /bin/sh git
useradd -d /var/opt/gitlab/nginx -s /bin/false gitlab-www
useradd -d /var/opt/gitlab/redis -s /bin/nologin gitlab-redis
useradd -d /var/opt/gitlab/postgresql -s /bin/sh gitlab-psql

後再次執行如下命令:

gitlab-ctl reconfigure

8)上述命令執行成功後執行如下命令啓動GitLab:

gitlab-ctl start

最後,瀏覽器訪問GitLab對外顯示的地址,即可正常使用了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章