Linux是一个多任务的多用户的操作系统,好多Linux爱好者在安装完Linux后经常遇到一个问题,没有图形化桌面(安装时默认最小化安装),不留神没有安装图形化桌面,下面分享一下安装图形化桌面的过程。
1、确认没有图形化界面
[root@hadoop102 ~]# startx
2、安装图形化界面
//安装图形化程序组
[root@hadoop102 ~]# yum -y groupinstall "Server with GUI"
//在终端运行命令安装X Window System
[root@hadoop102 ~]# yum -y groupinstall "X Window System"
//安装图形界面软件,GNOME(GNOME Desktop)
[root@hadoop102 ~]# yum -y groupinstall "GNOME Desktop"
3、进入图形界面
[root@hadoop102 ~]# startx
4、安装中文支持
//安装中文语言包
[root@hadoop102 ~]# yum groupinstall "Chinese Support" -y
//修改系统默认语言为中文
[root@hadoop102 ~]# localectl set-locale LANG=zh_CN.UTF-8
5、设置默认运行级别为图形化
//查看默认运行级别
[root@localhost Desktop]# systemctl get-default
multi-user.target
[root@localhost Desktop]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3 //运行级别3:多用户界面
# graphical.target: analogous to runlevel 5 //运行级别5:图形化界面
# # To set a default target, run: # # ln -sf /lib/systemd/system/.target
/etc/systemd/system/default.target #
//设置默认图形化运行级别
[root@localhost Desktop]# systemctl set-default graphical.target
rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target'
//查看默认运行级别
[root@localhost Desktop]# systemctl get-default
//图形化设置OK
graphical.target
1)查看默认的target 开机模式
[root@node1 opt]# systemctl get-default
2)开机以命令模式启动
[root@node1 opt]# systemctl set-default multi-user.target
3)开机以图形化界面启动
[root@node1 opt]# systemctl set-default graphical.target