linux安装VirualBox虚拟机

第一步:安装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/vncservers文件

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 [确定]

 

posted @ 2015-07-06 15:32  Jeff.Gao  阅读(9137)  评论(2编辑  收藏  举报