Ubuntu 16.04搭建GitLab服務(wù)器的官方操作指南地址:
https://about.gitlab.com/downloads/#ubuntu1604。
1.安裝依賴包,運(yùn)行如下命令
sudo apt-get install curl openssh-server ca-certificates postfix
執(zhí)行完成后,郵件配置時(shí)候選擇Internet即可。
2、如果按照官方操作,直接
運(yùn)行
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
安裝估計(jì)需要三個(gè)小時(shí)才能完成,主要是下載太慢。
所以建議使用清華大學(xué)的鏡像文件服務(wù)器進(jìn)行安裝,幾分鐘就能下載完畢。
鏡像地址:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/
首先信任 GitLab 的 GPG 公鑰:
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
修改root密碼:
sudo passwd root
然后用root賬戶,打開vi:
su root
vi /etc/apt/sources.list.d/gitlab-ce.list
將
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main
粘貼至文本中,按Esc鍵,鍵入:,最后輸入wq保存并退出。
安裝 gitlab-ce:
sudo apt-get update
sudo apt-get install gitlab-ce
下載還是挺快的,只花了45秒的時(shí)間,用官方原址下載,幾十K的速度的確很焦人。

安裝完成之后啟動(dòng)gitlab.
sudo gitlab-ctl reconfigure
打開 sshd 和 postfix 服務(wù)
service sshd start
service postfix start
最后,可通過輸入下面的命令,檢查GitLab是否安裝成功并正常運(yùn)行。
sudo gitlab-ctl status
在瀏覽器中打開:http://127.0.0.1。
首次使用時(shí),GitLab會(huì)提示設(shè)置密碼,設(shè)置后就可以正常使用了。