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'] = 'xxxxxx@163.com'
......
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "xxxxxx@163.com"
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"] = "xxxxxx@163.com"

 

只要修改配置文件就要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

 

修改完密碼之后,使用新的密碼登錄

 

 

 登錄之后,效果如下:

 

最后,附上 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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM