首頁 > 軟體

CentOS/Debian設定Gitlab 7.1x來搭建自建的Git倉庫

2020-06-16 17:58:59

前言:因為公司的某些歷史原因, 有大量的程式碼還在csv/svn上. 新來的專案不得不走這個,同時,github的enterprise 2500$/y/10p的價格對於多變的專案和人員也不合適. 也為了讓某些不習慣使用linux的開發使用上git, 就放棄了之前的gitolite server, 進而採用gitlab來搭建.

--------------------------------------------------------------------------------

www.gitlab.com 是gitlab的倉庫, 以前的歷史版本, 需要先設定gitolite, 然後配server端來支援web功能. 新的已經實現一鍵包了.

-下載

使用https://about.gitlab.com/downloads/ 來選擇對應的版本
wget 後直接執行一鍵指令碼就可以了.

這個官方的版本非常不友好, 一鍵裝完, 什麼都沒設定. 配了半天, 發現repo的地址還是domain.com…

gitlab也支援分開安裝, 你自己指定server, 資料庫這些, 如果一個一個裝, 7個流程走下來, 也太過繁瑣. 所以我們換一個公司出的,bitnami出的一鍵包.

地址在https://bitnami.com/stack/gitlab/installer

可以根據系統來選擇是32還是64bit的, 推薦用recommended的版本.

下載到伺服器後, 先去檢查下伺服器的80埠是否給占用. 停掉nginx or apache/httpd
把它們轉到808x. 我這裡要用一個完整的域名來使用gitlab,
e.g:http://dev.domain.org

安裝前, 刪除掉已經有的git帳號, 和git的home目錄. 保證系統乾淨.


[root@www.linuxidc.com]# wget https://downloads.bitnami.com/files/stacks/gitlab/7.11.4-0/bitnami-gitlab-7.11.4-0-linux-x64-installer.run
--2015-06-09 19:31:19--  https://downloads.bitnami.com/files/stacks/gitlab/7.11.4-0/bitnami-gitlab-7.11.4-0-linux-x64-installer.run
Resolving downloads.bitnami.com... 216.235.167.23
Connecting to downloads.bitnami.com|216.235.167.23|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 311542012 (297M) [application/x-makeself]
Saving to: “bitnami-gitlab-7.11.4-0-linux-x64-installer.run”

100%[===========================================================================================================================================================>] 311,542,012 2.06M/s  in 2m 40s 

2015-06-09 19:34:05 (1.86 MB/s) - “bitnami-gitlab-7.11.4-0-linux-x64-installer.run” saved [311542012/311542012]

[root@fca-vm-demo-opt]# chmod a+x bitnami-gitlab-7.11.4-0-linux-x64-installer.run

[root@fca-vm-demo-opt]# ./bitnami-gitlab-7.11.4-0-linux-x64-installer.run
The installer detects that exists a 'git' user in the system. This installer will change the configuration for this user. Do you want to continue the installation? [y/N]: y

The installer detects that exists a 'gitlab_ci' user in the system. This installer will change the configuration for this user. Do you want to continue the installation? [y/N]: y

----------------------------------------------------------------------------
Welcome to the Bitnami Gitlab Stack Setup Wizard.

----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.

PhpPgAdmin [Y/n] :Y

GitLab : Y (Cannot be edited)

GitLab CI [Y/n] :Y

Is the selection above correct? [Y/n]: Y

----------------------------------------------------------------------------
Installation folder

Please, choose a folder to install Bitnami Gitlab Stack

Select a folder [/opt/gitlab-7.11.4-0]: /opt/bitnami

----------------------------------------------------------------------------
Create Admin account

Bitnami Gitlab Stack admin user creation

Email Address [user@example.com]: rainysia@gmail.com

Login [user]:  rainysia

Password :
Please confirm your password :

----------------------------------------------------------------------------
Hostname that will be used to create internal URLs. If this value is incorrect,
you may be unable to access your Gitlab installation from other computers. It is
advisable to use a Domain instead of an IP address for compatibility with
different browsers.

Domain [127.0.0.1]:  dev.domain.org
Do you want to configure mail support? [y/N]: N

----------------------------------------------------------------------------
Setup is now ready to begin installing Bitnami Gitlab Stack on your computer.

Do you want to continue? [Y/n]: Y

----------------------------------------------------------------------------
Please wait while Setup installs Bitnami Gitlab Stack on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################

----------------------------------------------------------------------------
Setup has finished installing Bitnami Gitlab Stack on your computer.

Info: To access the Bitnami Gitlab Stack, go to
http://dev.domain.org:80 from your browser.
Press [Enter] to continue:


這樣就裝好了. 中間容易出問題的地方, git本來的帳號, 各個gitlab和git的home目錄, 以及/var/opt下的gitlab目錄, 我這裡沒有設定mail server

使用很簡單了
有幾個使用的說明,

gitlab不支援initial repo, 所以你需要先用一個https://的git倉庫來匯入.
設定ssh key後, 是在 /profile這裡面的/profile/key e.g:http://dev.domain.org/profile/keys
保證你要使用倉庫的使用者的ssh key是id_ras.pub key
拉取的時候直接用 git@dev.domain.org:username/project_name.git ,如果是read, 可以走http.
因為這裡為沒有走其它埠或者2級,3級域名, 所以需要走其他埠的, 需要在域名那裡重配. 整個gitlab都在/opt/下, 裡面的apps是應用,ctlscript.sh是設定重置重新啟動shell

Ubuntu 12.04 上安裝 GitLab http://www.linuxidc.com/Linux/2012-12/75249.htm

GitLab 5.3 升級注意事項 http://www.linuxidc.com/Linux/2013-06/86473.htm

CentOS 上部署 GitLab (自託管的Git專案倉庫) http://www.linuxidc.com/Linux/2013-06/85754.htm

在RHEL6/CentOS6/ScientificLinux6上安裝GitLab 6.0.2 http://www.linuxidc.com/Linux/2014-03/97831.htm

CentOS 6.5安裝GitLab教學及相關問題解決 http://www.linuxidc.com/Linux/2014-05/101526.htm


IT145.com E-mail:sddin#qq.com