GitLab介紹
GitLab:是一個基于Git實現(xiàn)的在線代碼倉庫托管軟件,你可以用gitlab自己搭建一個類似于Github一樣的系統(tǒng),一般用于在企業(yè)、學(xué)校等內(nèi)部網(wǎng)絡(luò)搭建git私服。
功能:Gitlab 是一個提供代碼托管、提交審核和問題跟蹤的代碼管理平臺。對于軟件工程質(zhì)量管理非常重要。
版本:GitLab 分為社區(qū)版(CE) 和企業(yè)版(EE)。
配置:建議CPU2核,內(nèi)存2G以上。
Gitlab的服務(wù)構(gòu)成:
Nginx:靜態(tài)web服務(wù)器。
gitlab-shell:用于處理Git命令和修改authorized keys列表。(Ruby)
gitlab-workhorse: 輕量級的反向代理服務(wù)器。(go)
GitLab Workhorse是一個敏捷的反向代理。它會處理一些大的HTTP請求,比如文件上傳、文件下載、Git push/pull和Git包下載。其它請求會反向代理到GitLab Rails應(yīng)用,即反向代理給后端的unicorn。
logrotate:日志文件管理工具。
postgresql:數(shù)據(jù)庫。
redis:緩存數(shù)據(jù)庫。
sidekiq:用于在后臺執(zhí)行隊列任務(wù)(異步執(zhí)行)。(Ruby)
unicorn:An HTTP server for Rack applications,GitLab Rails應(yīng)用是托管在這個服務(wù)器上面的。(Ruby Web Server,主要使用Ruby編寫)
GitLab安裝
yum安裝
官方源地址:https://about.gitlab.com/downloads/#centos6
清華大學(xué)鏡像源:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce
添加yum源
cat> /etc/yum.repos.d/gitlab-ce.repo<< EOF
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
gpgcheck=0
enabled=1
EOF
安裝依賴包
yum install curl policycoreutils-python openssh-server
安裝
yum makecache #清楚緩存
yum install gitlab-ce
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Verifying : gitlab-ce-11.10.4-ce.0.el7.x86_64 1/1
Installed:
gitlab-ce.x86_64 0:11.10.4-ce.0.el7
Complete!
更改訪問地址
vim /etc/gitlab/gitlab.rb
external_url 'http://10.10.10.7'
重新加載配置
[root@gitlab ~]# gitlab-ctl reconfigure
啟動gitlab-ce
[root@gitlab ~]# gitlab-ctl start
ok: run: alertmanager: (pid 11797) 49s
ok: run: gitaly: (pid 11683) 53s
ok: run: gitlab-monitor: (pid 11743) 52s
ok: run: gitlab-workhorse: (pid 11713) 53s
ok: run: logrotate: (pid 11061) 117s
ok: run: nginx: (pid 10999) 123s
ok: run: node-exporter: (pid 11727) 52s
ok: run: postgres-exporter: (pid 11887) 48s
ok: run: postgresql: (pid 10422) 173s
ok: run: prometheus: (pid 11764) 51s
ok: run: redis: (pid 10081) 185s
ok: run: redis-exporter: (pid 11754) 51s
ok: run: sidekiq: (pid 10840) 135s
ok: run: unicorn: (pid 10753) 141s
第一次進(jìn)入要求設(shè)置密碼
gitlab常用命令
gitlab-ctl start # 啟動所有 gitlab 組件;
2 gitlab-ctl stop # 停止所有 gitlab 組件;
3 gitlab-ctl restart # 重啟所有 gitlab 組件;
4 gitlab-ctl status # 查看服務(wù)狀態(tài);
5 vim /etc/gitlab/gitlab.rb # 修改gitlab配置文件;
6 gitlab-ctl reconfigure # 重新編譯gitlab的配置;
7 gitlab-rake gitlab:check SANITIZE=true --trace # 檢查gitlab;
8 gitlab-ctl tail # 查看日志;
9 gitlab-ctl tail nginx/gitlab_access.log