个人系统是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