从centos 6升级到centos 7步骤(升级失败)
===============================================
风险:
===============================================
系统:
ssh、yum不可用,需按文末步骤安装
数据:
从实验来看,不会清空 /opt、/home、/var 目录下的用户数据,部分应用(如Jenkins)会自动更新版本
===============================================
详细步骤:
===============================================
查看版本对应关系:
https://www.cnblogs.com/emanlee/p/13594584.html
下载 centos 7.8 ISO
https://mirrors.tuna.tsinghua.edu.cn/centos/7.8.2003/isos/x86_64/CentOS-7-x86_64-DVD-2003.iso
1、查看当前CentOS版本
cat /etc/redhat-release
CentOS release 6.4 (Final)
2、更新源
vim /etc/yum.repos.d/upgrade.repo
并输入以下内容:
[upgrade]
name=upgrade
baseurl=https://buildlogs.centos.org/centos/6/upg/x86_64/
enable=1
gpgcheck=0
3、卸载6.x自带的较新的助手,并安装老版[否则会报错]
yum erase openscap -y
4、安装助手
yum install redhat-upgrade-tool preupgrade-assistant-contents -y
5、检测版本升级的风险,如果控制台输出了错误信息,则需要查询下解决方案并解决
preupg -s CentOS6_7
Do you want to continue? y/n
Assessment finished (time 01:50s)
I/O warning : failed to load external entity "/usr/share/openscap/xsl/security-guide.xsl"
compilation error: file /usr/share/preupgrade/xsl/preup.xsl line 40 element import
xsl:import : unable to load /usr/share/openscap/xsl/security-guide.xsl
I/O warning : failed to load external entity "/usr/share/openscap/xsl/oval-report.xsl"
compilation error: file /usr/share/preupgrade/xsl/preup.xsl line 41 element import
xsl:import : unable to load /usr/share/openscap/xsl/oval-report.xsl
I/O warning : failed to load external entity "/usr/share/openscap/xsl/sce-report.xsl"
compilation error: file /usr/share/preupgrade/xsl/preup.xsl line 42 element import
xsl:import : unable to load /usr/share/openscap/xsl/sce-report.xsl
OpenSCAP Error:: Could not parse XSLT file '/usr/share/preupgrade/xsl/preup.xsl' [oscapxml.c:416]
Unable to open file /root/preupgrade/result.html
Usage: preupg [options]
preupg: error: [Errno 2] No such file or directory: '/root/preupgrade/result.html'
6、导入CentOS7的key
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
7、开始升级(升级失败)
centos-upgrade-tool-cli --network 7 --instrepo=http://vault.centos.org/centos/7.7.1908/os/x86_64/
本地更新:
centos-upgrade-tool-cli --iso=/home/soft_sda4/CentOS-7-x86_64-DVD-2003.iso
错误提示
setting up repos...
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/tmp/system-upgrade/base/mirrorlist.txt
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/tmp/system-upgrade/extras/mirrorlist.txt
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/tmp/system-upgrade/updates/mirrorlist.txt
No upgrade available for the following repos: base extras updates
.treeinfo | 353 B 00:00
getting boot images...
Downloading failed: invalid data in .treeinfo: No section: 'checksums'
8、国内服务器需经过漫长的等待
9、更新完后,重启服务器
先看下面的问题,再重启
reboot
===============================================
升级完成后遇到的问题:
===============================================
1、ssh、yum不可用问题:
vi /root/start.sh #输入以下内容:
#!/bin/bash
ln -s /usr/lib64/libsasl2.so.3.0.0 /usr/lib64/libsasl2.so.2
ln -s /usr/lib64/libpcre.so.1.2.0 /usr/lib64/libpcre.so.0
service sshd restart
rm -rf /etc/rc.d/rc.local
mv /etc/rc.d/rc.local.bak /etc/rc.d/rc.local #恢复原始文件
rm -rf /root/start.sh #删除自身
#执行以下命令
chmod +x start.sh
chmod +x /etc/rc.d/rc.local
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak #创建备份
echo 'bash /root/start.sh' >>/etc/rc.d/rc.local #添加脚本为开机自启动
#重启,后看下ssh是否可以正常连接
reboot
2、 ps工具不可用问题:
yum upgrade -y
yum downgrade grep
yum upgrade python
yum update
===============================================
REF
https://blog.csdn.net/hjnth/article/details/82946845
https://blog.csdn.net/QingKong999/article/details/79114925
https://blog.csdn.net/u011643449/article/details/85560273