1.下载virtualbox的yum源 请

http://www.92wiki.com/hdwiki/doc-view-106




1.下载virtualbox的yum源 请访问http://www.92wiki.com

切换到/etc/yum.repos.d/ 并下载 VirtualBox repo到当前目录.

[root@Linux ]# cd /etc/yum.repos.d/
[root@Linux ]# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo  

2.确认当前源内容中gpgcheck is enabled (gpgcheck=1)并修正gpg key路径: 想知道更多内容:

[root@Linux ]# cat virtualbox.repo
[virtualbox]
name=RHEL/CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/rhel/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc 
请访问http://www.92wiki.com 

以下为可选项,至少我没用:
请访问http://www.92wiki.com

Verify the fingerprint of the gpg key in order confirm that the key downloaded belongs to virtualbox.org. In the command below the character surrounded by a dashes before the pipe is an uppercase letter "O" (not zero):

[root@Linux ]# wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | gpg --quiet --with-fingerprint
pub  1024D/98AB5139 2010-05-18 Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>
      Key fingerprint = 7B0F AB3A 13B9 0743 5925  D9C9 5442 2A4B 98AB 5139
sub  2048g/281DDC4B 2010-05-18
  

Go to http://pgp.mit.edu/ and in the search string enter virtualbox.org, and checkmark "Show PGP fingerprints for keys". Confirm that the key fingerprint matches the one above for the addresses info@virtualbox.org:

Type bits/keyID     Date       User ID

pub  1024D/98AB5139 2010-05-18 Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>
	 Fingerprint=7B0F AB3A 13B9 0743 5925  D9C9 5442 2A4B 98AB 5139 

pub  1024D/6DFBCBAE 2008-07-14 Sun Microsystems, Inc. (xVM VirtualBox archive signing key) <info@virtualbox.org>
	 Fingerprint=AF45 1228 01DA D613 29EF  9570 DCF9 F87B 6DFB CBAE 
  

As you can see there are two keys found for info@virtualbox.org with the most recent key being the one that matches. Also notice that the key ID (98AB5139) shown in the output from pgp.mit.edu matches the key ID shown in the previous command. 请访问http://www.92wiki.com


在安装前查询下VirtualBox包相关信息:

[root@Linux ]# yum info VirtualBox-4.1
Available Packages
Name        : VirtualBox-4.1
Arch        : i686
Version     : 4.1.8_75467_rhel6
Release     : 1
Size        : 58 M
Repo        : virtualbox
Summary     : Oracle VM VirtualBox
URL         : http://www.virtualbox.org/
License     : GPLv2
Description : VirtualBox is a powerful PC virtualization solution allowing
            : you to run a wide range of PC operating systems on your Linux
            : system. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
            : and others. VirtualBox comes with a broad feature set and
            : excellent performance, making it the premier virtualization
            : software solution on the market.
 想知道更多内容: 

3.具体的安装过程:

[root@Linux ]# yum install VirtualBox-4.1
Setting up Install Process
.
<snip>
.
Downloading Packages:
VirtualBox-4.1-4.1.8_75467_rhel6-1.i686.rpm              |  58 MB     01:08     
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 98ab5139: NOKEY
Retrieving key from http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
Importing GPG key 0x98AB5139:
 Userid: "Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>"
 From  : http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
Is this ok [y/N]: y
.
<snip>
.
Creating group 'vboxusers'. VM users must be member of that group!

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.

Stopping VirtualBox kernel modules [  OK  ]
Uninstalling old VirtualBox DKMS kernel modules [  OK  ]
Trying to register the VirtualBox kernel modules using DKMS [FAILED]
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules [FAILED]
  (Look at /var/log/vbox-install.log to find out what went wrong)

Installed:
  VirtualBox-4.1.i686 0:4.1.8_75467_rhel6-1                                     

Complete!
  

(note that the second failed entry above shows that a problem which you might not experience on your system did occur for us. We'll address this shortly)

Finally don't forget to add your user account to the newly created vboxusers group, where "username" is the Linux user that you are adding to this group:

[root@Linux ]# /usr/sbin/usermod -a -G vboxusers username  

注:以上3个步骤即可完成virtualbox的安装

以下为可能遇到的问题解决方法
请访问http://www.92wiki.com

Although this problem may not occur for your environment, in ours we can see from the output above that something failed and we are advised to examine /var/log/vbox-install.log to see what went wrong. In our case it tells us the following: 请访问http://www.92wiki.com

"unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again."

We were able to fix the issue by completing the following additional steps (if you don't experience this problem you can skip to the end).

Install the following three packages (kernel-headers, kernel-devel, gcc):

[root@Linux ]# yum install kernel-headers kernel-devel gcc 
请访问http://www.92wiki.com 

Your system will install the packages above if they aren't installed already, plus the package dependencies. Next confirm the version of your current kernel release:

[root@Linux ]# uname -r
2.6.32-220.2.1.el6.i686
  

Check /usr/src/kernels/ to confirm that a directory for the version of your current kernel release exists (this directory should exist after the installation of the packages above):

ls /usr/src/kernels/
2.6.32-220.2.1.el6.i686
  

Above we see a match for "2.6.32-220.2.1.el6.i686". Specify and export the KERN_DIR parameter making sure to match the release version with whichever one is current for your system: 请访问http://www.92wiki.com

[root@Linux ]# KERN_DIR=/usr/src/kernels/2.6.32-220.2.1.el6.i686
[root@Linux ]# export KERN_DIR  

Echo KERN_DIR to confirm that you've set it up properly:

[root@Linux ]# echo $KERN_DIR
/usr/src/kernels/2.6.32-220.2.1.el6.i686
  

Finally re-run vboxdrv setup. This step may take a while to complete:

[root@Linux ]# /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules                         [  OK  ]
Uninstalling old VirtualBox DKMS kernel modules            [  OK  ]
Removing old VirtualBox pci kernel module                  [  OK  ]
Removing old VirtualBox netadp kernel module               [  OK  ]
Removing old VirtualBox netflt kernel module               [  OK  ]
Removing old VirtualBox kernel module                      [  OK  ]
Trying to register the VirtualBox kernel modules using DKMS[FAILED]
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules                      [  OK  ]
Starting VirtualBox kernel modules                         [  OK  ]
  

(the FAILED entry above for DKMS does not matter since recompiling the VirtualBox kernel modules succeeded). 请访问http://www.92wiki.com

Lastly don't forget to add your user account to the vboxusers group if you haven't done so already:

[root@Linux ]# /usr/sbin/usermod -a -G vboxusers username  


成功

Through the CentOS GUI you can start VirtualBox by clicking on Applications | System Tools | Oracle VM VirtualBox. If the first time when creating a new guest OS you get an error saying that it failed to access the USB subsystem, as a test try to access the /dev/vboxusb directory. If you get a message saying permission denied yet you are in the vboxusers group and the permission for /dev/vboxusb is correct (drwxr-x--- with ownership root:vboxusers), open a terminal window and enter the "id" command. If in the output you don't see the group vboxusers appear, log out and log back into CentOS for the group membership changes to take effect. 请访问http://www.92wiki.com

Read the security guide section of the VirtualBox documentation, notably the risk of enabling 3D graphics via the guest additions if you are going to be using VirtualBox for testing malware: 想知道更多内容:

"Untrusted guest systems should not be allowed to use VirtualBox's 3D acceleration features, just as untrusted host software should not be allowed to use 3D acceleration. Drivers for 3D hardware are generally too complex to be made properly secure and any software which is allowed to access them may be able to compromise the operating system running them. In addition, enabling 3D acceleration gives the guest direct access to a large body of additional program code in the VirtualBox host process which it might conceivably be able to use to crash the virtual machine."

In CentOS 5 you could perform RPM rollbacks in the event that an update caused a conflict with VirtualBox, by editing /etc/yum.conf and adding the line tsflags=repackage to it, and also editing /etc/rpm/macros and adding %_repackage_all_erasures 1 in it. In CentOS 6 this option no longer works. Instead you must use the "yum history" commands to do RPM rollbacks. The yum history databases are normally found in /var/lib/yum/history/.

Although this article isn't meant to be a tutorial on how to use VirtualBox, the screen capture below shows what you need to do in order to use an ISO file instead of a CD or DVD-ROM for building a new guest operating system.

想知道更多内容:

If you wish to control VirtualBox through the command line, use the extensive vboxmanage command (simply enter the command with no parameters to see its options, although you'll likely need to skim through chapter 8 of the VirtualBox user manual). If you wish to remotely control VirtualBox through a GUI, some options include setting up vncserver or nx (preferably tunnelled over ssh) on CentOS. There are also some third party software made specifically for providing a remote GUI for VirtualBox (remotebox, vboxremote, phpvirtualbox -- note that we cannot vouch for any of this software including whether or not they are kept up to date with the latest version of VirtualBox). Lastly you can use the vboxheadless command in order to remotely display the VMs over RDP.

Lastly note that whenever you install kernel updates you'll need to rerun the command /etc/init.d/vboxdrv setup


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值