通過 GitLab 搭建版本控制伺服器

源碼安裝 GitLab 步驟繁瑣:需要安裝依賴包,Mysql,Redis,Postfix,Ruby,Nginx……安裝完畢還得一個個手動配置這些軟體。源碼安裝容易出錯,不順利的話,一天都搞不定。源碼最大的好處是私人定製,如果不做定製化,還是使用官方推薦的 omnibus packages 方式安裝,網路好的話,一個小時內搞定。

參照官方安裝文檔,分別在 Ubuntu 14 和 CentOS 6 兩個機器上安裝,過程非常順利,沒有錯誤。

在 Ubuntu 14 安裝

使用國內安裝源鏡像,加快安裝速度。修改/etc/apt/sources.list.d/gitlab-ce.list 添加以下行

deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/debian jessie main

Advertisements

安裝:

安裝依賴包

sudo apt-get install curl openssh-server ca-certificates postfix

安裝 GitLab 社區版

apt-get install gitlab-ce

初始化,初始化完自動啟動 GitLab

sudo gitlab-ctl reconfigure

在 CentOS 6 安裝

使用國內鏡像安裝,新建 /etc/yum.repos.d/gitlab-ce.repo,添加以下內容

[gitlab-ce]

name=gitlab-ce

baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6

Advertisements

repo_gpgcheck=0

gpgcheck=0

enabled=1

gpgkey=https://packages.gitlab.com/gpg.key

安裝:

安裝依賴包

sudo yum install curl openssh-server openssh-clients postfix cronie

啟動 postfix 郵件服務

sudo service postfix start

檢查 postfix

sudo chkconfig postfix on

安裝 GitLab 社區版

sudo yum install gitlab-ce

初始化 GitLab

sudo gitlab-ctl reconfigure

修改 host

添加訪問的 host,修改/etc/gitlab/gitlab.rb的external_url

external_url 'http://git.home.com'

vi /etc/hosts,添加 host 映射

127.0.0.1 git.home.com

每次修改/etc/gitlab/gitlab.rb,都要運行以下命令,讓配置生效

sudo gitlab-ctl reconfigure

配置本機的 host,如:192.168.113.59 git.home.com。最後,在瀏覽器打開網址http://git.home.com,登陸。默認管理員:

用戶名: root

密碼: 5iveL!fe

參考:http://www.jianshu.com/p/7a0d6917e009

Advertisements

你可能會喜歡