一、安装

1)、下载

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el7/
找到这个版本
gitlab-ee-11.7.0-ee.0.el7.x86_64.rpm

image.png

wget [https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el7/gitlab-ee-11.7.0-ee.0.el7.x86_64.rpm](https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el7/gitlab-ee-11.7.0-ee.0.el7.x86_64.rpm)

2)、安装

rpm -ivh gitlab-ee-11.7.0-ee.0.el7.x86_64.rpm

四、配置

最核心文件/etc/gitlab/gitlab.rb

  1. vim /etc/gitlab/gitlab.rb
  2. # 配置的域名
  3. external_url 'http://gitlab.domain.com:99'
  4. nginx['listen_port'] = 99
  5. nginx['listen_https'] = false
  6. # 启动基础服务
  7. systemctl start gitlab-runsvdir.service
  8. gitlab-ctl reconfigure # 重载配置文件

五、启动-常用命令

1)、先启动基础服务
systemctl start gitlab-runsvdir.service

  1. sudo gitlab-ctl start # 启动所有 gitlab 组件;
  2. sudo gitlab-ctl stop # 停止所有 gitlab 组件;
  3. sudo gitlab-ctl restart # 重启所有 gitlab 组件;
  4. sudo gitlab-ctl status # 查看服务状态;
  5. sudo gitlab-ctl reconfigure # 启动服务;
  6. sudo vim /etc/gitlab/gitlab.rb # 修改默认的配置文件;
  7. gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;
  8. sudo gitlab-ctl tail # 查看日志;

六、项目迁移

1)、备份
/opt/gitlab/bin/gitlab-rake gitlab:backup:create

2)、迁移

版本一定要一致

恢复时注意文件名不能包括 _gitlab_backup.tar
执行以下命令

  1. $ gitlab-ctl stop unicorn #停止相关数据连接服务
  2. $ gitlab-ctl stop sidekiq
  3. $ gitlab-ctl stop
  4. 必须把文件放入到
  5. /var/opt/gitlab/backups/
  6. $ chmod 777 /var/opt/gitlab/backups/1530156812_2018_06_28_10.8.4_gitlab_backup.tar
  7. #修改权限,如果是从本服务器恢复可以不修改
  8. 恢复时注意文件名不能包括 _gitlab_backup.tar
  9. $ gitlab-rake gitlab:backup:restore BACKUP=1530156812_2018_06_28_10.8.4

image.png

代表恢复完成