1. 以下命令將在打開系統防火牆中的HTTP、HTTPS和SSH
| 切換root權限(須輸入密碼) | 
| sudo -i | 
| 安裝配置必要的依賴項目 | 
| yum
  install -y curl policycoreutils-python openssh-server | 
| 將SSH服務設置成開機自動啟動 | 
| systemctl
  enable sshd | 
| 啟動SSH服務 | 
| systemctl
  start sshd | 
| 調整防火牆開啟HTTP、HTTPS | 
| firewall-cmd
  --permanent --add-service=http | 
| firewall-cmd
  --permanent --add-service=https | 
| systemctl
  reload firewalld | 
2. 安裝郵件通知,如果要使用其他解決方案發送電子郵件,請跳過此步驟
| 安裝Postfix以發送通知電子郵件  | 
| yum
  install postfix | 
| systemctl
  enable postfix | 
| systemctl
  start postfix | 
3.  GitLab安裝
| 官網下載GitLab安裝檔 | 
| curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh |
  sudo bash | 
| 安裝GitLab主程式 | 
| EXTERNAL_URL=" https://gitlab.example.com
  " yum install -y gitlab-ce | 
**將https://gitlab.example.com改為自訂URL**
4. 如有需要,再次配置相關設定檔&重啟 gitlab-ctl
| gitlab-ctl
  reconfigure | 
| gitlab-ctl
  restart | 
5. 主機設定HOST並訪問URL,會跳出此頁面,預設帳號為root,請設定root密碼
6. 成功登入Gitlab頁面
7.安裝憑證
| 編輯gitlab設定檔 | 
| vi /etc/gitlab/gitlab.rb | 
搜尋nginx,將憑證設定如下圖
完成後重新配置設定檔並重啟gitlab
| gitlab-ctl
  reconfigure | 
| gitlab-ctl
  restart | 
配置完成後重新瀏覽網頁
參考資料:https://about.gitlab.com/install/#centos-7



0 留言