天天看點

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

NOTE: 一開始安裝的Ubuntu12.04,後來又重新安裝了14.04。截圖基本使用了安裝12.04時的截圖,後來安裝14.04時又補充了幾張。該安裝過程對Ubuntu12.04和14.04都是适用的。

1. 選擇版本

1.1 Ubuntu桌面版與伺服器版的差別

桌面版與伺服器版,隻要釋出版本号一緻,這兩者從核心來說也就是相同的,唯一的差别在于它們的預期用途。桌面版面向個人電腦使用者,可以進行文字處理、網頁浏覽、多媒體播放和玩遊戲。本質上說,這是一個為普通使用者所定制的多用途作業系統。另一方面,伺服器版旨在充當web伺服器,可用來托管檔案、網頁及相似内容。【1】

個人電腦上必備的組成部分是GUI(圖形使用者界面)。Ubuntu的桌面版預設帶有Gnome GUI,不過,如果你有需要,也可轉換為KDE或X。而伺服器版是不安裝GUI的。除了日常維護,伺服器不打算用于本地互動,因而GUI不僅沒有存在的必要,而且還會消耗伺服器多餘的資源。對于其他軟體,如辦公軟體、媒體播放軟體、浏覽器等等,道理也是一樣。在伺服器版上這些統統找不到。

由于是面向伺服器的,伺服器版Ubuntu包含了所有你需要啟動托管站點的軟體。LAMP(Linux、Apache、MySQL和PHP),列出了與web伺服器相關的軟體。除非你自行安裝,否則這些在桌面版上是找不到的。

以上差別并非一成不變,通過安裝和解除安裝軟體包,你也可以将桌面版定制為伺服器版,反之亦然。多數想裝伺服器的人仍然需要GUI的便利,那麼可以從任何一個版本起步,然後隻需安裝GUI或LAMP即可。

總結:

1. 桌面版為個人電腦所配置,而伺服器版适用于web伺服器。

2. 桌面版預裝了GUI,而伺服器版沒有。

3. 桌面版已經安裝了許多伺服器版沒有的軟體。

4. 桌面版缺少Apache、MySQL和PHP,而這些在伺服器版中是标準配置。

是以,我們還是選擇桌面版吧。

1.2  i386 vs amd64

在Ubuntu官網,你如果下載下傳32位的,那麼ISO檔案是以i386.iso結尾。如果是下載下傳64位的,那麼ISO檔案是以amd64.iso結尾。

i386是x86系列的32位處理器。

amd64是64位處理器。intel有自家的64位的,但不向下相容,64位以amd64最先推出,習慣稱為amd64。

2 安裝過程

1. 點選new,彈出一個建立新虛拟機的視窗。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

2. 給虛拟機配置設定記憶體大小。

配置設定給VM的記憶體隻有在加電啟動VM的時候才會被分配置設定,不啟動的時候是不會被配置設定的。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

3. 建立一個虛拟硬碟檔案。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

4. 選擇VDI格式,這是VirtualBox自己的格式。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

5. 虛拟硬碟檔案的類型:選擇動态配置設定。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

6. 選擇磁盤檔案存放的位置,和磁盤的最大容量。

預設存放在“C:\Users\xxx\VirtualBox VMs\ubuntu_14_04”下,為不占用C槽空間,可以将其移到盤建立的檔案夾下。

(NOTE:關于磁盤的最大容量,後來安裝Ubuntu14.04的時候配置設定了32G,但由于沒有重新截圖,是以截圖顯示的仍然是20G。)

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

7. 虛拟磁盤的Summary資訊

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

8. 整個建立過程的Summary資訊。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

9. 點選Create後,會回到VirtualBox的主視窗。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

10. 修改啟動順序:去掉軟驅,硬碟放在光驅前面

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

11. 插入CD光牒映像到虛拟電腦

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

12. 點選OK後,回到主視窗

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

13. 點選Start,開始安裝

(1)選擇語言:English

(2)點選 Install Ubuntu。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

14. Prepare to install Ubuntu

保持預設選項,Continue。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

15. Install Type

選擇“其它選項(Something else)”,自定義手動分區。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

16. 下面就是最重要的分區了。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

(1)點選“New Partition Table...”,此時會彈出一個對話框,詢問你是否将一整個磁盤建立為一個空分區,選Continue。

(2)這時,一個20G的free space就會被建立出來了。

17. 點“Add”,添加磁盤。

将滑鼠點到“free space”上,然後再點選“Add”。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

參考鳥哥的Linux私房菜的做法【2】,做如下的分區:

(這裡按照32G的硬碟空間大小來配置設定的。)

這裡有2點需要注意:

a. 如果将/boot單獨分區,務必讓該分割槽在整顆硬碟的最前面部分。是以,我們針對/boot就選擇“Primary”,使其為主分區。,而"/"分區不必是主分區。

b. 分區時不能參照【2】中給出的分區順序:

"/"分區(邏輯) -> "/boot"分區(主分區) -> "swap"分區(邏輯) -> "/home"分區(邏輯)

因為Ubuntu中不會主動調整主分區的位置到最前面。這樣劃分分區後,最後剩下的 free space硬碟空間會顯示為 不可用,沒法再繼續分區了。

Ubuntu中應該按照先建立“主分區”,再建立“邏輯分區”的步驟,而且一般将swap分區放于最後,是以,分區的順序應當為:

"/boot"分區(主分區) ->"/"分區(邏輯) -> "/home"分區(邏輯) -> "swap"分區(邏輯)

(1)/boot分割槽

配置設定102M空間。(填入100M或101M的話,最終配置設定99M,是以這裡填入102M,系統最終會給根目錄配置設定100M)

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

(2)根目錄(/)的分割槽

根目錄配置設定10001M的大小

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

(3)/home目錄的分割槽

配置設定10001M空間

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

(4)記憶體置換空間(swap)

配置設定2002M空間(一般為配置設定記憶體大小的1.5-2倍)

因為swap是記憶體置換空間,是以不需要有挂載點。是以,請如同下圖所示,在『檔案系統類型』處挑選為『swap』吧!

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

(5)最終的配置設定結果如圖所示。

最後還剩餘12253M留作以後作練習磁盤操作的指令使用。

分區完成後,點選Install Now,開始安裝系統。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

可以看到,按照"/boot"分區(主分區) ->"/"分區(邏輯) -> "/home"分區(邏輯) -> "swap"分區(邏輯)的順序建立分區後,sda的命名順序是:sda1 -> sda5 -> sda6 -> sda7。

如果按照 "/"分區(邏輯) -> "/boot"分區(主分區) -> "swap"分區(邏輯) -> "/home"分區(邏輯) 的順序建立分區,sda的命名順序會是:sda5 -> sda2 -> sda3 -> sda4。最後剩下的 free space硬碟空間會顯示為 不可用,沒法再繼續分區了。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

18. 開始安裝後,地點選擇“Shanghai”

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

19. 鍵盤布局選擇“中文”。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

20. 然後輸入計算機名,并建立一個使用者名。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

21. 此時開始安裝系統了。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

22. 安裝完成後,需要重新開機系統。注意需要點選一下Enter鍵,才能完成重新開機。

23. 激活root帳戶

(1)Ubuntu 12.04安裝完成後,系統預設的Root賬号是關閉的。

這主要是為了保護系統的安全性,但有些時候為了安裝軟體或進行其它操作時需要獲得Root權限,就得使用Root賬号。

首先需要打開超級終端:Ctrl + Alt + T 快捷鍵打開超級終端

然後輸入sudo passwd root

系統會提示你首先輸入目前使用者的密碼,然後提示你為root賬戶輸入新密碼,并再輸入一次确認。

(2)root使用者和普通使用者之間的切換

普通使用者切換到root使用者:執行sudo root即可,它會提示你輸入root的密碼。

Root使用者切換回普通使用者,有3種方法: su XXX(XXX是你自己安裝時候的使用者名),或是直接輸入exit,也可Ctrl+D組合鍵退出。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

24. 如何以root使用者登入?

環境安裝好後,你重新開機系統時隻有2個使用者可供選擇:安裝系統時設定的使用者,和一個Guest使用者,沒法使用root使用者登入。然而隻有root使用者才有權限設定、安裝增強功能。是以我們需要把root使用者調出來。

(1)一開始參照的是【4】中的方法:

由于 ubuntu 12.04 的登入器改為 lightdm ,已經把 root 使用者給屏蔽了,需要将登入器換成 gdm ,才可以使用 other 選項。

安裝 gdm: sudo apt-get install gdm

執行完後,最終會彈出如下對話框,選擇gdm。(如果沒有自動彈出如下對話框,執行 sudo dpkg-reconfigure gdm ,這時将會彈出如下對話框,将登入管理器修改為 gdm,)

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

(2)但上面【4】的方案問題很大,最後改用【5】中的方案。

但【5】中步驟中 vi /etc/lightdm/lightdm.conf 使用的vi編輯器。但vi編輯器的上下左右鍵不起作用(按向上鍵會打出字母D),經查資料【6】,隻有在Ubuntu下才會出現這種狀況,需要安裝vim。

(3)安裝vim:

sudo apt-get install vim

確定虛拟機能上網。因為apt-get需要root權限,是以加上sudo,然後提示輸入目前使用者的密碼。當然先切換到root使用者,然後直接執行 apt-get install vim 也可以。

(4)安裝完成後,按照【5】的方案設定:

a.切換到root 登陸,

su root

b. 輸入vim /etc/lightdm/lightdm.conf

Ubuntu14.04 中的位置換為【7】: /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

c. 編輯檔案。

首先,使用向下按鍵将光标移動到最後一行。

然後,鍵入指令"o":在目前行之下新開一行。

然後,增加如下2行:

# manually input user when login, so root can be input
greeter-show-manual-login=true
# disable guest user
allow-guest=false      

然後,編輯完後按ESC鍵,按:w是儲存不退出,按:wq是儲存退出,按:q是沒有對檔案進行編輯的情況下退出,按:q!是對已編輯過的檔案不儲存退出。這裡,按:wq儲存退出。修改後的檔案為:

[SeatDefaults] 
greeter-session=unity-greeter 
user-session=ubuntu 
# manually input user when login, so root can be input
greeter-show-manual-login=true
# disable guest user
allow-guest=false      

d. 重新開機登陸即可。

shutdown -h now 現在立即關機

shutdown -r now 現在立即重新開機

shutdown -r +3 三分鐘後重新開機

e. 重新開機之後,點選Login,輸入使用者名:root。回車後,再輸入密碼。即可登入進系統。

Ctrl + Alt + T快捷鍵打開超級終端。此時可以看到界面提示符顯示為root使用者。

25. 安裝增強功能

25.1 桌面版安裝增強功能

Devices->Install Guest Additions 安裝增強功能。但總提示安裝增強功能失敗,總提示強制釋放。這是因為虛拟光驅裡面已經有CD光牒(iso),而且正在使用中無法umount,導緻addition.iso無法挂載,關閉虛拟機,在虛拟機管理界面釋放虛拟CD光牒,。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

然後啟動虛拟機進入Ubuntu,重新開機之後,點選Login,輸入使用者名:root。回車後,再輸入密碼。即可登入進系統。再選擇安裝增強功能。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

但安裝的過程中出錯,錯誤資訊為:

Verifying archive integrity... All good.

Uncompressing VirtualBox 3.2.6 Guest Additions for Linux........

VirtualBox Guest Additions installer

Removing installed version 3.2.6 of VirtualBox Guest Additions...

Building the VirtualBox Guest Additions kernel modules

Building the main Guest Additions module ...fail.

Installing the Window System drivers

Warning: unknown version of the X Window System installed.  Not installing

X Window System drivers.

這是由于VirtualBox的版本太老導緻的【8】。我的VirtualBox版本為:4.1.18。

需要下載下傳最新的4.3.2版本的VirutalBox和VirtualBox Extension Pack。覆寫安裝。

25.2 Server版安裝增強功能

參考:Virtualbox Ubuntu Server 14.04 安裝guest additions(http://www.binarytides.com/vbox-guest-additions-ubuntu-14-04/)

總結:簡單方法,sudo apt-get install virualbox-guest-dkms

25.3 Update:安裝增強功能。

20160303:後來經驗證發現,沒有必要進行“24. 如何以root使用者登入?”這一步驟操作。因為可以先将指令行切換到root使用者,然後在指令行下執行增強功能的安裝。參考:virtual box 安裝增強功能 (Ubuntu10.04) (http://blog.chinaunix.net/uid-24709751-id-97304.html)

(1)首先指令行切換到root使用者(su root),

(2)點選Devices->Install Guest Additions ,

(3)然後執行`mount`指令,看增強功能包挂載到了哪個目錄下(比如在/media/VBOXADDITIONS_4.0.4_69518/目錄下),

(4)然後切換到該目錄下(`cd /media/VBOXADDITIONS_4.0.4_69518/`);

(5)在該目錄下找到VBoxLinuxAdditions.run檔案,執行該檔案(./VBoxLinuxAdditions.run)。

(6)執行完後,重新開機系統。

26. 更新VirtualBox版本

更新VirtualBox版本很簡單,一路Next即可完成安裝。此時你如果“Start”虛拟機的話,它會提示你如下資訊:

"Implementation of the USB 2.0 controller not found!

The device will be disabled. You can ignore this warning but there will be no USB 2.0 support in your VM. To fix this issue, either install the 'Oracle VM VirtualBox Extension Pack' or disable USB 2.0 support in the VM settings"

這是由于沒安裝對應版本的VirtualBox Extension Pack造成的【9】。安裝4.3.2版對應版本的VirtualBox Extension Pack即可。

打開VirtualBox程式,File->Preferences->選擇Extensions選項。

點選“Remove Package”将以前的4.1.18版的VirtualBox Extension Pack删掉,然後點選“Add Package”,選擇剛下載下傳的4.3.2版的VirtualBox Extension Pack。按确定後它會自動安裝。安裝完畢就可以了。

27. 繼續安裝增強功能。

此時,啟動Ubuntu虛拟機。注意:在啟動虛拟機之前,先打開Ubuntu虛拟機的Settings,選擇“Storage”,将之前加載的虛拟鏡像移除。然後再啟動Ubuntu虛拟機。

啟動虛拟機後,選擇“Devices”菜單->選擇“Insert Guest Additions CD Images”選項,它會提示你是否安裝增強功能。點選“Run”,會自動安裝。安裝成功後,會顯示如下的資訊:

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

28. 設定與Host OS共享目錄

選擇“Devices”->“Share Folder Settings”->點選最右面的“+”按鈕,添加一個共享

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

29. 重新開機Ubuntu,完成安裝和設定

設定完成後,重新開機Ubuntu,這次你可以發現,啟動後的Ubuntu的螢幕大小和分辨率變大了,和Host OS一樣。表明增強功能安裝成功。

另外,/media目錄可以通路Host OS的D盤了,表明設定共享成功。

29.1 設定共享 Updated:

後來發現使用普通使用者登入Ubuntu後,所設定的共享目錄無法通路,提示權限不夠。下面是另外一種設定辦法。

a. 把要共享的檔案夾挂載到虛拟機某一個檔案上 【10】

(1)首先需要保證VirtualBox增強功能已安裝完成,因為後面的 vboxsf  是增強功能中提供的。

(2)首先在mnt下建立一個檔案夾,作為挂載的目标檔案夾,然後執行 sudo mount -t vboxsf  共享檔案夾的名字 虛拟機的挂載點

sudo mkdir /mnt/shared
sudo mount -t vboxsf F_DRIVE /mnt/shared/      

之後進入/mnt/shared,可以發現共享檔案夾下的檔案可以複制了。

注意:共享檔案夾的名字不要與挂載點的名字相同,比如上面,F_DRIVE 與mnt下的shared檔案夾不能相同。否則會出現如下錯誤:

/sbin/mount.vboxsf: mounting failed with the error: Protocol error

(3)解除安裝指令

sudo umount -f /mnt/shared      

(4)之後每次要用的時候,都需要手動挂載,sudo mount -t vboxsf F_DRIVE /mnt/shared/

這樣太麻煩了,有沒有自動挂載的方法?有的。在/etc/fstab 的最後添加一項【11】:

F_DRIVE /mnt/shared vboxsf rw,gid=1001000,uid=1000,auto 0 0      

然後重新開機系統。

UPDATED:

(1)上面的groupid=100是錯的,應該為1000.修改為1000後,重新開機并驗證,發現不起作用。

(2)修改/etc/fstab的方法沒起作用的可能原因以及解決方法:The solution I found was to force the vboxsf module to be loaded early, before the mounting of file systems. Just add vboxsf on a line of its own in /etc/modules.【13】

修改後的/etc/modules檔案為:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

lp
rtc
vboxsf      

修改後重新開機系統,仍然不能正常工作。

(3)繼續查資料,有說可能跟目前使用者沒有添加到vboxsf使用者組中有關【14】。

首先檢視使用者組,發現目前使用者确實沒在vboxsf中。

cat /etc/group
->result:
vboxsf:x:1001:      

然後将目前使用者添加到使用者組中:

sudo usermod -a -G vboxsf leige      

再次檢查,發現已将目前使用者添加到使用者組中了。

cat /etc/group
-> result
vboxsf:x:1001:leige      

之後重新開機電腦,仍然不能正常工作。

(4)通過檢視VirtualBox官方文檔得知【15】:

Starting with version 4.0, VirtualBox can mount shared folders automatically, at your option. If automatic mounting is enabled for a specific shared folder, the Guest Additions will automatically mount that folder as soon as a user logs into the guest OS. The details depend on the guest OS type:

With Linux guests, auto-mounted shared folders are mounted into the /media directory, along with the prefix sf_. For example, the shared folder myfiles would be mounted to /media/sf_myfiles on Linux and /mnt/sf_myfiles on Solaris.

The guest property /VirtualBox/GuestAdd/SharedFolders/MountPrefix determines the prefix that is used. Change that guest property to a value other than "sf" to change that prefix; see Section 4.6, “Guest properties” for details.

Note

Access to auto-mounted shared folders is only granted to the user group vboxsf, which is created by the VirtualBox Guest Additions installer. Hence guest users have to be member of that group to have read/write access or to have read-only access in case the folder is not mapped writable.

To change the mount directory to something other than /media, you can set the guest property /VirtualBox/GuestAdd/SharedFolders/MountDir.

To have any changes to auto-mounted shared folders applied while a VM is running, the guest OS needs to be rebooted. (This applies only to auto-mounted shared folders, not the ones which are mounted manually.)

自VirtualBox 4.0之後,就提供了auto mount的功能,當你在“Devices”->“Share Folder Settings”->點選最右面的“+”按鈕,添加一個共享時,如果選擇了“Auto Mount”複選框,那麼該共享就會自動被mount到/media目錄下,并為該共享目錄添加了一個sf_字首。如果沒有自動mount,那麼可能是由于使用者沒有添加到vboxsf使用者組中,那麼按照上面(3)中的辦法,将其添加到vboxsf使用者組中。添加完後,重新開機系統(自動mount需要重新開機,手動mount不需要),這時就可以在media目錄下通路共享目錄了。

通過驗證,上面UPDATED中的(1)(2)是沒有必要的,我将/etc/fstab 和/etc/modules還原,發現/media目錄下仍可以正常auto mount。

(5)為什麼修改fstab不能auto mount呢?有人跟我遇到的相同的問題【16】。

我用 sudo mount指令檢視,也發現所設定的共享檔案夾被映射到了一個不同的地方。

sudo mount
->
E_DRIVE on /mnt/E_Shared type vboxsf (uid=1000,gid=1000,rw)
E_DRIVE on /media/sf_E_DRIVE type vboxsf (gid=1001,rw)      

該作者認為: 勾選"auto-mount" 攪亂了(messes with)事情:Apparently, I had "auto-mount" enabled in VirtualBox configuration for the instance. This messes with things, so I simply added my user to the 

vboxsf

 group (in addition to 

www-data

) and pointed Apache to 

/media/sf_web

.

UPDATED2:

重新驗證了一下,新添加一個共享,在設定“Devices”->“Share Folder Settings”->點選最右面的“+”按鈕,添加一個共享時,不勾選“Auto Mount”複選框(僅僅勾選“Make Permanent”),同時保持另一個共享勾選“Auto Mount”複選框。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

然後按照UPDATED1中的(1)(2)(3)操作,發現/mnt/D_Shared能夠共享。而/mnt/E_Shared不能共享。說明“Auto Mount”複選框覆寫了在/etc/fstab下的挂載。通過UPDATED1(5)中的sudo mount指令也能看出來。

b. 通過網絡通路【12】

沒有嘗試,感興趣的同學可以參考【12】的設定。

30. 設定Host OS和 Guest OS之間Clipboard共享

Ubuntu14.04中虛拟機和主機之間不能互相複制内容,是由于VirtualBox預設禁止了。

點選"Machine"->Settings->General->Advanced->Shared Clipboard

選擇 Bidirectional,可以雙向複制。

VirtualBox中安裝Ubuntu12.04/Ubuntu14.04虛拟機

31.修改預設檔案夾

Virtual Box安裝虛拟機後,預設檔案夾是放在C槽下的,可以将其改到其它盤。

修改File->Preferences->General->Default Machine Folder:

C:\Users\msi\VirtualBox VMs

->D:\LinuxVirtual

修改 "Machine"->Settings->General->Advanced->Snapshot Folder:

C:\Users\msi\VirtualBox VMs\ubuntu_14_04\Snapshots

->D:\LinuxVirtual\ubuntu_14_04\Snapshots

3. 更新VirtualBox後無法啟動虛拟鏡像的問題

将VirtualBox更新到 4.3.16 版本後,當Start啟動VirtualBox中的虛拟機鏡像時,發現無法啟動,跳出一個錯誤框:

failed to open a session of the virtual machine.
The virtual machine 'ubuntu_14_04' has terminated unexpectedly during startup with exit code 1 (0x1).  More details may be available in 'C:\Users\Administrator\VirtualBox VMs\ubuntu_14_04\Logs\VBoxStartup.log'.
Result Code:    E_FAIL (0x80004005)    
Component:    Machine    
Interface:    IMachine {480cf695-2d8d-4256-9c7c-cce4184fa048}      

原因是VirtualBox 4.3.14添加了安全性檢測,影響了虛拟機的啟動,4.3.14以後的版本好像都有問題【17】。

重新覆寫安裝VirtualBox 4.3.12的版本就能解決問題了。注意覆寫安裝後,要按照上面步驟26和27,繼續安裝4.3.12的版本對應的增強功能包。

4. 版本的相容性問題

1. Win10下安裝VirtualBox4.3.12無法設定橋接模式,VirtualBox無法識别出網卡。

覆寫安裝最新版的VirtualBox-5.0.14-105127-Win.exe即可。

2. 2019-09-21 Updated

Win7下 VirtualBox 5.0.20版本安裝Ubuntu18.04.3後,無法正常安裝增強功能,原因參見:https://forums.tomshardware.com/threads/ubuntu-16-unable-to-install-guest-additions.2850009/

```

I have the same problem. Ubuntu 16.10, Virtualbox 5.0.28, Windows 10. The problem is in the function mod_timer_pinned which is dropped from kernel 4.8. Bad luck, new Ubuntu uses that kernel and Guest Additions are not yet adapted to that change. No known solution or workaround at this point - or at least I haven't found it. See here: https://www.virtualbox.org/ticket/15695.

P.S.: I tried upgrading Virtualbox to 5.1.8 but things are only worse. Looks like I'll wait a couple of months for Oracle to release a new 5.0.32 (?) version.

為解決這個問題,更新VirtualBox版本為 5.2.32,即可成功安裝增強功能。

References

【1】Ubuntu桌面版與伺服器版的差別(http://article.yeeyan.org/view/163202/149829)

【2】磁碟分割(http://vbird.dic.ksu.edu.tw/linux_basic/0157installcentos5_2.php#centos5_4)

【3】大硬碟配合舊主機(http://vbird.dic.ksu.edu.tw/linux_basic/0130designlinux.php#largehd)

【4】Ubuntu 12.04 怎麼使用 root 使用者登入(http://blog.sina.com.cn/s/blog_448aed2001015pw8.html)

【5】正宗的 ubuntu 12.04 12.10 root 登入(http://blog.csdn.net/happyteafriends/article/details/7518893)

【6】我用虛拟機linux,指令界面時,想在vi編輯器裡打東西,怎麼總是出錯(http://zhidao.baidu.com/question/398969068.html?qbl=relate_question_1)

【7】ubuntu 14.04 root使用者登入(http://blog.sina.com.cn/s/blog_8cae15e90101pwq4.html)

【8】關于虛拟機中ubuntu的安裝增強功能(http://bbs.chinaunix.net/thread-3586960-1-1.html)

【9】VirtualBox4.1.0 安裝VirtualBox Extension Pack,支援USB 2.0 (http://blog.chinaunix.net/uid-23440786-id-3575575.html)

【10】VirtualBox ubuntu虛拟機共享檔案夾設定(http://wenku.baidu.com/link?url=GXaAcqQCypJCnR4B-_DXuKZ7rlFskEMAae7V2fIZVAP6tJz18yFEPrBEt15pz7lXTn8NVeWPJXFMrDGJvmn-JYB0Il6FJg8VxAx-33n3gqG)

【11】Virtualbox下實作Ubuntu虛拟機和win7主機檔案共享(http://wenku.baidu.com/link?url=TAicjTKkZEYK0_FWRkQUNeHD5F3z_ZGeFJ5DFgJD0KwFP3Il_VZj7mrQGdZ93EHGoKl9lSG-Xc0ayrGNSpUz432N97_VmvGR58Bz9E-8kAi)

【12】如何把主機的檔案複制到virtualbox的BT5(ubuntu)裡(http://www.cnblogs.com/hqucth/archive/2012/08/28/2660301.html)

【13】Virtualbox shared folder mount from fstab fails; works once bootup is complete(http://askubuntu.com/questions/365346/virtualbox-shared-folder-mount-from-fstab-fails-works-once-bootup-is-complete)

【14】auto-mounting shared folders in VirtualBox(http://superuser.com/questions/267599/auto-mounting-shared-folders-in-virtualbox)

【15】4.3.2. Automatic mounting(https://www.virtualbox.org/manual/ch04.html#sf_mount_auto)

【16】fstab not mounting VirtualBox shared folder?(http://unix.stackexchange.com/questions/68631/fstab-not-mounting-virtualbox-shared-folder)

【17】在win7的環境下用VirtualBox安裝ubuntu後啟動時報錯(http://zhidao.baidu.com/question/1366521232174561739.html)

繼續閱讀