作者 主題: [git] Gitlab installation on CentOS 7  (閱讀 10183 次)

0 會員 與 1 訪客 正在閱讀本文。

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
[git] Gitlab installation on CentOS 7
« 於: 2016-01-01 10:47 »
step1: goto download website:
https://about.gitlab.com/downloads/#centos7

step2: preparation:
代碼: [選擇]
sudo yum install curl openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

step3: installation:
代碼: [選擇]
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
*note: curl may fails if behide proxy/firewall.
        - setup proxy environment and use wget to download the script.rpm.sh, then run

step4: configuration:
代碼: [選擇]
sudo gitlab-ctl reconfigure*note: you may want to change the URL if your servername is localhost.localdomain.
       - Edit /etc/gitlab/gitlab.rb and change the following:
               external_url "http://your.servername.or.ip.address"

step5: login
use browser to connect to the ip address, login with root  (password: 5iveL!fe)

step6: getting start
GitLab Documentation
連猴子都能懂的Git入門指南

« 上次編輯: 2016-01-14 08:37 由 netman »

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
Re: [git] Gitlab installation on CentOS 7
« 回覆 #1 於: 2016-01-29 14:41 »
To enable HTTPS:
Ref: http://www.bonusbits.com/wiki/HowTo:Setup_HTTPS_for_Gitlab

1. Prepare Certs (Please generate them first!):
mkdir -p /etc/gitlab/ssl
cp /some/where/stores/ca.crt /etc/gitlab/ssl
cp /some/where/stores/gitlab.example.com.crt /etc/gitlab/ssl
cp /some/where/stores/gitlab.example.com.key /etc/gitlab/ssl
chmod 600 /etc/gitlab/ssl/gitlab.example.com.key

2. Edit gitlab.rb:
vim /etc/gitlab/gitlab.rb
代碼: [選擇]
external_url 'https://gitlab.example.com'
...
nginx['redirect_http_to_https'] = true
nginx['ssl_client_certificate'] = "/etc/gitlab/ssl/ca.crt" # Most root CA's are included by default
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.example.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.example.com.key"
...

3. Restart gitlab:
gitlab-ctl reconfigure
gitlab-ctl restart
« 上次編輯: 2016-01-29 15:16 由 netman »

duncanlo

  • SA 苦力組
  • 俺是博士!
  • *****
  • 文章數: 7312
    • 檢視個人資料
Re: [git] Gitlab installation on CentOS 7
« 回覆 #2 於: 2016-01-29 15:42 »
所以它自動會幫你處理PostgreSQL的部份?!

MTA只能用Postfix嗎?還是它也自動幫你生Config檔?!

kojj

  • 懷疑的國中生
  • **
  • 文章數: 45
    • 檢視個人資料
Re: [git] Gitlab installation on CentOS 7
« 回覆 #3 於: 2016-01-29 17:55 »

1.安裝的時候我記得預設是PostgreSQL,當然也可以改MySql
2.MTA就隨意,你只要指定一個有效的MTA 就可以了

官方安裝文件
http://doc.gitlab.com/ce/install/installation.html
若擔心細節問題,我會建議用虛擬機做

我的作法是,直接找virtual machine的image file,改成自己要的來用,這樣就可以省去安裝與測試時的一些手工錯誤
當然啦,還要花時間調整,但速度就比較快了

Docker 版 https://hub.docker.com/r/gitlab/gitlab-ce/
Vagrant版 https://github.com/tuminoid/gitlab-installer

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
Re: [git] Gitlab installation on CentOS 7
« 回覆 #4 於: 2016-01-29 20:43 »
To Enable LDAP Accounts:

vi /etc/gitlab/gitlab.rb
代碼: [選擇]
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below
 main: # 'main' is the GitLab 'provider ID' of this LDAP server
 label: 'saLAB'
 host: 'gw.lab.sa'
 port: 389
 uid: 'uid'
 method: 'plain' # "tls" or "ssl" or "plain"
 bind_dn: 'cn=Manager,dc=lab,dc=sa'
 password: 'S@123$%^Admin'
 active_directory: false
 allow_username_or_email_login: false
 base: 'ou=People,dc=lab,dc=sa'
 user_filter: '(objectClass=posixAccount)'
EOS
gitlab-ctl reconfigure
gitlab-rake gitlab:ldap:check
gitlab-ctl restart

* FAQ:
    Error:
       Could not authorize you from Ldapmain because "Undefined method 'provider' for nil:nilclass".
    Cause:
       No email attribute in ldap entry
    Solution:
        smbldap-usermod -M <email> <username> # To allow Gitlab

« 上次編輯: 2016-01-30 11:11 由 netman »

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
Re: [git] Gitlab installation on CentOS 7
« 回覆 #5 於: 2016-01-29 20:46 »
所以它自動會幫你處理PostgreSQL的部份?!

MTA只能用Postfix嗎?還是它也自動幫你生Config檔?!
是的,用懶人包的方式都不用自己從頭配置了...
MTA部份可以用外部的,也可以用本機的,看你喜歡。

不妨先看看官方的Docs:
http://doc.gitlab.com/omnibus/

duncanlo

  • SA 苦力組
  • 俺是博士!
  • *****
  • 文章數: 7312
    • 檢視個人資料
Re: [git] Gitlab installation on CentOS 7
« 回覆 #6 於: 2016-01-30 12:02 »
剛看一下system requirements要求不高,
可以用虛擬機練習安裝一下...

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
Re: [git] Gitlab installation on CentOS 7
« 回覆 #7 於: 2016-01-30 19:27 »
也有包好的 docker,不過要介接外面的 sql 就是了...

zarr12steven

  • SA 苦力組
  • 懷疑的國中生
  • **
  • 文章數: 71
    • 檢視個人資料
Re: [git] Gitlab installation on CentOS 7
« 回覆 #8 於: 2016-02-02 17:11 »
建議可以用docker-compose.yml這個來做,會較方便

代碼: [選擇]
docker-compose -f docker-compose.yml build

就可以幫你把volume & link都做好。
不強就要挨打

duncanlo

  • SA 苦力組
  • 俺是博士!
  • *****
  • 文章數: 7312
    • 檢視個人資料
Re: [git] Gitlab installation on CentOS 7
« 回覆 #9 於: 2016-02-23 13:58 »
用sameersbn/docker-gitlab是拆成三個Docker.

但gitlab/gitlab-ce是不是有內建PostgreSQL?!
還是一樣把DB拆出來?!

duncanlo

  • SA 苦力組
  • 俺是博士!
  • *****
  • 文章數: 7312
    • 檢視個人資料
Re: [git] Gitlab installation on CentOS 7
« 回覆 #10 於: 2016-02-23 23:05 »
又要自問自答!!

gitlab/gitlab-ce 是 all-in-one 的 docker image 包,除了 smtp 沒有外,其他都幫你包好了。

假如出現 Container 一直在 restart 的現象,就手動把 /var/log/gitlab/reconfigure 目錄先解出來,
再重新起應該就可以。

Install Ref:
http://doc.gitlab.com/omnibus/docker/README.html