GitLab 是一個基於 Web 的開源 Git 軟件倉庫管理器,用 Ruby 編寫,包括 wiki,問題管理,代碼審查,監控以及持續集成和部署。它使開發人員可以建立,審查和部署他們的項目。node
有三種不一樣版本的 GitLab 可用,社區版 (CE) ,企業版 (EE) 和 GitLab 託管版本。nginx
若是你想遠離 GitHub , GitLab 是首選。它能夠從不一樣的來源導入項目和問題,包括 GitHub ,這使得遷移過程無憂無慮。 GitLab 界面設計精良,乾淨,直觀,而且在用戶體驗和功能方面與 GitHub 相近。git
根據所需的用例,有幾種方法能夠安裝 GitLab 。本教程介紹了使用 Omnibus 軟件包在 Ubuntu 18.04 系統上安裝和配置 GitLab (CE) 所需的步驟。github
官方的建議是使用腳本直接執行安裝,對於網絡很差的狀況,仍是直接下載安裝包吧。web
下載安裝包,訪問連接:redis
https://packages.gitlab.com/gitlab/gitlab-cesql
這裏選擇最新版本,gitlab-ce_12.1.4-ce.0_amd64.debubuntu
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/xenial/gitlab-ce_12.1.4-ce.0_amd64.deb/download.deb
本地安裝vim
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頁面會強制讓你改密碼,初始用戶名/密碼: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 日誌 |
本文參考連接: