使用CentOS最新的安装镜像CentOS 7.3在测试环境安装了一台服务器,然后安装一堆软件。然后安装P软件时报错:找不到vxlan内核模块。
之前在CentOS 7.2上都安装好好的。要么重新安装服务器,要么给7.3降低到7.2的内核。
查看当前内核版本:
[root@controller ~]# uname -r
3.10.0-514.2.2.el7.x86_64
查看当前发行版本:
[root@controller ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
降低内核版本
解压安装镜像,获取内核软件包:
kernel-3.10.0-327.el7.x86_64.rpm
kernel-tools-3.10.0-327.el7.x86_64.rpm
kernel-tools-libs-3.10.0-327.el7.x86_64.rpm
先安装这2个包:
kernel-tools-3.10.0-327.el7.x86_64.rpm
kernel-tools-libs-3.10.0-327.el7.x86_64.rpm
再安装kernel-3.10.0-327.el7.x86_64.rpm
yum install kernel-3.10.0-327.el7.x86_64.rpm
如果yum install命令安装失败就使用rpm -ivh --force *.rpm 命令强制安装
可以查看到安装的2个版本的内核:
[root@controller ~]# rpm -qa|grep -i kernel-3.10.0-
kernel-3.10.0-327.el7.x86_64.rpm
kernel-3.10.0-514.2.2.el7.x86_64
把7.3的内核卸载:
[root@controller ~]# rpm -ev kernel-3.10.0-514.2.2.el7.x86_64
这时候只能查看一个结果:
[root@controller ~]# rpm -qa|grep -i kernel-3.10.0-
kernel-3.10.0-327.el7.x86_64.rpm
再用rpm -ea 或者 yum remove命令卸载其他内核相关的包
rpm -ea kernel-tools-libs-3.10.0-514.2.2.el7.x86_64
rpm -ea kernel-tools-3.10.0-514.2.2.el7.x86_64
降低发行版本:
[root@controller ~]# wget ftp://ftp.icm.edu.pl/vol/rzm5/linux-slc/centos/7.1.1503/updates/x86_64/Packages/centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm
--2017-01-10 11:17:32-- ftp://ftp.icm.edu.pl/vol/rzm5/linux-slc/centos/7.1.1503/updates/x86_64/Packages/centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm
=> 'centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm'
Resolving ftp.icm.edu.pl (ftp.icm.edu.pl)... 193.219.28.2, 2001:6a0:0:31::2
Connecting to ftp.icm.edu.pl (ftp.icm.edu.pl)|193.219.28.2|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /vol/rzm5/linux-slc/centos/7.1.1503/updates/x86_64/Packages ... done.
==> SIZE centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm ... 23516
==> PASV ... done. ==> RETR centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm ... done.
Length: 23516 (23K) (unauthoritative)
100%[============================================================>] 23,516 89.8KB/s in 0.3s
2017-01-10 11:17:51 (89.8 KB/s) - 'centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm' saved [23516]
[root@controller ~]# ls
admin-openrc.sh centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm demo-openrc.sh
anaconda-ks.cfg cirros-0.3.4-x86_64-disk.img
[root@controller ~]#
[root@controller ~]# rpm -ivh centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm--force
Preparing... ################################# [100%]
Updating / installing...
1:centos-release-7-2.1511.el7.cento################################# [100%]
可以查看到安装的2个发行版本:
[root@controller ~]# rpm -qa|grep -i centos-release-7-
centos-release-7-3.1611.el7.centos.x86_64
centos-release-7-2.1511.el7.centos.2.10.x86_64
把7.3的发行版本卸载:
[root@controller ~]# rpm -ev centos-release-7-3.1611.el7.centos.x86_64
Preparing packages...
centos-release-7-3输出.1611.el7.centos.x86_64
这时候只能查看一个结果:
[root@controller ~]# rpm -qa|grep -i centos-release-7-
centos-release-7-2.1511.el7.centos.2.10.x86_64
验证
查看此时的内核版本:
[root@controller ~]# uname -r
3.10.0-514.2.2.el7.x86_64
查看此时的发行版本:
[root@controller ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
重启:
[root@controller ~]# reboot
然后安装P软件时就没有报错。所以在工作中尽量不要随意使用最新版本的软件(比如Win10 ,CentOS,Openstack 等等),尤其是生产环境。