设为首页 收藏本站
查看: 730|回复: 0

[经验分享] Installing Virtualbox 4.1 on CentOS 6.2

[复制链接]

尚未签到

发表于 2015-4-14 08:47:49 | 显示全部楼层 |阅读模式
Installing Virtualbox 4.1 on CentOS 6.2


January 9, 2012

  This article will show you how to install VirtualBox 4.1 on a fresh installation of CentOS 6.2 Linux. In the tutorial below VirtualBox is installed immediately after having installed CentOS 6.2 (desktop setup) and rebooting it after having applied all the latest OS updates.
  The following steps will need to be done with the root account.

Installation
  Change to the /etc/yum.repos.d/ directory and download
the VirtualBox repo file into your yum repository. With this you'll be
able to install VirtualBox through yum and updates for VirtualBox will
also be included whenever you run the yum update command:

[iyunv@Linux ]# cd /etc/yum.repos.d/
[iyunv@Linux ]# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
  Take a look at the contents of the downloaded repo file to confirm that gpgcheck is enabled (gpgcheck=1) and to verify the location of the gpg key:

[iyunv@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
  The following steps are optional: 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):

[iyunv@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)
      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)
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)
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.
  Another optional step is to review the information of the VirtualBox package before proceeding with the installation (this will confirm the minor version):

[iyunv@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.
  Proceed with installing VirtualBox (the command below is case sensitive). When prompted about the GPG key enter Y as long as the key ID matches the one above:

[iyunv@Linux ]# yum install VirtualBox-4.1
Setting up Install Process
.

.
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) "
From  : http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
Is this ok [y/N]: y
.

.
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:

[iyunv@Linux ]# /usr/sbin/usermod -a -G vboxusers username
Problems which some may encounter
  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:
  "unable to find the sources of your current Linux kernel. Specify KERN_DIR= 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):

[iyunv@Linux ]# yum install kernel-headers kernel-devel gcc
  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:

[iyunv@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:

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

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

[iyunv@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:

[iyunv@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).
  Lastly don't forget to add your user account to the vboxusers group if you haven't done so already:

[iyunv@Linux ]# /usr/sbin/usermod -a -G vboxusers username
Success
  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.
  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

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-56930-1-1.html 上篇帖子: VirtualBox使用常用设置 下篇帖子: ubuntu下安装virtualbox
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表