GitLab CE安裝
安裝比較簡單,rpm直接在不同平台安裝
https://about.gitlab.com/installation/
直接下載下傳源包位址
https://about.gitlab.com/downloads/archives/
安裝
#yum install curl openssh-server openssh-clients postfix cronie
#service postfix start
#chkconfig postfix on
#lokkit -s http -s ssh
#rpm -i gitlab-ce-XXX.rpm
GitLab加載配置與啟動
#gitlab-ctl reconfigure
#gitlab-ctl start/restart
GitLab日志檢視
#gitlab-ctl tail nginx
#gitlab-ctl tail unicorn
GitLab CE 備份與恢複
備份
gitlab-rake gitlab:backup:create
可設定自動備份任務
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:creat
更改預設路徑,可以在
/etc/gitlab/gitlab.rb
檔案的
gitlab_rails['backup_path']
項中進行設定,預設為
/var/opt/gitlab/backups
。
恢複
# 停止需要連接配接資料庫的服務
#gitlab-ctl stop unicorn
#gitlab-ctl stop sidekiq
# 恢複備份的資料,重寫資料庫内容
# GitLab 8.15 版本以前所用的時間戳格式為 EPOCH (1393513186)
#gitlab-rake gitlab:backup:restore BACKUP=1459620009
# 或# GitLab 8.15 版本以後所用的時間戳格式為 EPOCH_YYYY_MM_DD (1491415349_2017_04_06)
# gitlab-rake gitlab:backup:restore BACKUP=1491415349_2017_04_06
# 啟動 GitLabsudo gitlab-ctl start
# 檢查 GitLab 是否正常運作
#gitlab-rake gitlab:check SANITIZE=true
GitLab CE遷移與更新
遷移可參考備份與恢複,需要注意的是:版本号一定要一緻
更新
跨版本更新在這裡不過多介紹,如大版本9,更新過程下載下傳相關安裝包進行安裝,自動會完成更新
GitLab CE 使用小節
1、項目位址為localhost
#vi /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: localhost
port: 80
https: false
2、merge 、chekout 出現以下錯誤:
GitLab: The project you were looking for could not be found.
此類錯誤多出現在git-data挂載軟連結導緻
如我的挂載 /var/opt/gitlab -> /data/gitlab, 修改參照以下
# /etc/gitlab/gitlab.rb
......
git_data_dirs({ "default" => { "path" => "</data/gitlab/git-data>", 'gitaly_address' => 'unix:/var/opt/gitlab/gitaly/gitaly.socket' } })
......