1,由于gitlab编译安装涉及的依赖包太多,其官方给了一键安装脚本,安装以下nginx
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install gitlab-ce
gitlab-ctl reconfigure
gitlab-ctl status
gitlab-ctl stop
gitlab-ctl startgit
2,gitlab用久了不免会遇到迁移,以升级机器配置之类的,如下是迁移过程(该迁移过程对应以上一键安装的gitlab):ruby
备份过程很是简单. 使用一条命令便可建立完整的Gitlab备份:bash
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
gitlab-rake gitlab:backup:create ssh
上条命令会在/var/opt/gitlab/backups目录下建立一个名称相似为1505718169_gitlab_backup.tar的压缩包, 这个压缩包就是Gitlab整个的完整部分, 其中开头的1505718169是备份建立的日期.curl
恢复过程以下:ide
在新系统安装以前备份相同版本的gitlabgitlab
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.4.4-ce.0.el7.x86_64.rpmurl
yum install -y gitlab-ce-8.4.4-ce.0.el7.x86_64.rpmspa
gitlab-ctl reconfigure 启动gitlab
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
cd /var/opt/gitlab/backups/
chown git 1505718169_gitlab_backup.tar
gitlab-rake gitlab:backup:restore BACKUP=1505718169 将以前的备份恢复
gitlab-ctl start 启动服务
升级过程
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.5-ce.0.el7.x86_64.rpm
chmod 2770 /var/opt/gitlab/git-data/repositories
(不然报错.
Error executing action `run` on resource 'ruby_block[directory resource: /var/opt/gitlab/git-data/repositories]')
rpm -Uvh gitlab-ce-9.5.5-ce.0.el7.x86_64.rpm
gitlab-ctl reconfigure 启动
gitlab-ctl restart 重启服务
gitlab迁移升级会丢失用户原先提交的ssh key,迁移后须要从新提交才可以使用。