2014年2月24日月曜日

CentOS 6.5 にVirtualboxをインストール

Xenや、VMWareではなくて今回はVirtualBoxをCentOSにインストールしてみます。 

yumリポジトリにVirtualBoxリポジトリを追加

[user@localhost ~]$ sudo vi /etc/yum.repos.d/virtualbox.repo

[virtualbox]
name=RHEL/CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/rhel/$releasever/$basearch
enabled=0
gpgcheck=1
gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc

キーを取得

[user@localhost ~]$ wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
[user@localhost ~]$ sudo rpm --import oracle_vbox.asc
[user@localhost ~]$ rm -r oracle_vbox.asc

インストール

[user@localhost ~]$ yum --enablerepo=virtualbox install VirtualBox
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
virtualbox                                                                                                                        |  951 B     00:00     
virtualbox/primary                                                                                                                | 5.7 kB     00:00     
virtualbox                                                                                                                                         22/22
Setting up Install Process
No package VirtualBox available.
Error: Nothing to do

見つからない・・・。ので検索してみる。


[user@localhost ~]$ yum --enablerepo=virtualbox search VirtualBox

Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
================================================================ N/S Matched: VirtualBox ================================================================
VirtualBox-3.2.i686 : Oracle VM VirtualBox
VirtualBox-4.0.i686 : Oracle VM VirtualBox
VirtualBox-4.1.i686 : Oracle VM VirtualBox
VirtualBox-4.2.i686 : Oracle VM VirtualBox
VirtualBox-4.3.i686 : Oracle VM VirtualBox

  Name and summary matches only, use "search all" for everything.

最新版を指定してインストール


[user@localhost ~]$ yum --enablerepo=virtualbox install VirtualBox-4.3.i686                                                                                 
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Setting up Install Process

~依存関係は省略~

================================================================================
 Package              Arch       Version                 Repository        Size
================================================================================
Reinstalling:
 VirtualBox-4.3       i686       4.3.6_91406_el6-1       virtualbox        72 M

Transaction Summary
================================================================================
Reinstall     1 Package(s)

Total download size: 72 M
Installed size: 146 M
Is this ok [y/N]: y
Downloading Packages:
VirtualBox-4.3-4.3.6_91406_el6-1.i686.rpm                |  72 MB     03:06     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : VirtualBox-4.3-4.3.6_91406_el6-1.i686                        1/1 

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  ]
Recompiling VirtualBox kernel modules [  OK  ]
Starting VirtualBox kernel modules [  OK  ]
  Verifying  : VirtualBox-4.3-4.3.6_91406_el6-1.i686                        1/1 

Installed:
  VirtualBox-4.3.i686 0:4.3.6_91406_el6-1                                       

Complete!

バージョンを確認


[user@localhost ~]$ vboxmanage -v
4.3.6r91406
ただ、vboxmanage -vで時に以下のようなメッセージが表示される
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (2.6.32-431.el6.i686) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /etc/init.d/vboxdrv setup

         You will not be able to start VMs until this problem is fixed.
こんな時は恐らく、gcc、kernel-develいずれか(もしくはどちらも)がインストールされていない事が原因でrecompileが出来ない状態です。 以下のようにgcc、kernel-develをインストール後、再起動してから、VirtualBoxをreinstallしてみてください。

[user@localhost ~]$ yum install kernel-devel gcc

~可能なら再起動~

[user@localhost ~]$ yum reinstall VirtualBox-4.3

0 件のコメント:

コメントを投稿