0%

安装Gitlab

安装

安装Gitlab 社区版本。选择操作系统,并选择安装源。

安装源及安装方法参考https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/

如迁移,需要相同版本的Gitlab。故在选择安时指定版本。

Ubuntu 列举出安装的软件版本,

1
2
3
4
apt-cache policy <<package name>>
apt-get install package=version
# 例如
apt-get install autoconf=2.50

CentOS 安装软件版本,

1
2
yum list | grep mariadb
yum install mariadb-5.5.56-2.el7.x86_64

迁移

备份原GIT服务器数据

1
gitlab-rake gitlab:backup:create RAILS_ENV=production 

默认备份后文件一般位于/var/opt/gitlab/backups/,文件名:1513578325_2017_12_18_gitlab_backup.tar

新服务器上安装与原服务器一样版本的Gitlab

将步骤1生成的tar文件拷贝到新服务器上相应的backups目录下

新GitLab服务数据恢复

1
2
3
4
# This command will overwrite the contents of your GitLab database!
gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1513578325_2017_12_18
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true

设置

可以指定仓库及备份的位置,防止磁盘占用过大。

打开/etc/gitlab/gitlab.rb 打开 git_data_dir选项。

注意

gitlab 会占用80端口,如果本机有80端口占用,会无法访问服务。需调整。旗下有很多服务,要注意。