替换Kimsufi的OVH定制版内核为CentOS官方发行版内核

Kimsufi默认的系统模板均使用的OVH自己的定制版内核,官方介绍OVH定制版内核优化了速度和安全,但我在使用OVH定制版内核中出现一定的问题,所以我需要替换OVH的定制版内核为官方发行版内核。

1.查看查询系统中全部的内核:

# rpm -qa | grep kernel
kernel-headers-2.6.18-53.1.21.el5

2.安装 rpmbuild

#yum install rpm-build redhat-rpm-config unifdef

3.下载内核源码RPM安装包,省却编译了

http://mirror.centos.org/centos-5/5/updates/x86_64/RPMS/

http://mirror.centos.org/centos-5/5/updates/x86_64/RPMS/kernel-2.6.18-404.el5.x86_64.rpm

这里是CentOS5的内核RPM安装包,如果你是CentOS6,请下载CentOS6对应的内核RPM安装包。

4.安装内核源码RPM包

#rpm -ivh kernel-2.6.18-404.el5.x86_64.rpm

5.确定一下内核是否安装成功

#ls /boot
boot.0800 map
bzImage-2.6.24.5-xxxx-grs-ipv4-64 message
bzImage-3.14.32-xxxx-grs-ipv6-64 symvers-2.6.18-404.el5.gz
config-2.6.18-404.el5 System.map-2.6.18-404.el5
efi System.map-2.6.24.5-xxxx-grs-ipv4-64
grub System.map-3.14.32-xxxx-grs-ipv6-64
initrd-2.6.18-404.el5.img vmlinuz-2.6.18-404.el5
lost+found

看下有没有2.6.18-404的文件

6.卸载centos多余的内核

CentOS安装新内核或者升级后旧版本内核依然存在,一是浪费空间,二是会在启动时显示多个版本让用户选择,看起来比较闹心,所以可以选择把它们删掉。

①首先列出系统中正在使用的内核:

# uname -a
Linux 3.14.32-xxxx-grs-ipv6-64 #1 SMP Tue Jun 30 18:50:21 CEST 2015 x86_64 x86_64 x86_64 GNU/Linux

②查询系统中全部的内核:

# rpm -qa | grep kernel
kernel-headers-2.6.18-53.1.21.el5
kernel-2.6.18-404.el5

③将你想删除的内核删除掉。例如,在我的系统中,我要删掉kernel-2.6.18-XXX.x86_64的内核
#yum remove kernel-headers-2.6.18-53.1.21.el5

注意yum remove和rpm -e的区别在于:yum remove 会检查依赖,如果你要移除的包被别的软件包需要的话,它会把其他软件包一起移除。 而rpm -e 则会直接告诉你被别的包需要,所以无法移除,所以这里需要用yum remove。

④重启后就可以看到,内核被删掉了,同时多余的启动项也自动被删掉了。

当然,如果你需要保留OVH定制版的内核,也可以手动修改/boot/grub/grub.conf 把多余的项删除。

⑤卸载OVH定制版内核出现错误 CentOS 5.7 Missing Dependency :kernel-header解决方法

错误信息如下:

glibc-headers-2.5-81.el5_8.2.x86_64 from updates has depsolving problems
–> Missing Dependency: kernel-headers >= 2.2.1 is needed by package glibc-headers-2.5-81.el5_8.2.x86_64 (updates)
glibc-headers-2.5-81.el5_8.2.x86_64 from updates has depsolving problems
–> Missing Dependency: kernel-headers is needed by package glibc-headers-2.5-81.el5_8.2.x86_64 (updates)
Error: Missing Dependency: kernel-headers is needed by package glibc-headers-2.5-81.el5_8.2.x86_64 (updates)
Error: Missing Dependency: kernel-headers >= 2.2.1 is needed by package glibc-headers-2.5-81.el5_8.2.x86_64 (updates)
You could try using –skip-broken to work around the problem
You could try running: package-cleanup –problems
package-cleanup –dupes
rpm -Va –nofiles –nodigest

安装kernel-headers即可解决问题,下载RPM包

http://mirror.centos.org/centos-5/5/updates/x86_64/RPMS/

http://mirror.centos.org/centos-5/5/updates/x86_64/RPMS/kernel-headers-2.6.18-404.el5.x86_64.rpm

执行下面的命令,安装kernel-headers-2.6.18-404.el5.x86_64.rpm

# rpm -ivh kernel-headers-2.6.18-404.el5.x86_64.rpm

⑥安装回卸载的 gcc glibc-devel glibc-headers

# yum install gcc glibc-devel glibc-headers

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注