CentOS 7命令行安装GNOME、KDE图形界面

centos7 默认是没有图形化界面的,但我们很多人在习惯了 Windows 的图形化界面之后,总是希望有一个图形化界面从而方便我们使用,这里介绍一下 CentOS7安装图形化桌面系统的方法。

一、进入 root 模式

因为权限限制,所以我们需要进入 root 模式,开机使用 root 登陆或者系统运行中切换为 root 用户均可。

二、安装  X 窗口系统

1、首先安装X(X Window System),命令为

yum groupinstall "X Window System"  //注意有引号

然后系统会自动寻找最近的网络进行相关文件的下载

yum groupinstall "X Window System"

当出现 Complete!说明这里安装成功了。

在这里我们可以检查一下我们已经安装的软件以及可以安装的软件,命令为

yum grouplist

三、安装图形界面软件 GNOME

然后我们开始安装我们需要的图形界面软件,GNOME(GNOME Desktop)

特别注意!!!!一定要注意名称必须对应,否则会出现No packages in any requested group available to install or update 的错误这是因为不同版本的CentOS的软件名可能不同(其他 Linux 系统也是类似的)

如上图,安装命令为:

yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

到这里就安装完成了。

这时,我们可以通过命令 startx 进入图形界面,第一次进入会比较慢,请耐心等待。(可能需要重启,命令为reboot)

ps:

  • 如果安装完成后,虚拟机无法打开,我们需要调整虚拟机分配内存大小(注意不是磁盘大小),1024M基本够用。
  • 如果安装完成后,虚拟机报错0x0000005c,请关闭虚拟机的3D加速功能(取消勾选)

命令:startx

startx

[root@iZbp1berl2oy3e3vt5476fZ ~]# startx
xauth:  file /root/.serverauth.8256 does not exist
xauth:  file /root/.Xauthority does not exist
xauth:  file /root/.Xauthority does not exist


X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System:  3.10.0-957.1.3.el7.x86_64 
Current Operating System: Linux iZbp1berl2oy3e3vt5476fZ 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.10.0-957.21.3.el7.x86_64 root=UUID=43bbb017-ced8-4ca3-a100-c517a9ada29d ro vconsole.keymap=us crashkernel=auto vconsole.font=latarcyrheb-sun16 net.ifnames=0 biosdevname=0 ide_core.noprobe=0.0 console=tty0 console=ttyS0,115200n8 LANG=en_US.UTF-8 idle=halt
Build Date: 09 June 2021  04:17:38PM
Build ID: xorg-x11-server 1.20.4-16.el7_9 
Current version of pixman: 0.34.0
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Wed Jul 21 09:51:25 2021
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
touch: cannot touch ‘/root/.cache/imsettings/log’: No such file or directory

四、更新系统的默认运行级别

经过上面的操作,系统启动默认还是命令行页面的,需要我们进行切换。如果想要使系统启动即为图形化窗口,需要执行下面的命令

ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值