gitlab的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm
gitlab-ctl reconfigure
gitlab-ctl start
gitlab-ctl restart
gitlab-ctl stop
备份操作
$ sudo gitlab-rake gitlab:backup:create
Gitlab恢复操作
[root@code-server backups]
# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
[root@code-server backups]
# gitlab-ctl stop sidekiq
ok: down: sidekiq: 1s, normally up
[root@localhost ~]# mv 1541520439_2018_11_07_11.3.5_gitlab_backup.tar /var/opt/gitlab/backups
[root@localhost ~]# gitlab-rake gitlab:backup:restore BACKUP=1541520439_2018_11_07_11.3.5
[root@code-server backups]
# gitlab-ctl start
恢复命令完成后,可以check检查一下恢复情况
[root@code-server backups]
# gitlab-rake gitlab:check SANITIZE=true
gitlab仓库存储位置的修改方法
gitlab通过rpm包安装后,默认存储位置在/var/opt/gitlab/git-data/repositories,通常需要更改此路径到单独的一个分区来存储仓库的数据。
例如我这里把数据存放到/data/gitlab目录下
创建/data/gitlab目录
1 | mkdir -p /data/gitlab |
修改gitlab配置文件,找到git_data_dir
1 | vim /etc/gitlab/gitlab.rb |
在git_data_dir下面添加一句git_data_dir "/data/gitlab"
停止当前gitlab,重新加载配置
1 2 | gitlab-ctl stop gitlab-ctl reconfigure |
重新加载后,会发现在/data/gitlab目录下多出一个repositories目录
最后启动gitlab即可
1 | gitlab-ctl start |