原文鏈接: http://zhaokaifeng.com/?p=573
本文中使用的Debian是安裝在VirtualBox中的虛擬機,具體參數如下:
Debian版本:Linux debian 4.9.0-4-amd64
VirtualBox版本:VirtualBox 5.2.6
Debian虛擬機安裝VirtualBox增強功能的具體步驟如下:
1 前期准備
打開Debian虛擬機並登陸,依次點擊VirtualBox的“設備->安裝增強功能”。
這時我們可以在Debian的桌面上看到一個光盤圖標,例如我的計算機上圖標的名稱是:
VBox_GAs_5.2.6
在VBox_GAs_5.2.6圖標上右鍵選擇“掛載卷”,之后我們就可以在“/media/cdrom0”路徑下看到VBox_GAs_5.2.6中的內容了。
切換到/media/cdrom0路徑下:
cd /media/cdrom0
2 安裝內核頭文件(root用戶下執行)
注:如果不執行這一步,直接執行下一步(第3步)可能會出現如下報錯:
his system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel “header” files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
報錯的原因是沒有安裝內核頭文件,因此,我們首先安裝內核頭文件。
獲取系統內核版本信息:
uname -r
例如在我的計算機上上述命令的執行結果是:
4.9.0-4-amd64
下一步命令我們需要使用這個參數。
安裝內核頭文件,命令:
apt-get install build-essential linux-headers-內核版本號
例如在我的計算機上需要執行的命令就是:
apt-get install build-essential linux-headers-4.9.0-4-amd64
3 安裝VBox增強功能(root用戶下執行)
進入/media/cdrom0路徑:
cd /media/cdrom0
開始安裝:
sh ./VBoxLinuxAdditions.run
4 重啟
5
在VirtualBox的“設備”選項下依次將“共享粘貼板”和“拖放”設置成“雙向”即可在虛擬機與物理機之間共享粘貼板並實現文件的互相拖放,Debian的顯示分辨率也會自動調整。
End
My Website:http://zhaokaifeng.com/
