linux之Centos6升级至centos7_centos6升级centos7-程序员宅基地

技术标签: linux环境软件安装  centos-upgrade  升级  centos6  centos7  

一、需求说明

  centos官方于2020年12月2号停止了所有centos6更新维护,为了继续享受更新服务,redhat提供了一个redhat-upgrade-tool的升级工具,支持将centos6升级到centos7。centos8停止维护更新时间2021年12月31号,centos7停止更新维护时间为2024年6月30号。centos停止更新后取而代之的是CentOS Stream。
示例环境说明:

  • 升级前版本:centos6.5
  • 升级后版本:centos7.0

二、升级步骤

0、查看操作系统版本

[root@localhost ~]# cat /etc/centos-release
CentOS release 6.5 (Final)

1、更换YUM源

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://files.tttidc.com/centos6/Centos-6.repo

2、安装升级软件工具

官方下载地址,一般网络从官方下载速度实在是慢得无法忍受。
下载地址一:官网下载地址
下载地址二:>CSDN下载地址
下载rpm包后上传到服务器解压后安装
[root@localhost opt]# yum localinstall preupgrade-assistant-* -y
[root@localhost opt]# yum localinstall redhat-upgrade-tool* -y

3、检测系统可否升级

[root@localhost opt]# preupg -l
CentOS6_7

4、运行模拟升级工具

[root@localhost opt]# preupg -s CentOS6_7
Preupg tool doesn’t do the actual upgrade.
Please ensure you have backed up your system and/or data in the event of a failed upgrade
that would require a full re-install of the system from installation media.
Do you want to continue? y/n
y #此处输入y
Gathering logs used by preupgrade assistant:
All installed packages : 01/11 …finished (time 00:00s)
All changed files : 02/11 …finished (time 02:44s)
Changed config files : 03/11 …finished (time 00:00s)
All users : 04/11 …finished (time 00:00s)
All groups : 05/11 …finished (time 00:00s)
Service statuses : 06/11 …finished (time 00:00s)
All installed files : 07/11 …finished (time 00:02s)

Tarball with results is stored here /root/preupgrade-results/preupg_results-210324171443.tar.gz .
The latest assessment is stored in directory /root/preupgrade .
Summary information:
We found some critical issues. In-place upgrade is not advised.
Read the file /root/preupgrade/result.html for more details.
Upload results to UI by command:
e.g. preupg -u http://127.0.0.1:8099/submit/ -r /root/preupgrade-results/preupg_results-*.tar.gz .

5、根据模拟升级的检测结果进行确认和评估

[root@localhost ~]# preupg --riskcheck --verbose

INPLACERISK: MEDIUM: We detected some packages installed on the system were removed (obsoleted) between CentOS 6 and CentOS 7. This may break the functionality of the packages depending on them.
INPLACERISK: MEDIUM: We detected some packages installed on the system were removed between CentOS 6 and CentOS 7. This may break the functionality of the packages depending on them.
INPLACERISK: MEDIUM: Package ql2200-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package libudev not provided by its replacement systemd-libs. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package coreutils-libs not provided by its replacement coreutils. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package ql2500-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package ql2100-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package rt61pci-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package ql23xx-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package bfa-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package ql2400-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package rt73usb-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: Package sane-backends-libs-gphoto2 not provided by its replacement sane-backends-drivers-cameras. In-place upgrade might not work properly, will be finished by postupgrade script!
INPLACERISK: MEDIUM: having one of [openscap tzdata redhat-menus kpartx mesa-libGLU] package installed breaks upgrade
INPLACERISK: MEDIUM: We detected some soname bumps in the libraries installed on the system. This may break the functionality of some of your 3rd party applications. They may need rebuild. Please check their requirements.
INPLACERISK: MEDIUM: We detected some .so libraries installed on the system were removed between CentOS 6 and CentOS 7. This may break the functionality of some of your 3rd party applications.
INPLACERISK: SLIGHT: We detected some files where modifications are not tracked in the rpms. You may need to check their functionality after successful upgrade.
INPLACERISK: SLIGHT: We detected some files untracked by rpms. Some of these may need manual check/migration after redhat-upgrade-tool and/or can cause conflicts or troubles during the installation. Try to reduce unnecessary untracked files before running redhat-upgrade-tool.
INPLACERISK: SLIGHT: We detected some packages installed on the system changed their name between CentOS 6 and CentOS 7. Altho h they should be compatible, monitoring after the update is recommended.
INPLACERISK: SLIGHT: export shell commands will be deleted from /etc/sysconfig/sshd
INPLACERISK: SLIGHT: Some binaries untracked by RPM were discovered on the system and may need rebuild after upgrade.
INPLACERISK: SLIGHT: Some scripts untracked by RPM were discovered on the system and may not work properly after upgrade.
INPLACERISK: SLIGHT: /usr/lib64/python2.6/site-packages/gtk-2.0 is owned by an RPM package that was not signed by CentOS.
INPLACERISK: SLIGHT: /usr/lib64/python2.6/site-packages/report is not owned by any RPM package.
INPLACERISK: SLIGHT: /usr/lib64/python2.6/site-packages/reportclient is not owned by any RPM package.

检测评估结果提示风险项,我这是初始化的centos6.5操作系统,风险提示内容都有不少。存在EXTREME错误则无法进行下一步升级操作。

7、安装升级用的centos7 rpm key

[root@localhost ~]# rpm --import http://vault.centos.org/centos/7.0.1406/os/x86_64/RPM-GPG-KEY-CentOS-7
[root@localhost ~]# centos-upgrade-tool-cli --network 7 --instrepo=http://vault.centos.org/centos/7.0.1406/os/x86_64/
setting up repos…
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:01

8、运行升级工具

只支持6.5及以上系统升级到不高于7.2系统;

  • 1)、直接从网络源进行更新

[root@localhost ~]# centos-upgrade-tool-cli --network 7 --instrepo=http://vault.centos.org/centos/7.0.1406/os/x86_64/
setting up repos…
upgradedevice | 3.6 kB 00:00 …
upgradedevice/primary_db | 2.7 MB 00:00 …
Preupgrade assistant risk check found risks for this upgrade.
You can run preupg --riskcheck --verbose to view these risks.
Addressing high risk issues is required before the in-place upgrade
and ignoring these risks may result in a broken upgrade and unsupported upgrade.
Please backup your data.

Continue with the upgrade [Y/N]? y

rpm install 100% [============================================================================================]
setting up system for upgrade
Finished. Reboot to start upgrade.

  • 2)、从本地源进行更新

    • 下载centos7.0.1406镜像iso文件

    [root@localhost home]# wget https://vault.centos.org/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-DVD.iso

    • 挂载镜像

    [root@localhost home]# mout -o -loop -t iso9660 /home/CentOS-7.0-1406-x86_64-DVD.iso /mnt/cdrom

    • 执行更新

    [root@localhost home]# centos-upgrade-tool-cli --device=/dev/cdrom

9、重启操作系统

[root@localhost home]# reboot

10、查验系统版本

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)

三、FAQ

1、安装redhat-upgrade-tool时报错File contains no section headers.

  • 报错信息:
    在这里插入图片描述
  • 问题原因:
    repo配置文件错误,缺少配置头信息
  • 解决方案:
    -将缺少的yum头信息添加上 [centos6-upgrade]

[root@localhost yum.repos.d]# cat upgradtool.repo.bak
[centos6-upgrade]
name=CentOS-$releasever - Upgrade Tool
baseurl=http://dev.centos.org/centos/6/upg/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

2、安装redhat-upgrade-tool时报错Couldn’t resolve host ‘dev.centos.org’

  • 报错信息:
    在这里插入图片描述

  • 问题原因:
    centos官网已经停止centos6相关服务,网站dev.centos.org已经停止服务。

  • 解决方案:
    按照博文步骤,手动安装redhat-upgrade-tool等rpm包。

3、模拟升级时报错

  • 报错信息:
    在这里插入图片描述

  • 问题原因:
    openscap版本太高,需要降级

  • 解决方案:
    卸载当前安装的openscap版本,下载并安装openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm

[root@localhost opt]# rpm -qa |grep openscap
openscap-1.2.13-2.el6.x86_64
[root@localhost opt]# rpm -e --nodeps openscap-1.2.13-2.el6.x86_64
[root@localhost opt]# yum localinstall openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm -y

4、模拟升级的检测结果存在关于X11的EXTREME问题

  • 报错信息:
    在这里插入图片描述

  • 问题原因:
    centos7对X11桌面环境进行了重新设计

  • 解决方案:
    因centos6作为服务器,当前安装软件没有桌面要求,选择卸载X11桌面环境。
    #yum groupremove -y “Desktop” “X Window System”

5、模拟升级的检测结果存在关于pcnet32的EXTREME问题

  • 报错信息:
    INPLACERISK: EXTREME: The kernel driver ‘pcnet32’ required to service hardware present in your system is not available in CentOS 7. This suggests that your system contains hardware that is not supported in CentOS 7 release.
  • 问题原因:
    vmware 提供的默认网卡类型是pcnet32,el7默认没有提供pcnet32的网卡驱动。
  • 解决方案:
    在vmware指定的虚拟机存储位置找到.vmx的文件,
    ethernet0.virtualDev = “pcnet32” 或是别的。将其修改为:
    ethernet0.virtualDev = “e1000”’ (如果没有添加)

四、写着最后

  centos6升级centos7跨越大版本,可能的报错实在是太多,成功的几率也不高,花费的时间成本远远大于新装机centos7的成本。实际中建议新搭建centos7环境测试部署的应用是否兼容,测试通过直接通过新装系统重新部署应用的方式升级。本人仅供学习参考,无法保证升级成功。

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/carefree2005/article/details/115176089

智能推荐

阿里巴巴MaxCompute亮相VLDB2017_阿里林晓斌所有教程-程序员宅基地

文章浏览阅读518次。点击查看全文8月28日-9月1日,第四十三届VLDB会议在德国慕尼黑举行。阿里巴巴在本届VLDB展区重点展示了MaxCompute、ApsaraDB、AliSQL、AnalyticDB和POLARDB等数据库和数据处理技术,引起现场与行业专家学者的注意和交流探讨。VLDB,全称International Conference on Very Large Da_阿里林晓斌所有教程

java transient关键字-程序员宅基地

文章浏览阅读145次。java中实现Serilizable的接口的对象可以被序列化,但是有些属性不希望被序列化,就可以在属性前加上transient关键字

Vue安装及环境配置-程序员宅基地

文章浏览阅读2.2w次,点赞30次,收藏202次。一、安装node.js官网:Download | Node.js历史版本:Previous Releases | Node.js或者下载完毕后,可以安装node,建议不要安装在系统盘(如C:)。二、设置nodejs prefix(全局)和cache(缓存)路径1、建议安装的路径不要有中文2、新建node_global和node_cache两个文件夹可以在nodejs安装路径下,新建3、设置缓存文件夹npm config set c..._vue安装及环境配置

23 FI配置-财务会计-打开和关闭过帐期间(Open and Close Posting Periods)_变式 1000 和分类帐 z0 的过帐期间 002 2023 未清-程序员宅基地

文章浏览阅读319次。业务背景:定义未清和关账过账期间事务码: OB52SPRO路径:SPRO->财务会计->总账会计->主数据->总账科目->准备->定义存留收益科目第1步,SPRO路径进入第2步, 输入期间数据1和2并保存配置完成!2021年12月25日 写于芜湖..._变式 1000 和分类帐 z0 的过帐期间 002 2023 未清

python廖雪峰_python小课堂34 - 推导式与生成器-程序员宅基地

文章浏览阅读109次。前言从本篇开始,进入 Python 的技巧篇,介绍下编程时比较 pythonic 的写法,有些写法会非常简洁,比如本文要介绍的推导式。推导式在各大教程中最常见的是列表推导式,但实际上不仅仅是列表可以进行推导,集合、字典都有着自己相应的推导式。当然,像廖雪峰老师写的教程中,对应的叫法是列表生成式,下面让我们来一一看下。案例需求老规矩,依然先给出一个案例的场景,通过此场景来介绍代码的编写与实现思路。案..._python列表推导式 廖雪峰

【DirectX 12】使用Graphics Tools和VS 2015分析应用_vs2015 graphics tools-程序员宅基地

文章浏览阅读4.1k次。Win10 预览版10122已经发布,同时NVIDIA官方正式的DX12驱动也已经发布,API也基本稳定了,DX12的开发可以进入到正常轨道上了。_vs2015 graphics tools

随便推点

size_t用法和指针类型大小_size_t和char*-程序员宅基地

文章浏览阅读1.1k次。size_t到底什么时候用呢?合理使用size_t可以提高程序的可移植性和代码的可读性。size_t在win32编译下是4字节,在x64编译下是8字节。同样的char*指针的占用空间也是如此。未完待续!..._size_t和char*

2021.1.1版idea开发webservice服务端及客户端_web ide2.1.1-程序员宅基地

文章浏览阅读3.2k次,点赞4次,收藏8次。一、服务端开发1️⃣新建一个简单的工程2️⃣一路next3️⃣工程右键4️⃣点击选择如图5️⃣选择工程,double click shift,输入 Tools6️⃣如图点击7️⃣有可能有如下现象解决方案:..._web ide2.1.1

第七届“湖湘杯”网络安全技能大赛免费赛前培训通知_湖湘杯2023-程序员宅基地

文章浏览阅读1.8k次。为了深入开展网络安全知识技能宣传普及,提高广大群众对网络安全意识和防护技能”的应对能力,挖掘和培养网络安全全能型人才,加快网络安全人才队伍建设。湖南省委网信办联合相关部门共同举办第七届“湖湘杯”网络安全技能大赛。一、组织机构主办单位:中共湖南省委网络安全和信息化委员会办公室、湖南省教育厅、湖南省广播电视局、湖南省政务管理服务局、湖南省通信管理局、长沙市人民政府承办单位:中共长沙市委网络安全和信息化委员会办公室、国家网络安全产业园区(长沙)城市网络安全运营中心、奇安星城网络安全运营服._湖湘杯2023

MySQL数据库基础爱之初体验_max_connections = 2048-程序员宅基地

文章浏览阅读204次。mysql_max_connections = 2048

H.266/VVC代码学习笔记8:VTM5.0中帧内亮度预测函数——estIntraPredLumaQT()函数_vtm fastudi-程序员宅基地

文章浏览阅读3.5k次,点赞9次,收藏31次。今天对VTM5.0中的亮度帧内预测的入口函数estIntraPredLumaQT()进行详细的学习estIntraPredLumaQT中完成了亮度分量的帧内预测,其主要流程如下:一、初始化各种参数。二、为了减少最终RDcost的次数,降低编码端的复杂度,VVC的VTM5.0版本默认使用帧内快速搜索算法,主要经过两轮的SATD的粗选阶段和一轮RDcost的细选阶段1、第一轮的SATD粗选,首..._vtm fastudi

5.1 linux内存管理-分页管理和页异常处理_mem翻页处理-程序员宅基地

文章浏览阅读1.0k次。1:信息linux - 0.11memory.c2: 代码//显示内存已用完出错信息,并退出static inline volatile void oom(void){ printk("out of memory\n\r"); do_exit(SIGSEGV); //退出码SIGSEGV(11)相同值的出错码含义是:资源暂时不可用}//刷新页变换缓冲(一般位于cache中的TLB)宏函数//为了提高地址的转换效率,cpu将最近使用的页表数据存放在芯片中高速缓冲中。在修改过页表信息后,就_mem翻页处理

推荐文章

热门文章

相关标签