zoukankan      html  css  js  c++  java
  • Fedora 21 安装VirtualBox

    注: 所有操作需要root权限  如果不是root用户在下面所有命令前加sudo

    dkms,kernel-devel,makecache:

    yum install dkms
    yum install kernel-devel
    yum makecache

    下载VirtualBox    https://www.virtualbox.org/wiki/Linux_Downloads  并安装:

    yum localinstall VirtualBox-4.3-4.3.8_92456_fedora18-1.x86_64.rpm -y

    安装完成,创建虚拟机并启动时遇到错误:

    The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing
    
    '/etc/init.d/vboxdrv setup'
    
    as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.

    于是编译 VirtualBox 内核:

      [root@dev-zhanghua zhanghua]# /etc/init.d/vboxdrv setup
      Stopping VirtualBox kernel modules [ OK ]
      Uninstalling old VirtualBox DKMS kernel modules [ OK ]
      Trying to register the VirtualBox kernel modules using DKMS[ OK ]
      Starting VirtualBox kernel modules [ OK ]

     如果出现以下错误, 是找不到内核对应的 kernel headers或内核版本不一致:

    Stopping VirtualBox kernel modules                         [  OK  ]  
    Uninstalling old VirtualBox DKMS kernel modules            [  OK  ]  
    Trying to register the VirtualBox kernel modules using DKMSError! echo  
    Your kernel headers for kernel 3.18.7-200.fc21.x86_64 cannot be found at  
    /lib/modules/3.18.7-200.fc21.x86_64/build or /lib/modules/3.18.7-200.fc21.x86_64/source.  
                                                               [FAILED]  
      (Failed, trying without DKMS)  
    Recompiling VirtualBox kernel modules                      [FAILED]  
      (Look at /var/log/vbox-install.log to find out what went wrong)

    查看内核版本:

      [root@dev-zhanghua zhanghua]# uname -r
      3.18.7-200.fc21.x86_64

    查看已安装的内核版本:

      [root@dev-zhanghua zhanghua]# rpm -qa|grep headers
      kernel-headers-3.17.8-200.fc21.x86_64
      glibc-headers-2.20-7.fc21.x86_64

    发现版本不一致, 安装 kernel-headers-3.18.7-200.fc21.x86_64

    yum install kernel-headers-3.18.7-200.fc21.x86_64

    重启后二者版本一致: 

    [root@dev-zhanghua zhanghua]# uname -r
    3.18.7-200.fc21.x86_64
    [root@dev-zhanghua zhanghua]# rpm -qa|grep headers
    kernel-headers-3.18.7-200.fc21.x86_64
    glibc-headers-2.20-7.fc21.x86_64

     再次编译, 结果正常(编译VirtualBox 内核,如果失败,可能需要再次安装 dkms ):

      [root@dev-zhanghua zhanghua]# /etc/init.d/vboxdrv setup
      Stopping VirtualBox kernel modules [ OK ]
      Uninstalling old VirtualBox DKMS kernel modules [ OK ]
      Trying to register the VirtualBox kernel modules using DKMS[ OK ]
      Starting VirtualBox kernel modules [ OK ]

     或者再次检查kernel, kernel-modules, kernel-core, kernel-headers, kernel-devel版本是否与uname -r版本一致

    [root@dev-zhanghua kernels]# uname -r
    3.17.4-301.fc21.x86_6
    [root@dev-zhanghua kernels]# rpm -qa|grep kernel
    kernel-3.17.4-301.fc21.x86_64
    kernel-modules-3.17.4-301.fc21.x86_64
    kernel-headers-3.17.4-301.fc21.x86_64
    kernel-core-3.17.4-301.fc21.x86_64
    kernel-devel-3.17.4-301.fc21.x86_64
  • 相关阅读:
    HDU 2563 统计问题 (DFS + 打表)
    KendoUi中KendoDropDownList控件的使用——三级级联模块的实现
    POJ 1325 && ZOJ 1364--Machine Schedule【二分图 && 最小点覆盖数】
    crontab FAQ
    思科2960trunk vlan配置及路由IP配置
    hdoj-1593-find a way to escape【数学题】
    Java编程思想(四) —— 复用类
    在 Android 应用程序中使用 SQLite 数据库以及怎么用
    Swift Standard Library Reference.pdf
    VC、IE、ASP环境下打印、预备的完美解决方式
  • 原文地址:https://www.cnblogs.com/inthedark/p/4389166.html
Copyright © 2011-2022 走看看