1.背景html
近期公司源代碼管理工具從svn轉向git,所以要在服務器上部署gitlab,總共部署了兩臺服務器,一臺是Ubuntu server 17.04,一臺是Centos7。在部署的過程當中遇到很多問題,發現Linux裏經過命令直接去Gitlab官網上下載程序根本不能成功,無論是在Ubuntu仍是Centos上。後來只能去Gitlab官網手動下載安裝包,而後再去Linux裏經過命令去執行才能安裝。git
2.軟件下載ubuntu
(1)Gitlab官網vim
官網地址:https://about.gitlab.com/downloads/ centos
(2)鏡像站tomcat
軟件地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/xenial/main/g/gitlab-ce/,可是有時候鏡像站也會打不開,可是速度確定要比官網快多了。服務器
(3)Ubuntu server 17.04下載的版本是gitlab-ce_9.5.6-ce.0_amd64.debssh
(4)centos7下載的版本是gitlab-ce-9.5.6-ce.0.el7.x86_64.rpmcurl
3.安裝svn
(1)ubuntu環境
<1>$ apt-get install curl openssh-server ca-certificates postfix
<2>配置postfix郵箱
<3>使用命令:$ dpkg -i gitlab-ce_9.5.6-ce.0_amd64.deb
<4>出現 It looks like… 表示安裝成功!
<5>配置gitlab
mkdir -p /etc/gitlab touch /etc/gitlab/gitlab.rb chmod 600 /etc/gitlab/gitlab.rb vim/etc/gitlab/gitlab.rb
<6>把external_url改爲部署機器的域名或者IP地址
<7>$ gitlab-ctl reconfigure
<8>$ gitlab-ctl status
<9>安裝完成。
(2)centos環境
<1>配置postfix郵箱 :$ yum -y install policycoreutils openssh-server openssh-clients postfix
<2>安裝gitlab:$ rpm -i gitlab-ce-9.5.6-ce.0.el7.x86_64.rpm
<3>修改gitlab配置文件指定服務器ip和自定義端口
命令:vim /etc/gitlab/gitlab.rb,修改external_url
<4>執行命令gitlab-ctl reconfigure、gitlab-ctl restart
<5>安裝完成。
4.提醒
(1)郵箱自動提醒功能有問題
(2)gitlab會佔用8080端口,建議服務器上的tomcat修改下端口號,不然會有問題。
(3)訪問主機ip就能夠訪問gitlab主頁了。