« 週末の陽気でいっきに開花 | メイン | めずらしくマシなJ-WAVEホリデースペシャル »

OS

VirtualBox で共有フォルダを使えるようにする

VirtualBox で共有フォルダを使えるようにする為、「Guest Additions」をインストールする。
「Guest Additions」に含まれる機能
・ゲストからホストの共有フォルダとしてアクセス可能に。
・ホスト・ゲスト間のキーボード・マウス制御をシームレスにする。
・クリップボード共有、ウィンドウリサイズ。

前提環境
ホストOS:Windows7 64bit
VirtualBox 4.3.12
ゲストOS:CentOS6.5 64bit

手順▼
●Kernel更新が必要
[root@localhost ~]# uname -r
2.6.32-431.29.2.el6.x86_64
[root@localhost ~]# yum -y update kernel*
[root@localhost ~]# shutdown -r now
環境変数 KERN_DIR 設定しなくとも再起動でOK
[root@localhost ~]# uname -r
2.6.32-504.12.2.el6.x86_64

●最低限必要な開発ツール
[root@localhost ~]# yum -y install gcc
[root@localhost ~]# yum -y install kernel-devel
[root@localhost ~]# yum -y install perl
perlがないときのエラー
	/bin/sh: perl: command not found
	make[2]: *** [/tmp/vbox.0/VBoxGuest-linux.o] Error 127
	make[1]: *** [_module_/tmp/vbox.0] Error 2
下記は不要
	yum -y install make
	yum -y install kernel-uek-devel

●仮想マシンのウィンドウのメニュー[デバイス(D)]→[Guest AdditionsのCDイメージを挿入(I)]。

●Guest Additions CDイメージのマウント
[root@localhost ~]# mkdir /mnt/cdrom
[root@localhost ~]# mount -r /dev/cdrom /mnt/cdrom
[root@localhost ~]# ll /mnt/cdrom
total 57127
dr-xr-xr-x. 2 root root     2048 May 16  2014 32Bit
dr-xr-xr-x. 2 root root     2048 May 16  2014 64Bit
-r-xr-xr-x. 1 root root      647 Oct  9  2013 AUTORUN.INF
-r-xr-xr-x. 1 root root     6966 May 16  2014 autorun.sh
dr-xr-xr-x. 2 root root     2048 May 16  2014 cert
dr-xr-xr-x. 2 root root     2048 May 16  2014 OS2
-r-xr-xr-x. 1 root root     5523 May 16  2014 runasroot.sh
-r-xr-xr-x. 1 root root  9942477 May 16  2014 VBoxLinuxAdditions.run
-r-xr-xr-x. 1 root root 20831744 May 16  2014 VBoxSolarisAdditions.pkg
-r-xr-xr-x. 1 root root 16917984 May 16  2014 VBoxWindowsAdditions-amd64.exe
-r-xr-xr-x. 1 root root   311584 May 16  2014 VBoxWindowsAdditions.exe
-r-xr-xr-x. 1 root root 10471664 May 16  2014 VBoxWindowsAdditions-x86.exe

●Guest Additions のインストール
[root@localhost ~]# sh /mnt/cdrom/./VBoxLinuxAdditions.run install
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.12 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 4.3.12 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules       [  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module                   [  OK  ]
Building the shared folder support module                  [  OK  ]
Building the OpenGL support module                         [  OK  ]
Doing non-kernel setup of the Guest Additions              [  OK  ]
Starting the VirtualBox Guest Additions                    [  OK  ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.

●共有フォルダを使用するユーザ admin を vboxsf グループに所属させる
[root@localhost ~]# id admin
uid=500(admin) gid=10(wheel) groups=10(wheel)
[root@localhost ~]# gpasswd -a admin vboxsf
[root@localhost ~]# id admin
uid=500(admin) gid=10(wheel) groups=10(wheel),493(vboxsf)

●仮想マシンのウィンドウのメニュー[デバイス(D)]→[共有フォルダ(S)]、[共有フォルダを追加]で、例えば C:\Users\taro\Documents を選択。
・フォルダー名:Documents (デフォルト)
・読み込み専用(R)
・自動マウント(A) チェック
・永続化する(M) チェック
次回の起動から、共有フォルダが /media/sf_Documents としてマウントされる。

トラックバック

このエントリーのトラックバックURL:
https://www.remix.asia/cgi/mt/mt-tb.cgi/7313

コメントを投稿

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)