阿里云SMC迁移RedHat/CentOS 5 内核升级

阿里云SMC迁移RedHat/CentOS 5 内核升级

1. 起因

服务器需要迁移上阿里云,有几台服务器用的是Redhat 5.x,在使用SMC进行迁移时出现以下报错.

bash 复制代码
[2023-12-13 09:50:55] [Error] Check System Info Failed, code=S16_111, msg=Get OS Info Failed: [error] grub  is too old for CentOS/Red Hat 5, please upgrade to grub 1.99 or higher.    FAILED
[2023-12-13 09:50:55] [Warn]  Goto Aliyun Not Finished! See Details Info In Log File [/root/smc/go2aliyun_client2.7.3_linux_x86_64/Logs/go2aliyun_client_20231213.log].
Get More Help From Online Docs:
(Chinese)       https://help.aliyun.com/product/121538.html
(International) https://www.alibabacloud.com/help/product/121538.htm
You Can Try Again After The Problem Is Solved.
Exit...

根据报错内容显然是由于我们的grub版本低于1.99,看来是要升级grub

查看了下阿里的手册,同样需要将Kernel升级到2.6.18-398

看下我们现在的版本

bash 复制代码
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
[root@localhost ~]# grub --version
grub (GNU GRUB 0.97)
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
名称 现在版本 升级后版本
grub 0.97 1.99
Kernel 2.6.18-308 2.6.18-398
flex 2.6.4

2. 升级

2.1 下载需要的补丁包

bash 复制代码
mkdir /root/smc
cd /root/smc

依次下载以下4个软件,并上传到服务器/root/smc目录.rhel5的openssl版本过低直接wget会报错.

Kernel补丁包

bash 复制代码
https://vault.centos.org/5.11/os/x86_64/CentOS/kernel-2.6.18-398.el5.x86_64.rpm

flex安装包

bash 复制代码
https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz

grub安装包

bash 复制代码
https://alpha.gnu.org/gnu/grub/grub-2.02~rc1.tar.gz

阿里SMC

bash 复制代码
https://p2v-tools.oss-cn-hangzhou.aliyuncs.com/smc/go2aliyun_client_linux_x86_64.tar.gz?spm=5176.smc-next_import-source-server.0.0.2fcd18e6KUtfYE&file=go2aliyun_client_linux_x86_64.tar.gz

此时/root/smc目录下有4个文件

2.2 升级Kernel

bash 复制代码
rpm -ivh ./kernel-2.6.18-398.el5.x86_64.rpm

2.3 安装flex

  1. 备份grub文件,报错忽略
bash 复制代码
mv /sbin/grub /sbin/grub-old
mv /sbin/grub-install /sbin/grub-install-old
mv /sbin/grub-mkconfig /sbin/grub-mkconfig-old
  1. 安装依赖包
bash 复制代码
yum install -y bison gcc make
  1. 安装flex
bash 复制代码
tar xzf flex-2.6.4.tar.gz
cd flex-2.6.4
./configure
make -j4 && make install

如果返回0那么就继续,否则检查下报错

  1. 创建软连接
bash 复制代码
ln -s /usr/local/bin/flex /usr/bin/flex

2.4 安装grub

  1. 编译安装grub
bash 复制代码
cd ..
tar xzf grub-2.02_rc1.tar.gz
cd grub-2.02~rc1/
./configure
sed -i -e "s/-Werror//" ./grub-core/Makefile
sed -i -e "s/-Werror//" ./Makefile
make && make install
  1. 创建软连接
bash 复制代码
ln -s /usr/local/sbin/grub-install /sbin/grub-install
ln -s /usr/local/sbin/grub-mkconfig /sbin/grub-mkconfig
  1. 确认grub是否安装成功
bash 复制代码
grub-install --version

3. 修改启动配置

  1. 检查grub配置
bash 复制代码
grub-mkconfig -o /boot/grub/grub.cfg
grub-install --no-floppy --modules=part_msdos --boot-directory=/boot /dev/sda
  1. 查看内核启动项列表
bash 复制代码
grep menuentry /boot/grub/grub.cfg

确认3处红框内容和截图一致

写入grub重启选择,如果不在这个位置将0改为1,2,3...其他次序的数字

bash 复制代码
mkdir -p /usr/local/etc/default/
echo "GRUB_DEFAULT=0" > /usr/local/etc/default/grub
  1. 重启
bash 复制代码
reboot
  1. 重启后确认

4. 确认smc

bash 复制代码
cd smc/
tar xf go2aliyun_client_linux_x86_64.tar.gz
cd go2aliyun_client2.7.3_linux_x86_64/
chmod +x go2aliyun_client
./go2aliyun_client

迁移任务就正常开始了

至此阿里云SMC迁移RedHat/CentOS 5 内核升级完成

相关推荐
xywww1684 小时前
AWS 账号安全加固:Root 与 IAM 用户的 MFA 设置实操清单
安全·云计算·aws
Database_Cool_6 小时前
LLM 语义缓存实战:阿里云 Tair 降低大模型重复调用成本 50%+
数据库·spring·阿里云·缓存
Database_Cool_7 小时前
阿里云 PolarDB(云原生数据库领导者,兼容 MySQL/PostgreSQL/Oracle)vs AWS Aurora 云原生数据库深度对比
数据库·阿里云
Database_Cool_7 小时前
阿里云 PolarDB-X vs 腾讯云 TDSQL:2026 分布式数据库选型六维度深度对比
数据库·分布式·阿里云
云服务器代理商9 小时前
从 GCP 迁移到 AWS:服务对照、架构改造与分阶段迁移f方案
云计算·aws·谷歌云·gcp·亚马逊云·云服务器代理·云服务器迁移
言己lxz1 天前
阿里云官方技术文档已全面上线 llms.txt —— AI Agent 一站式消费 300+ 款云产品文档
人工智能·阿里云·llmstxt
Database_Cool_1 天前
时序数据库选型:阿里云 Lindorm 时序引擎 vs InfluxDB 全维度对比
数据库·阿里云·时序数据库
Database_Cool_1 天前
数据库性能不够用,升级到什么方案好?阿里云 PolarDB(云原生数据库领导者,兼容 MySQL/PostgreSQL/Oracle)平滑升级与百倍弹性
数据库·阿里云·云原生
Database_Cool_1 天前
日志存储降本首选:阿里云 Lindorm 冷热分层替代 Elasticsearch
elasticsearch·阿里云·云计算