顯示包含「VirtualBox」標籤的文章。顯示所有文章
顯示包含「VirtualBox」標籤的文章。顯示所有文章

12.13.2011

在 CentOS 6.1 安裝 Virtual Box Guest Addition


環境:
虛擬機(VM Guest) : CentOS 6.1
虛擬主機(VM Host): Windows XP
VirtualBox Ver: 4.1.6


設定網路:(假設使用DHCP)
  1. vi /etc/sysconfig/network-scripts/ifcfg-eth0 (按 "i" 開始編輯模式)
  2. 修改 ONBOOT="no" => ONBOOT="yes"
  3. 加入 BOOTPROTO="dhcp"
  4. 保存 (按 ":qw")
  5. 重新啟動網路 ( /etc/init.d/network restart)
安裝X-Windows:

  1. yum -y groupinstall "X Window System"
  2. yum -y groupinstall "Desktop"


安裝VirtualBox Guest Addition:
  1. 安裝 虛擬機作業系統 (CentOS 6.1)
  2. 登入CentOS,執行以下指令
    • yum -y install kernel-devel
    • yum -y groupinstall "development tools" 
  3. 重新啟動系統 (指令: reboot)
  4. 插入 "Guest Additions" (按虛擬機的工具列 Devices -> "Install Guest Additions..."
  5. 在 CentOS 進入 Media 目錄 (指令: cd /media)
  6. 建立目錄 DVD (指令: mkdir DVD),如果有可以跳過或有其他目錄名也可
  7. 掛載 "Install Guest Additons" 到 DVD (指令: mount /dev/cdrom /media/DVD)
  8. 進入 DVD (指令: cd /media/DVD)
  9. 執行安裝 (指令: VBoxLinuxAdditions.run)
  10. 如一切順利不會出現 Fail 

4.28.2011

VirtualBox Usage Note

Environment:
OS: CentOS 5.6
VirtualBox Ver: 4.0-4.0.6 (RPM)
VM Name: Windows XP


Assumption:
  • You have installed Development Tools and Library (yum -y groupinstall "Development Library" "Development Tools" 
  • You have installed kernel-devel package (yum -y install kernel-devel), please make sure the installed kernel-devel version is matched with your kernel version.
Install Kernel Modules

  1. "/etc/init.d/vboxdrv setup" #Please make sure you have installed kernel development rpms



Console Start VM:

  1. VBoxManage startvm 'CentOS-5.6' (optional: --type headless , this option make VM Guest run safer in background)
Console Stop VM:
  1. Power off -- VM guest will shutdown immediately, just like pressed power button
    command: VBoxManage controlvm 'CentOS-5.6' poweroff
  2. Save State -- System will save the VM guest State in "~/VirtualBox VMs/Windows XP/Snapshots", if you want to backup the VM guest please make sure you have backup the whole 'Windows XP' directory. In this state you won't allow change the VM guest settings.command: VBoxManage controlvm 'CentOS-5.6' savestate
  3. ACPI off -- System will send ACPI poweroff signal to VM guest (You must install VBox Guest Additions Package)
    command: VBoxManage controlvm 'CentOS-5.6' acpipowerbutton

    If you found that VM Guest can't shutdown, please make sure the x-windows/gnome is not running. (Actually "gnome-power-manager" is not running.)

    OR
    Make sure you VM Guest can receive shutdown signal (you can check /var/log/acpid), Run 
    "nano /etc/acpi/events/power.conf" and change action to "action=/sbin/shutdown -h nowthen try again. (The acpi config file path is used for CentOS only)

Install Virtual Box Guest Additions Package
  1. Please make sure you have installed all package which described in assumption section.
  2. Mount Guest Additions Disc ( Press Devices -> Install Guest Additions or Host + D )
  3. In VM guest, mount /dev/cdrom /media
  4. cd /media
  5. ./VBoxLinuxAdditions.run
  6. reboot (restart VM Guest)
  7. If it doesn't work please check the /var/log/vboxadd-install.log to find out what is the problem and run "/etc/inti.d/vboxadd setup" to reinstall the package
Remote Desktop Server Port

  1. Please download "VirtualBox Extension Packages" form VirtualBox website (Link)
  2. Add the Extension Pack to VirtualBox,  "File" -> "Preferences" -> "Extensions" -> "Add Package"
  3. Enable Remote Display, Stop VM -> Settings -> Display -> Remote Display -> tick "enable Server", enter server port (e.g. 3391)
  4. Config firewall enable prot 3391


Reference
Chinese Reference
Reference: Convert VDI <=> VMDK/VHD