给 CentOS 安装图形界面
通过上篇操作,virtualbox 上的 CentOS 和宿主机之间已支持文件夹共享,还是无法鼠标自由切换,主要是因为 CentOS mini 安装只有字符界面,不支持鼠标。还需对系统安装桌面系统。
首先列出以下当前已安装和支持安装的包组
yum grouplist
可能会看到如下的显示:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.zju.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.163.com
Installed Environment Groups:
GNOME Desktop
Available Environment Groups:
Minimal Install
Compute Node
Infrastructure Server
File and Print Server
Basic Web Server
Virtualization Host
Server with GUI
KDE Plasma Workspaces
Development and Creative Workstation
Available Groups:
Compatibility Libraries
Console Internet Tools
Development Tools
Graphical Administration Tools
Legacy UNIX Compatibility
Scientific Support
Security Tools
Smart Card Support
System Administration Tools
System Management
Done
这个命令列出来的实际上是centos7安装时提供的安装类型选项。Installed Environment Groups
为已安装的包组。
如果已安装包组里面没有GNOME Desktop
,直接执行下面命令
yum groupinstall ‘GNOME Desktop’
即可安装图形界面。
安装完毕,执行
startx
启动图形界面。
如果安装不成功,也可以尝试先进行 X 系统安装。如下:
If CentOS has already been installed without a graphical interface,
you can install this with the following commands:
yum groupinstall "X Window System"
yum install gdm
If you would like this to be the default runlevel, you can edit
/etc/inittab and set the default level to 5 instead of 3:
vi /etc/inittab
Change:
id:3:initdefault:
To:
id:5:initdefault:
图形界面安装成功后,reboot 机器,并重装virtualbox 增强包
cd /media/cdrom
./VBoxLinuxAdditions.run