CentOS 7 安装VirtualBox

来源:互联网 发布:最好笑知乎 编辑:程序博客网 时间:2024/06/10 11:10

昨天给centos6.5装VirtualBox,装了一天也没,今天闲着没事,试试centos7,结果成功了 PS 小弟也是初学linux,许多地方只是找到了解决方法,但不知道为什么,莫见

怪O(∩_∩)O哈!

1、安装centos7,这个就不说了,centos7的安装比旧版本简单的多。

2、连网设置,刚装完centos后用ifconfig查看发现没有ip地址,解决办法:

    cd /etc/sysconfig/network-scripts/

    vi ifcfg-eno16777736 #注意,我们平常见的都是ifcfg_eth0,具体是什么,用ifconfig看看。

    ONBOOT=yes    #将onboot设为yes

    然后重启网卡: /etc/init.d/network restart

2、安装virtualbox:

    1> 下载VirtualBox的RHEL软件库配置文件:

[cpp] view plaincopyprint?
 
  1. cd /etc/yum.repos.d  
  2. wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo  

    2> 安装RPMForge.

      首先从http://pkgs.repoforge.org/rpmforge-release/上下载相应的rpm文件,我下载的是rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm,具体版本

      信息请参考:http://wiki.centos.org/zh/AdditionalResources/Repositories/RPMForge。

[cpp] view plaincopyprint?
 
  1. rpm -ivh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm  

    3> 安装DKMS(Dynamic Kernel Module)    

[python] view plaincopyprint?
 
  1. yum install dkms  

    4> 安装开发环境和内核:

[cpp] view plaincopyprint?
 
  1. yum groupinstall "Development Tools"   
  2. yum install kernel-devel  

     5> 安装qt和qt-

[cpp] view plaincopyprint?
 
  1. yum install qt qt-x11  
    6> 安装VirtualBox

      我是先在官网下载下来的,版本是VirtualBox-4.3-4.3.26_98988_el7-1.x86_64.rpm, https://www.virtualbox.org/wiki/Downloads

[cpp] view plaincopyprint?
 
  1. yum install VirtualBox-4.3-4.3.26_98988_el7-1.x86_64.rpm  

    7> 安装扩展:    

[cpp] view plaincopyprint?
 
  1. VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.16-95972.vbox-extpack   

      这个地方就出问题了。

VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ExtPackFile, interface IExtPackFile, callee nsISupports
VBoxManage: error: Context: "Install(fReplace, NULL, ptrProgress.asOutParam())" at line 1140 of file VBoxManageMisc.cpp

但此时系统中已有virtualbox了,所以说这个问题可以忽略,继续接下来的。  

[cpp] view plaincopyprint?
 
  1.       8> /etc/init.d/vboxdrv setup  

     这里又出现了错误:

Building the VirtualBox Guest Additions kernel modules [FAILED] 
Your system does not seem to be set up to build kernel modules. 
Look at /var/log/vboxadd-install.log to find out what went wrong. 
Once you have corrected it, you can run /etc/init.d/vboxadd setup to build them. 
查看错误日志:
/tmp/vbox.o/Makefile.include.header:97: *** 
Error: unable to find the source of your current Linux kernel.Specify KERN_DIR=<directory> and run make again. Stop.

    解决办法:

 

[cpp] view plaincopyprint?
 
  1.     yum install kernel  
  2.     yum install kernel-devel<span><span>  
  3.     yum install kernel-headers   
  4. </span></span>     yum install gcc*   
  5.     yum install make  
  6.     reboot  

  重启

[cpp] view plaincopyprint?
 
  1. /etc/init.d/vboxdrv setup  

   大功告成!

0 0
原创粉丝点击