安裝VirtualBox爲了共享文件夾,折騰了一夜!網上的不少資料都不是很全面,這裏就全面的總結一下,若是有其餘的疑問,能夠留言多多交流。c++
VirtualBox下載地址,版本爲5.1.2apache
(圖1 設置共享文件夾)windows
(圖2 設置共享文件路徑屬性)工具
執行下面的命令:oop
yum install -y gcc gcc-devel gcc-c++ gcc-c++-devel make kernel kernel-devel
安裝完後,重啓虛擬機:ui
shutdown -r now
點擊 設置-->點擊 安裝加強功能...rest
(圖3 點擊設置)code
自動執行安裝 或者 進入目錄/media/VBOXADDITIONS_5.1.2_108956,執行命令blog
./VBoxLinuxAddtion.run
獲得輸出內容hadoop
[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常常須要來回的拷貝內容,那麼能夠打開【共享粘貼板】,步驟爲:
設備-->共享粘貼板-->雙向