天天看點

ubuntu 安裝和配置 GitLab一、概述二、安裝

一、概述

GitLab 是一個基于 Web 的開源 Git 軟體倉庫管理器,用 Ruby 編寫,包括 wiki,問題管理,代碼審查,監控以及持續內建和部署。它使開發人員能夠建立,審查和部署他們的項目。

有三種不同版本的 GitLab 可用,社群版 (CE) ,企業版 (EE) 和 GitLab 托管版本。

如果你想遠離 GitHub , GitLab 是首選。它可以從不同的來源導入項目和問題,包括 GitHub ,這使得遷移過程無憂無慮。 GitLab 界面設計精良,幹淨,直覺,并且在使用者體驗和功能方面與 GitHub 相近。

根據所需的用例,有幾種方法可以安裝 GitLab 。本教程介紹了使用 Omnibus 軟體包在 Ubuntu 18.04 系統上安裝和配置 GitLab (CE) 所需的步驟。

二、安裝

官方的建議是使用腳本直接執行安裝,對于網絡不好的情況,還是直接下載下傳安裝包吧。

下載下傳安裝包,通路連結:

https://packages.gitlab.com/gitlab/gitlab-ce

這裡選擇最新版本,gitlab-ce_12.1.4-ce.0_amd64.deb

wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/xenial/gitlab-ce_12.1.4-ce.0_amd64.deb/download.deb           

複制

本地安裝

dpkg -i gitlab-ce_12.1.4-ce.0_amd64.deb           

複制

出現以下提示,表示安裝成功

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


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

複制

修改配置檔案

vim /etc/gitlab/gitlab.rb           

複制

修改以下資訊

external_url 'http://192.168.10.123:80'
......
gitlab_rails['time_zone'] = 'Asia/Shanghai'
gitlab_rails['gitlab_email_from'] = '[email protected]'
......
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "111111" # 用戶端授權密碼
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
......
user["git_user_email"] = "[email protected]"           

複制

隻要修改配置檔案就要reconfigure

sudo gitlab-ctl reconfigure           

複制

檢視狀态

root@ubuntu:~# gitlab-ctl status
run: alertmanager: (pid 12758) 66s; run: log: (pid 12379) 219s
run: gitaly: (pid 12684) 70s; run: log: (pid 11883) 357s
run: gitlab-monitor: (pid 12721) 69s; run: log: (pid 12309) 240s
run: gitlab-workhorse: (pid 12708) 70s; run: log: (pid 12226) 264s
run: grafana: (pid 12781) 65s; run: log: (pid 12538) 113s
run: logrotate: (pid 12259) 253s; run: log: (pid 12268) 252s
run: nginx: (pid 12242) 259s; run: log: (pid 12250) 258s
run: node-exporter: (pid 12715) 69s; run: log: (pid 12296) 244s
run: postgres-exporter: (pid 12770) 65s; run: log: (pid 12399) 213s
run: postgresql: (pid 12004) 349s; run: log: (pid 12016) 346s
run: prometheus: (pid 12732) 69s; run: log: (pid 12351) 225s
run: redis: (pid 11840) 367s; run: log: (pid 11847) 364s
run: redis-exporter: (pid 12725) 69s; run: log: (pid 12330) 232s
run: sidekiq: (pid 12200) 271s; run: log: (pid 12211) 270s
run: unicorn: (pid 12171) 277s; run: log: (pid 12189) 276s           

複制

通路web頁面

初次通路Web頁面會強制讓你改密碼,初始使用者名/密碼:root/5iveL!fe

ubuntu 安裝和配置 GitLab一、概述二、安裝

修改完密碼之後,使用新的密碼登入

ubuntu 安裝和配置 GitLab一、概述二、安裝

 登入之後,效果如下:

ubuntu 安裝和配置 GitLab一、概述二、安裝

最後,附上 GitLab 常用指令:

常用指令 說明
sudo gitlab-ctl reconfigure 重新加載配置,每次修改/etc/gitlab/gitlab.rb檔案之後執行
sudo gitlab-ctl status 檢視 GitLab 狀态
sudo gitlab-ctl start 啟動 GitLab
sudo gitlab-ctl stop 停止 GitLab
sudo gitlab-ctl restart 重新開機 GitLab
sudo gitlab-ctl tail 檢視所有日志
sudo gitlab-ctl tail nginx/gitlab_acces.log 檢視 nginx 通路日志
sudo gitlab-ctl tail postgresql 檢視 postgresql 日志

本文參考連結:

https://www.jianshu.com/p/49f60698b411