centos 7.2 部署并升级gitlab
事由:
老git服务器centos 7.2上的git版本是8.13.5,先特在一台测试机centos 7.2上安装git 8.13.5 后,还原git后,在对测试服务器上git进行升级操作。
测试服务器git升级没有问题后,在对正式git进行升级。
gitlab服务器上查看各个版本的最后版本:https://packages.gitlab.com/gitlab/gitlab-ce
升级版本步骤 8.13.5-》8.17.8(8中最大的版本)-》9.5.9(9中最大的版本)-》10.8.7(10中最大版本)暂时不升级11版本。
1、测试服务器安装git
1 2 3 | 安装gitlab-ce-8.13.5-ce.0.el7.x86_64 #curl -s https: //packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh |bash #yum install gitlab-ce-8.13.5-ce.0.el7.x86_64 |
也可以是国内的镜像地址
1 2 3 4 5 6 7 8 | [root@t101 yum.repos.d]# more gitlab_gitlab-ce.repo [gitlab-ce] name=gitlab-ce baseurl=http: //mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7 repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https: //packages.gitlab.com/gpg.key |
2、备份老的git
1 2 3 4 5 6 | 备份数据 #/opt/gitlab/bin/gitlab-rake gitlab:backup:create 执行后在/ var /opt/gitlab/backups目录创建一个名称类似为1502357536_2019_01_10__gitlab_backup.tar的压缩包 备份配置文件 #/etc/gitlab/gitlab.rb 配置文件须备份 #/ var /opt/gitlab/nginx/conf nginx配置文件 |
3、还原git数据和配置文件
将测试服务器gitlab和nginx配置文件备份
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1、将备份文件权限修改为777第一步,将备份文件权限修改为777,不然可能恢复的时候会出现权限不够,不能解压的问题 chmod 777 1502357536_2017_08_10_9.4.3_gitlab_backup.tar 2、执行命令停止相关数据连接服务 第二步,执行命令停止相关数据连接服务 # 停止相关数据连接服务 gitlab-ctl stop unicorn gitlab-ctl stop sidekiq 3、执行命令从备份文件中恢复Gitlab 第三步,执行命令从备份文件中恢复Gitlab gitlab-rake gitlab:backup:restore BACKUP=备份文件编号 例如我们的备份文件的编号是1502357536_2017_08_10_9.4.3,因此执行下面的命令即可恢复gitlab gitlab-rake gitlab:backup:restore BACKUP=1502357536_2017_08_10_9.4.3 出现交互页面,输入yes回车。 4、恢复完成后,启动gitlab gitlab-ctl reconfigure gitlab-ctl start |
还原时报错
1 2 3 | [root@t101 ~]# gitlab-rake gitlab:backup:restore BACKUP=1548270207 no backups found The specified backup doesn't exist! |
解决方式
先执行一下备份操作后,在执行还原
1 | [root@t101 ~]# gitlab-rake gitlab:backup:create |
在 /var/opt/gitlab/backups中生成文件,同时将copy过来的文件到该目录下。
4、 升级到gitlab-ce-8.17.8-ce.0.el7.x86_64
1 2 3 4 5 6 7 | #curl -s https: //packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash #yum update gitlab-ce-8.17.8-ce.0.el7.x86_64 gitlab-ctl reconfigure 中有项目目录报错同时页面502错误,需要执行下面的chmod chmod 2770 /home/data/git/git-data/repositories gitlab-ctl reconfiguregitlab-ctl pg-upgradegitlab-ctl start 登录页面查看版本是否正确 |
5、升级到gitlab-ce-9.5.9-ce.0.el7.x86_64
1 2 3 4 5 | #curl -s https: //packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash #yum update gitlab-ce-9.5.9-ce.0.el7.x86_64 #gitlab-ctl reconfigure #gitlab-ctl start 登录页面查看版本是否正确 |
6、升级到gitlab-ce-10.8.7-ce.0.el7.x86_64
1 2 3 4 5 | #curl -s https: //packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash #yum update gitlab-ce-10.8.7-ce.0.el7.x86_64 #gitlab-ctl reconfigure #gitlab-ctl start 登录页面查看版本是否正确 |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端