005. gitlab安裝
阿新 • • 發佈:2021-10-09
1. gitlab介紹
官方網站: www.gitlab.com
gitlab是一款使用ruby編寫的程式碼版本管理系統,他可以通過web介面來管理程式碼.
2. gitlab安裝
官方安裝文件: https://about.gitlab.com/install/
建議: 在企業環境中,gitlab一定要儘可能使用一臺獨立的伺服器進行管理.因為gitlab是用於儲存程式碼的. 需要謹慎.
1. 安裝gitlab yum install -y curl policycoreutils-python openssh-server systemctl enable sshd systemctl start sshd 2. 啟用postfix(官方文件寫的安裝.此步可以跳過.) yum install postfix -y systemctl enable postfix systemctl start postfix 3.防火牆規則(開啟防火牆才配置,沒開防火牆不用配置.) firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https systemctl reload firewalld
2.1 使用gitlab包來安裝.
gitlab安裝包: https://packages.gitlab.com/gitlab/gitlab-ce
清華安裝源: https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/ [選擇 yum版] 這裡什麼版本都有.
建議gitlab安裝在一臺獨立伺服器中.
#1. 依賴包安裝 yum install curl policycoreutils openssh-server openssh-clients policycoreutils-python #2. 下載gitlab包 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.6-ce.0.el7.x86_64.rpm 上傳到伺服器 #3. 安裝gitlab rpm -ivh gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm [root@master tools]# rpm -ivh gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm warning: gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY Preparing... ################################# [100%] Updating / installing... 1:gitlab-ce-10.2.2-ce.0.el7 ################################# [100%] It looks like GitLab has not been configured yet; skipping the upgrade script. git安裝完成. #4. 配置檔案: ls /etc/gitlab/gitlab.rb vim /etc/gitlab/gitlab.rb 修改: external_url 'http://gitlab.example.com' #網址改為 當前主機IP: external_url 'http://10.0.0.63' 修改後必須執行重新配置: 命令: gitlab-ctl reconfigure 出現: Running handlers complete Chef Client finished, 382/541 resources updated in 01 minutes 52 seconds gitlab Reconfigured! ##代表配置成功了 #4. 啟動gitlab: [root@master tools]# gitlab-ctl status run: gitaly: (pid 25917) 151s; run: log: (pid 25672) 178s run: gitlab-monitor: (pid 25933) 150s; run: log: (pid 25775) 171s run: gitlab-workhorse: (pid 25905) 151s; run: log: (pid 25571) 197s run: logrotate: (pid 25609) 184s; run: log: (pid 25608) 184s run: nginx: (pid 25591) 190s; run: log: (pid 25590) 190s run: node-exporter: (pid 25720) 177s; run: log: (pid 25719) 177s run: postgres-exporter: (pid 25962) 149s; run: log: (pid 25829) 163s run: postgresql: (pid 25351) 241s; run: log: (pid 25350) 241s run: prometheus: (pid 25948) 150s; run: log: (pid 25810) 164s run: redis: (pid 25279) 247s; run: log: (pid 25278) 247s run: redis-exporter: (pid 25790) 170s; run: log: (pid 25789) 170s run: sidekiq: (pid 25554) 203s; run: log: (pid 25553) 203s run: unicorn: (pid 25516) 205s; run: log: (pid 25515) 205s #啟動gitlab: [root@master tools]# gitlab-ctl restart ok: run: gitaly: (pid 26704) 0s ok: run: gitlab-monitor: (pid 26715) 0s ok: run: gitlab-workhorse: (pid 26724) 1s ok: run: logrotate: (pid 26733) 0s ok: run: nginx: (pid 26740) 1s ok: run: node-exporter: (pid 26746) 0s ok: run: postgres-exporter: (pid 26752) 1s ok: run: postgresql: (pid 26761) 0s ok: run: prometheus: (pid 26804) 0s ok: run: redis: (pid 26813) 1s ok: run: redis-exporter: (pid 26817) 0s ok: run: sidekiq: (pid 26831) 0s ok: run: unicorn: (pid 26840) 1s #狀態: [root@master tools]# gitlab-ctl status run: gitaly: (pid 26704) 43s; run: log: (pid 25672) 418s run: gitlab-monitor: (pid 26715) 43s; run: log: (pid 25775) 411s run: gitlab-workhorse: (pid 26724) 43s; run: log: (pid 25571) 437s run: logrotate: (pid 26733) 42s; run: log: (pid 25608) 424s run: nginx: (pid 26740) 42s; run: log: (pid 25590) 430s run: node-exporter: (pid 26746) 41s; run: log: (pid 25719) 417s run: postgres-exporter: (pid 26752) 41s; run: log: (pid 25829) 403s run: postgresql: (pid 26761) 40s; run: log: (pid 25350) 481s run: prometheus: (pid 26804) 40s; run: log: (pid 25810) 404s run: redis: (pid 26813) 40s; run: log: (pid 25278) 487s run: redis-exporter: (pid 26817) 39s; run: log: (pid 25789) 410s run: sidekiq: (pid 26831) 37s; run: log: (pid 25553) 443s run: unicorn: (pid 26855) 36s; run: log: (pid 25515) 445s 啟動成功後,通過web瀏覽器進行訪問:
啟動gitlab訪問結果:
![image-20191216020648122](
啟動後第一次進入gitlab會讓你更改管理員密碼[預設使用者root]:
gitlab介面
相關軟體包
gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm
05.gitlab_01.gitlab介紹與gitlab安裝.pdf
支付寶讚賞