1.安裝依賴包
>sudo apt-get install curl openssh-server ca-certificates postfix
注:執(zhí)行完成后,出現(xiàn)郵件配置,選擇Internet那一項(不帶Smarthost的)
2.進(jìn)行主程序的安裝
首先信任 GitLab 的 GPG 公鑰
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
安裝 gitlab-ce
sudo apt-get update
sudo apt-get install gitlab-ce
3.啟動各項服務(wù)
sudo gitlab-ctl reconfigure
4.檢查GitLab是否安裝好并且已經(jīng)正確運行
sudo gitlab-ctl status
查看端口占用情況
netstat -tunlp
常見錯誤
訪問gitlab,出現(xiàn):502
GitLab在使用的過程中,會開啟80端口,如果80端口被其他的應(yīng)用程序占用,則GitLab的該項服務(wù)不能使用,所以訪問GitLab會失敗。大多數(shù)皆是此問題。
還要注意gitlab還要使用8080端口,因此要注意可以把gitlab端口改為別的無服務(wù)占用的端口。
改gitlab端口:
vim /etc/gitlab/gitlab.rb
unicorn['port'] = 9090
nginx['listen_port'] = 9099
vim /var/opt/gitlab/gitlab-rails/etc/unicorn.rb
listen “127.0.0.1:9090”, :tcp_nopush => true
修改默認(rèn)的gitlab nginx的web服務(wù)80端
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf
listen *:9099;
重啟配置:
sudo gitlab-ctl reconfigure
重新啟動gitlab
gitlab-ctl restart
更改密碼
gitlab-rails console
> user = User.where(id: 5).first
> user.password=12345678
> user.password_confirmation=12345678
> user.save