安裝VirtualBox為了共用文件夾,折騰了一晚上!網上的很多資料都不是很全面,這裡就全面的總結一下,如果有其他的疑問,可以留言多多交流。 "VirtualBox下載地址,版本為5.1.2" 設置共用文件路徑 點擊虛擬機 設置 選擇 共用文件夾 (圖1 設置共用文件夾) 設置共用文件夾路徑 1 選 ...
安裝VirtualBox為了共用文件夾,折騰了一晚上!網上的很多資料都不是很全面,這裡就全面的總結一下,如果有其他的疑問,可以留言多多交流。
設置共用文件路徑
點擊虛擬機 設置-->選擇 共用文件夾
(圖1 設置共用文件夾)
設置共用文件夾路徑
- 1 選擇路徑
- 2 填寫自定義的共用名稱(在後面需要與掛載路徑相對應)
- 3 設置自動掛載/固定分配
(圖2 設置共用文件路徑屬性)
安裝VirtualBox增強工具
先安裝必備的包
執行下麵的命令:
yum install -y gcc gcc-devel gcc-c++ gcc-c++-devel make kernel kernel-devel
安裝完後,重啟虛擬機:
shutdown -r now
安裝virtualBox增強工具
點擊 設置-->點擊 安裝增強功能...
(圖3 點擊設置)
自動執行安裝 或者 進入目錄/media/VBOXADDITIONS_5.1.2_108956,執行命令
./VBoxLinuxAddtion.run
得到輸出內容
[root@localhost VBOXADDITIONS_5.1.2_108956]# ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.2 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 5.1.2 of VirtualBox Guest Additions...
vboxadd.sh: Stopping VirtualBox Additions.
vboxadd-service.sh: Stopping VirtualBox Guest Addition service.
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Building Guest Additions kernel modules.
vboxadd.sh: You should restart your guest to make sure the new modules are actually used.
vboxadd.sh: Starting the VirtualBox Guest Additions.
You may need to restart the the Window System (or just restart the guest system)
to enable the Guest Additions.
即安裝成功!
掛載共用文件夾
切換到root用戶輸入掛載命令:
sudo mount -t vboxsf shared_file /home/xingoo/shared
註意格式為
sudo mount -t vboxsf 共用文件夾名稱(在設置頁面設置的) 掛載的目錄
然後進入/home/xingoo/shared,就可以看到windows中的文件了
(圖4 windows文件)
[root@localhost shared]# ll
total 337516
-rwxrwxrwx. 1 root root 149599799 Aug 15 21:29 apache-hive-2.1.0-bin.tar.gz
-rwxrwxrwx. 1 root root 196015975 Aug 15 21:31 hadoop-2.6.4.tar.gz
其他使用技巧
如果宿主機是windows經常需要來回的拷貝內容,那麼可以打開【共用粘貼板】,步驟為:
設備-->共用粘貼板-->雙向