溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

centos7.x搭建gitlab9.2.2

發(fā)布時(shí)間:2020-06-05 18:35:42 來(lái)源:網(wǎng)絡(luò) 閱讀:1053 作者:yanconggod 欄目:建站服務(wù)器

1、介紹

GitLab 是一個(gè)用于倉(cāng)庫(kù)管理系統(tǒng)的開源項(xiàng)目。

2、官方硬件介紹配置

CPU

1 核心CPU最多支持100個(gè)用戶,所有的workers和后臺(tái)任務(wù)都在同一個(gè)核心工作這將導(dǎo)致GitLab服務(wù)響應(yīng)會(huì)有點(diǎn)緩慢。

2 核心 支持500用戶,這也是官方推薦的最低標(biāo)準(zhǔn)。

4 核心支持2,000用戶。

8 核心支持5,000用戶。

16 核心支持10,000用戶。

32 核心支持20,000用戶。

64 核心支持40,000用戶。

如果想支持更多用戶,可以使用 集群式架構(gòu)


Memory

安裝使用GitLab需要至少4GB可用內(nèi)存(RAM + Swap)! 由于操作系統(tǒng)和其他正在運(yùn)行的應(yīng)用也會(huì)使用內(nèi)存, 所以安裝GitLab前一定要注意當(dāng)前服務(wù)器至少有4GB的可用內(nèi)存. 少于4GB內(nèi)存會(huì)導(dǎo)致在reconfigure的時(shí)候出現(xiàn)各種詭異的問(wèn)題, 而且在使用過(guò)程中也經(jīng)常會(huì)出現(xiàn)500錯(cuò)誤.


最后官方最后的提醒:

1GB 物理內(nèi)存 + 3GB 交換分區(qū) 是最低的要求,但我們 強(qiáng)烈反對(duì) 使用這樣的配置。 查看下面unicorn worker章節(jié)獲取更多建議。

2GB 物理內(nèi)存 + 2GB 交換分區(qū) 支持100用戶,但服務(wù)響應(yīng)會(huì)很慢。

4GB 物理內(nèi)存 支持100用戶,也是 官方推薦 的配置。

8GB 物理內(nèi)存 支持 1,000 用戶。

16GB 物理內(nèi)存 支持 2,000 用戶。

32GB 物理內(nèi)存 支持 4,000 用戶。

64GB 物理內(nèi)存 支持 8,000 用戶。

128GB 物理內(nèi)存 支持 16,000 用戶。

256GB 物理內(nèi)存 支持 32,000 用戶。

如果想支持更多用戶,可以使用 集群式架構(gòu)



關(guān)于官網(wǎng)的unicorn我并未詳細(xì)查閱,都是英文,看起來(lái)非常吃力!


3、GitLab服務(wù)構(gòu)成

GitLab由以下服務(wù)構(gòu)成:


nginx:靜態(tài)Web服務(wù)器

gitlab-shell:用于處理Git命令和修改authorized keys列表

gitlab-workhorse:輕量級(jí)的反向代理服務(wù)器

logrotate:日志文件管理工具

postgresql:數(shù)據(jù)庫(kù)

redis:緩存數(shù)據(jù)庫(kù)

sidekiq:用于在后臺(tái)執(zhí)行隊(duì)列任務(wù)(異步執(zhí)行)

unicorn:An HTTP server for Rack applications,GitLab Rails應(yīng)用是托管在這個(gè)服務(wù)器上面的。


經(jīng)我統(tǒng)計(jì),一共8個(gè)組件。


4、官方的推薦安裝方式

1、安裝配置依賴項(xiàng)

如想使用Postfix來(lái)發(fā)送郵件,在安裝期間請(qǐng)選擇'Internet Site'. 您也可以用sendmai或者 配置SMTP服務(wù) 并 使用SMTP發(fā)送郵件.

在 Centos 6 和 7 系統(tǒng)上, 下面的命令將在系統(tǒng)防火墻里面開放HTTP和SSH端口.

sudo yum install curl policycoreutils openssh-server openssh-clients git -y
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


2. 添加GitLab倉(cāng)庫(kù),并安裝到服務(wù)器上

curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
如果你不習(xí)慣使用命令管道的安裝方式, 你可以在這里下載 安裝腳本 或者 手動(dòng)下載您使用的系統(tǒng)相應(yīng)的安裝包(RPM/Deb) 然后安裝

curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-XXX.rpm
curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.2.2-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-9.2.2-ce.0.el7.x86_64.rpm 
rpm -i gitlab-ce-XXX.rpm

3. 啟動(dòng)GitLab

sudo gitlab-ctl reconfigure

4. 使用瀏覽器訪問(wèn)GitLab

首次訪問(wèn)GitLab,系統(tǒng)會(huì)讓你重新設(shè)置管理員的密碼,設(shè)置成功后會(huì)返回登錄界面.

默認(rèn)的管理員賬號(hào)是root,如果你想更改默認(rèn)管理員賬號(hào),請(qǐng)輸入上面設(shè)置的新密碼登錄系統(tǒng)后修改帳號(hào)名.

 參數(shù)配置和故障排查請(qǐng)查看 Omnibus GitLab 文檔 
 GitLab-CE中國(guó)鏡像源 清華大學(xué)TUNA開源鏡像站, 浙江大學(xué)開源鏡像站
 
 
 
 

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://localhost
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab: 
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab: 
It looks like GitLab has not been configured yet; skipping the upgrade script.

gitlab所有的工程目錄都在/var/opt/gitlab/下,你可以在這個(gè)目錄看到他們所有的組件


5、更改gitlab配置

vim /etc/gitlab/gitlab.rb

#修改GitLab配置文件中的external_url,修改這個(gè)配置會(huì)影響GitLab里面顯示的倉(cāng)庫(kù)鏈接
external_url 'http://gitlab.abc.com'
 
#時(shí)間區(qū)域,但是我修改這個(gè)時(shí)區(qū)后無(wú)法正常訪問(wèn),失敗原因?yàn)椴樵?gitlab_rails['time_zone'] = 'Asia/Shangha' 

#修改gitlab數(shù)據(jù)存儲(chǔ)路徑
git_data_dirs({ "default" => { "path" => "/data/gitlab_data"}})

#設(shè)置nginx監(jiān)控端口,訪問(wèn)的時(shí)候是http://gitlab.abc.com:9000
nginx['listen_port'] = 9000

#Gitlab 修改備份文件默認(rèn)目錄
gitlab_rails['backup_path'] = '/data/gitlab_backups'

#163郵箱配置
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "xxx@163.com"
gitlab_rails['smtp_password'] = "xxxxxx"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = 'xxx@163.com'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'


6、啟動(dòng)gitlab

sudo gitlab-ctl reconfigure
sudo gitlab-ctl start

啟動(dòng)后,登陸web界面,記得使用管理員賬號(hào)關(guān)閉開放注冊(cè)認(rèn)證sign-up,禁止別人注冊(cè)使用。

7、gitlab備份

Gitlab 創(chuàng)建備份,會(huì)在備份目錄/data/gitlab_data下生成tar文件

gitlab-rake gitlab:backup:create

8、gitlab常用命令

查看服務(wù)狀態(tài)
$ sudo gitlab-ctl status

啟動(dòng)服務(wù)
$ sudo gitlab-ctl start

關(guān)閉服務(wù)
$ sudo gitlab-ctl stop

重啟服務(wù)
$ sudo gitlab-ctl restart

設(shè)置完配置后重新加載配置
$ sudo gitlab-ctl reconfigure

查看nginx日志
gitlab-ctl tail nginx/gitlab_access.log

9、漢化

#漢化
https://gitlab.com/xhang/gitlab

10、不小心把signin登陸窗口關(guān)閉了,可以使用這個(gè)辦法解決

#Gitlab - 如何解決 "No authentication methods configured on login page" ? (gitlab version : 9.2.2)  
sudo gitlab-psql -l 查看資料庫(kù)列表
gitlab-psql gitlabhq_production
UPDATE application_settings set signin_enabled=true;
\q
sudo gitlab-ctl restart


參考:

https://www.gitlab.com.cn/downloads/#centos7 

http://www.jianshu.com/p/a22eaa1fcfe7

https://docs.gitlab.com.cn/ce/install/requirements.html

https://bbs.gitlab.com.cn

https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI