在 CentOS 虚拟机中安装内核开发

在 CentOS 虚拟机中安装内核开发

我尝试在 Mac OS 主机的 CentOS VM 中安装 Parallels 工具并收到以下错误消息,

An error occurred while installing the following packages:  │         
        │ - kernel-devel-2.6.32-279.14.1.el6.i686                     │         
        │ - dkms                                                      │         
        │                                                             │         
        │ Install these packages manually and start the Parallels     │         
        │ Tools installation again. 

我尝试安装dkms并收到提供的错误消息,

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirror.dhakacom.com
 * extras: mirror.dhakacom.com
 * updates: mirror.dhakacom.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dkms.noarch 0:2.4.0-1.20170926git959bd74.el6 will be installed
--> Processing Dependency: elfutils-libelf-devel for package: dkms-2.4.0-1.20170926git959bd74.el6.noarch
--> Running transaction check
---> Package elfutils-libelf-devel.i686 0:0.164-2.el6 will be installed
--> Processing Dependency: elfutils-libelf(x86-32) = 0.164-2.el6 for package: elfutils-libelf-devel-0.164-2.el6.i686
--> Running transaction check
---> Package elfutils-libelf.i686 0:0.152-1.el6 will be updated
--> Processing Dependency: elfutils-libelf(x86-32) = 0.152-1.el6 for package: elfutils-libs-0.152-1.el6.i686
--> Processing Dependency: elfutils-libelf(x86-32) = 0.152-1.el6 for package: elfutils-0.152-1.el6.i686
---> Package elfutils-libelf.i686 0:0.164-2.el6 will be an update
--> Running transaction check
---> Package elfutils.i686 0:0.152-1.el6 will be updated
---> Package elfutils.i686 0:0.164-2.el6 will be an update
---> Package elfutils-libs.i686 0:0.152-1.el6 will be updated
---> Package elfutils-libs.i686 0:0.164-2.el6 will be an update
--> Processing Dependency: libz.so.1(ZLIB_1.2.2.3) for package: elfutils-libs-0.164-2.el6.i686
--> Running transaction check
---> Package zlib.i686 0:1.2.3-27.el6 will be updated
--> Processing Dependency: zlib = 1.2.3-27.el6 for package: zlib-devel-1.2.3-27.el6.i686
---> Package zlib.i686 0:1.2.3-29.el6 will be an update
--> Running transaction check
---> Package zlib-devel.i686 0:1.2.3-27.el6 will be updated
---> Package zlib-devel.i686 0:1.2.3-29.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch     Version                          Repository
                                                                           Size
================================================================================
Installing:
 dkms                    noarch   2.4.0-1.20170926git959bd74.el6   epel    78 k
Installing for dependencies:
 elfutils-libelf-devel   i686     0.164-2.el6                      base    32 k
Updating for dependencies:
 elfutils                i686     0.164-2.el6                      base   255 k
 elfutils-libelf         i686     0.164-2.el6                      base   204 k
 elfutils-libs           i686     0.164-2.el6                      base   251 k
 zlib                    i686     1.2.3-29.el6                     base    73 k
 zlib-devel              i686     1.2.3-29.el6                     base    44 k

Transaction Summary
================================================================================
Install       2 Package(s)
Upgrade       5 Package(s)

Total download size: 936 k
Is this ok [y/N]: y
Downloading Packages:
http://download.fedoraproject.org/pub/epel/6/i386/Packages/d/dkms-2.4.0-1.20170926git959bd74.el6.noarch.rpm: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
(2/7): elfutils-0.164-2.el6.i686.rpm                     | 255 kB     00:00     
(3/7): elfutils-libelf-0.164-2.el6.i686.rpm              | 204 kB     00:00     
(4/7): elfutils-libelf-devel-0.164-2.el6.i686.rpm        |  32 kB     00:00     
(5/7): elfutils-libs-0.164-2.el6.i686.rpm                | 251 kB     00:00     
(6/7): zlib-1.2.3-29.el6.i686.rpm                        |  73 kB     00:00     
(7/7): zlib-devel-1.2.3-29.el6.i686.rpm                  |  44 kB     00:00     


Error Downloading Packages:
  dkms-2.4.0-1.20170926git959bd74.el6.noarch: failure: Packages/d/dkms-2.4.0-1.20170926git959bd74.el6.noarch.rpm from epel: [Errno 256] No more mirrors to try.

之后,我尝试安装kernel-devel-2.6.32-279.14.1.el6.i686yum收到以下错误消息,

$ yum install kernel-devel-2.6.32-279.14.1.el6.i686

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirror.dhakacom.com
 * extras: mirror.dhakacom.com
 * updates: mirror.dhakacom.com
Setting up Install Process
No package kernel-devel-2.6.32-279.14.1.el6.i686 available.
Error: Nothing to do

需要澄清的是,这两个实例安装均不成功。然后,我奔跑,

$ yum install kernel-headers之后,我可以dkms使用前面提到的命令安装。

然后,我检查虚拟机中安装的内核开发版本,

$ yum list kernel-devel

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirror.dhakacom.com
 * extras: mirror.dhakacom.com
 * updates: mirror.dhakacom.com
Installed Packages
kernel-devel.i686                  2.6.32-754.2.1.el6                   @updates

kernel-devel-2.6.32-279.14.1.el6.i686那么如何在CentOS机器上安装呢?我对 Linux 没有太多经验,所以如果有任何错误,请通知我。

相关内容