1.安裝依賴
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates
sudo apt-get install -y postfix
#選擇“Internet Site”并按Enter鍵站刑,其他選擇則默認(rèn)
2.添加GitLab軟件包存儲庫并安裝軟件包
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
3.安裝gitlab-ce
sudo apt-get update
#以下操作2選1
#直接安裝最新版本執(zhí)行
sudo EXTERNAL_URL="http://你的ip" apt-get install gitlab-ce
#指定安裝gitlab-ce的版本
sudo apt-cache madison gitlab-ce
sudo EXTERNAL_URL="http://你的ip" apt-get install gitlab-ce=11.0.4-ce.0
4.測試
瀏覽器訪問你的ip 設(shè)置root賬戶的密碼
5.配置https訪問
#將ssl證書放入/etc/gitlab/ssl
sudo vim /etc/gitlab/gitlab.rb
external_url 'https://域名'
nginx['enable'] = true
nginx['redirect_http_to_https'] =true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/域名的ssl證書.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/域名的ssl證書.key"
#保存退出:wq
重啟gitlab
sudo gitlab-ctl reconfigure
6.測試https
瀏覽器訪問你的ip自動跳轉(zhuǎn)https
7.配置GitLab容器注冊管理
sudo vim /etc/gitlab/gitlab.rb
registry_external_url 'https://域名:4567'
#保存退出:wq
或
registry_nginx['enable'] = true
registry_nginx['ssl_certificate'] = "/etc/gitlab/ssl/*.crt"
registry_nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/*.key"
registry_external_url 'https://wjx-cloud.xyz'
### Settings used by GitLab application
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "wjx-cloud.xyz"
gitlab_rails['registry_path'] = "/var/opt/gitlab/gitlab-rails/shared/registry"
sudo gitlab-ctl reconfigure