首頁 > 軟體

Linux安裝VirtualBox虛擬機器

2020-06-16 17:57:38

第一步:安裝VNC

1. 安裝vnc

yum install -y tigervnc*

2.啟動vncserver

[root@xxx ~]# vncserver
You will require a password to access your desktops.

Password:<輸入密碼>
Verify:<輸入密碼>
xauth: creating new authority file /root/.Xauthority

New 'xxx:1 (root)' desktop is xxx:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/xxx:1.log

3.設定VNC Server啟動檔案

網上看了很多有關文章,說需要改 ~HOME/.vnc/xstartup 檔案的,但是我沒有修改,當然圖形介面還是要安裝的

yum -y install gnome*

設定/etc/sysconfig/vncserver檔案

VNCSERVERS="10:root"
VNCSERVERARGS[10]="-geometry 1024x768 -nolistien tcp"

埠號、使用者、解析度根據實際情況修改,儲存退出

vncserver -list        #檢視是否有多個埠
vncserver -kill :x    #刪除不用的埠
vncserver :10          #啟動vncserver

註:重新啟動vncserver後,在windows系統安裝vncviewer,輸入IP:埠號和密碼就可以進入圖形介面了
 如果介面出現亂碼,可能是由於linux系統是中文安裝的,修改 /etc/sysconfig/i18n 檔案轉換中英文

第二步:安裝VirtualBox

1.安裝DKMS核心,進入dkms官網下載rpm包後安裝,下載地址:http://linux.dell.com/dkms

wget http://linux.dell.com/dkms/permalink/dkms-2.2.0.3-1.noarch.rpm  
rpm -ivh dkms-2.2.0.3-1.noarch.rpm

2.下載VirtualBox的RPM安裝包,下載地址:https://www.virtualbox.org/wiki/Downloads

wget http://download.virtualbox.org/virtualbox/4.3.28/VirtualBox-4.3-4.3.28_100309_el6-1.x86_64.rpm
rpm -ivh VirtualBox-4.3-4.3.6_91406_el6-1.x86_64.rpm

在安裝完之後,出現下面錯誤資訊:

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.

Stopping VirtualBox kernel modules [ OK ]
Uninstalling old VirtualBox DKMS kernel modules [ OK ]
Trying to register the VirtualBox kernel modules using DKMSError! echo
Your kernel headers for kernel 2.6.32-358.el6.x86_64 cannot be found at
/lib/modules/2.6.32-358.el6.x86_64/build or /lib/modules/2.6.32-358.el6.x86_64/source.
[FAILED]
(Failed, trying without DKMS)
Recompiling VirtualBox kernel modules [FAILED]
(Look at /var/log/vbox-install.log to find out what went wrong)   

解決方法

安裝kernel-devel軟體包

yum install kernel-devel-$(uname -r)

如果yum沒有安裝源,可以到http://rpmfind.net/linux/rpm2html搜尋相應系統的版本下載安裝

第三步:啟動VirtualBox相關服務

service vboxdrv setup

當出現下面執行資訊時說明啟動成功,這時就可以建立虛擬機器了。

Stopping VirtualBox kernel modules [確定]
Uninstalling old VirtualBox DKMS kernel modules [確定]
Trying to register the VirtualBox kernel modules using DKMS[確定]
Starting VirtualBox kernel modules [確定]

VirtualBox修改虛擬機器磁碟VDI的大小  http://www.linuxidc.com/Linux/2015-01/111186.htm

VirtualBox安裝Windows 8.1遇到0x000000C4錯誤解決辦法  http://www.linuxidc.com/Linux/2014-11/108855.htm

Ubuntu 12.10 中使用 Virtualbox 安裝 Win7 http://www.linuxidc.com/Linux/2012-11/74195.htm

Ubuntu中用VirtualBox虛擬機器安裝Windows XP完整圖解 http://www.linuxidc.com/Linux/2010-09/28435p8.htm

VirtualBox 虛擬機器安裝 Ubuntu 13.10 截圖 http://www.linuxidc.com/Linux/2013-11/92698.htm

Ubuntu安裝虛擬機器軟體 VirtualBox 4.3.10 http://www.linuxidc.com/Linux/2014-03/99113.htm


IT145.com E-mail:sddin#qq.com