0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

VirtualBoxとWindowsマシンの共有フォルダ設定

Posted at

VirtualBox上の仮想環境からWindowsのフォルダをマウントする。

VirtualBoxの仮想環境OSは「RockyLinux8.5」で行った。(記事が少ないのでCentOS8系を参考にしている)

仮想マシンのカーネルを更新&再起動

dnf update -y kernel*
reboot

EPELリポジトリのインストール

dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

パッケージのインストール

dnf install -y gcc kernel-devel kernel-headers dkms make bzip2 perl

環境変数の追加

KERN_DIR=/usr/src/kernels/`uname -r`

Guest Additionsのインストール準備

起動中のVirtualBoxの画面上のタブから[デバイス]>[Guest AdditionsのCDイメージの挿入]をクリック
※あらかじめ[設定]>[ストレージ]>[コントローラ:IDE]>[光学ドライブの追加]から「VBoxGuestAdditions.iso」を指定しておく必要あり。
それでもエラーが出て失敗する場合、以下の記事を参照。

Additionsのインストール

mkdir -p /mnt/cdrom
mount -r /dev/cdrom /mnt/cdrom
sh /mnt/cdrom/VBoxLinuxAdditions.run

※VirtualBoxのバージョンが古いと上記コマンドが失敗して先に進めない場合があるので注意。

reboot

VirtualBoxでホストOSの共有用フォルダを設定

VirtualBoxの[設定]>[共有フォルダ]>[右上の+マーク]から仮想環境と共有したいフォルダを指定する。

マウントの確認

仮想環境の再起動後、「/media」配下に「sf_フォルダ名」の名称で共有フォルダが表示される。

必要に応じて「/var/www/html」配下にシンボリックリンクを設定したり、パーミッションを適宜設定して共有フォルダを使用する。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?