個人系統是centos6.8的系統,先配置yum源:html
https://mirror.tuna.tsinghua.edu.cn/help/epel/ 這裏寫的配置epel源比較詳細我就不寫了,寫下gitlab的源的內容:mysql
新建 /etc/yum.repos.d/gitlab-ce.repo,添加如下內容:git
[gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6 repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https://packages.gitlab.com/gpg.key
若是是7就把baseurl換成這個地址就行其餘都同樣的:sql
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/ 數據庫
https://about.gitlab.com/downloads/#centos7 官方的7安裝方式 能夠選擇系統版本查看vim
先安裝依賴包centos
yum install curlopenssh-server openssh-clients postfix cronie –y service postfix start 啓動服務 chkconfig postfi xon 設置開機啓動 安裝主包 yum install gitlab-ce –y 社區版
Host 必定要加本身的主機名的解析瀏覽器
/etc/gitlab/gitlab.rb 修改這裏裏面的配置bash
external_url'http://192.168.61.128' 我只修改了url這裏由於我沒有域名就寫了IP地址。運維
其餘的配置本身百度吧貌似不少配置都註釋了。
每次修改完了/etc/gitlab/gitlab.rb這個配置都要執行一個命令gitlab-ctl reconfigure 讓配置生效 會出不少消息等等完成。下面是運行完成了命令的結果
gitlab-ctl start|stop|status|restart
做爲一個運維備份是必須的,出了問題,須要及時恢復,備份配置和數據兩個部分
配置就是etc/gitlab裏面的文件
直接運行
tar -zPcf $(date "+etc-gitlab_%Y%m%d_%H%M%S.tar.gz") /etc/gitlab
打包備份就行
備份數據文件:
默認數據備份目錄是/var/opt/gitlab/backups,手動建立備份文件:
# Omnibus 方式安裝使用如下命令備份
gitlab-rakegitlab:backup:create
平常備份,添加 /etc/crontab,運行vim /etc/crontab
# 天天1點執行備份
0 1 * * * root /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
如要修改備份週期和目錄,在/etc/gitlab/gitlab.rb中修改如下兩個選項(修改配置後記得運行gitlab-ctl reconfigure)
# 設置備份週期爲7天 - 604800秒,計算器本身計算7天默認的
gitlab_rails['backup_keep_time']= 604800
# 備份目錄的修改
gitlab_rails['backup_path']= '/backups'
還有不少其餘選擇須要本身百度查找了。
恢復以前:確保備份文件所安裝 GitLab 和當前要恢復的 GitLab 版本一致。首先,恢復配置文件(就是把之前打包的解包放到gitlab目錄替換):
cat/opt/gitlab/embedded/service/gitlab-rails/VERSION 這個是查看版本的信息。
配置文件我就不寫了直接恢復就好了
數據的恢復:
# 中止鏈接數據庫的進程
gitlab-ctl stop unicorn gitlab-ctl stop sidekiq
# 恢復1484121231這個備份文件,將覆蓋GitLab數據庫的所有內容!
gitlab-rake gitlab:backup:restore BACKUP=1484121231
#會讓你選擇yes no
輸入yes後
# 啓動 GitLab服務
gitlab-ctl restart
# 檢查 GitLab服務正常否
gitlab-rake gitlab:check SANITIZE=true
最後我登錄查看正常
參考:https://about.gitlab.com/downloads/#centos6
https的配置 http://shaonian.blog.51cto.com/2975261/1891919
數據庫換mysql配置 http://shaonian.blog.51cto.com/2975261/1894664
smtp郵箱的配置:https://doc.gitlab.cc/omnibus/settings/smtp.html#qq-exmail