Linux 图形界面

百科

X窗口系统

X显示管理器 : 登录管理器,用作以GUI登录以及登录后显示GUI画面,以及以GUI切换用户。

桌面环境 :像 GNOMEKDEUnity 这样,拥有完善的界面以及大量各类整合工具和应用程序。

VNC

运行级别

显示管理器(登录管理器)列表

XDMX窗口系统 的默认显示管理器

GDM - (GNOME显示管理器)GNOME 的默认显示管理器

LightDMUbuntu 的默认显示管理器

SDDM - 简单显示管理器

KDM - (KDE 显示管理器)KDE 的默认显示管理器

……

更多显示管理器,请 点击此处

显示管理器和桌面环境关系

Ubuntu 图形界面入门

Linux 图形界面介绍

图形界面架构

mac os X 和 Linux:内核 - X Windows 服务器(X Server) - X Client,三层结构

显示管理器:X Server,例如: GDM 、 LightDM 、 SDDM 都依赖 xserver-xorg (X Server)

桌面环境:X Client,例如: KDEGNOME苹果Aqua

image-20200525000555400

windows:内核 - 客户端,两层结构

Linux 的图形操作界面是三层结构,最底层是linux 内核,中间是x windows 服务器例如xorg, 上层就是各种客户端软件如KDE,GNOME等。x windows 服务器和客户端软件 通过x 协议通信。x 协议的定位类似于http协议,本身只是一些规定,定义了大家都需要遵守的条件,在这些相同的条件的基础上,服务器层和客户端各自实现相应的功能。

Ubuntu

基于Ubuntu:20.04

软件包依赖查询

1
2
3
4
apt-cache rdepends xserver-xorg # 是所有显示管理器的依赖

apt-cache depends gdm3 # 正向依赖,依赖部分gnome组件
apt-cache depends lightdm # 正向依赖

安装显示管理器

显示管理器不需单独安装,安装的桌面环境(X Client)会依赖默认的显示管理器。

1
2
3
4
5
6
7
8
9
10
11
12
apt update
apt-get update
apt-cache search gdm

apt-get install <your desired display manager> # gdm、kdm或lightdm
apt-get install gdm3
apt-get remove gdm3

# 查看当前显示管理器
cat /etc/X11/default-display-manager
# 切换显示管理器(gdm、kdm、lightdm),重启生效
dpkg-reconfigure lightdm

安装桌面环境

Ubuntu系列桌面实际上有几种桌面应用程序,包括 Ubuntu-desktop、Kubunut-desktop 和 Xubuntu-desktop。此方法操作最简单,但安装的软件太多了,不建议在服务器上使用此方法。

1
2
3
4
5
apt-get update
apt-get install gnome # 完全安装gnome桌面及应用
apt-get install ubuntu-desktop #GNOME
apt-get install kubuntu-desktop #KDE
apt-get install xubuntu-desktop #XFCE

简单安装:

startx 及xinit 介绍

1
2
3
4
5
6
7
8
9
10
11
apt-get update
apt-cache search gnome-
apt-cache search language-

apt-cache depends gnome-core # 正向依赖,依赖显示管理器gdm3
apt-cache rdepends gnome-core # 反向依赖

apt-get install x-window-system-core # 安装x-windows的基础(或者 apt install xinit)
apt-get install gnome-core # 安装gnome核心
apt-get install language-pack-gnome-zh-hans # gnome中文环境
# apt-get install language-pack-zh-hans # 安装中文环境

CentOS

基于CentOS:8.1.1911

查找软件包

1
2
$ yum search gnome
$ yum search redi

软件包依赖查询

1
2
yum list gdm # 列出资源库中指定的rpm包
yum deplist gdm # 查看软件包的依赖信息

安装桌面环境

CentOS安装卸载桌面环境

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
$ export LANG=en_US.UTF-8 # 切换成英文环境
$ yum grouplist # 列出所有软件包组
Available Environment Groups:
Server with GUI
Server
Workstation
Virtualization Host
Custom Operating System
Installed Environment Groups:
Minimal Install
Available Groups:
Container Management
.NET Core Development
RPM Development Tools
Development Tools
Graphical Administration Tools
Headless Management
Legacy UNIX Compatibility
Network Servers
Scientific Support
Security Tools
Smart Card Support
System Tools
$ yum groupinfo "Server with GUI" # 显示软件组Server with GUI信息
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
上次元数据过期检查:0:00:07 前,执行于 2020年05月30日 星期六 00时51分18秒。
环境组:带 GUI 的服务器
描述:集成的易于管理的带有图形界面的服务器
no group 'dns-server' from environment 'graphical-server-environment'
必选软件包组:
Common NetworkManager submodules
Container Management
Core
Fonts
GNOME
Guest Desktop Agents
Hardware Monitoring Utilities
Hardware Support
Headless Management
Internet Browser
Multimedia
Printing Client
Server product core
Standard
base-x
可选软件包组:
Basic Web Server
Debugging Tools
FTP Server
File and Storage Server
Guest Agents
Infiniband Support
Mail Server
Network File System Client
Network Servers
Performance Tools
Remote Desktop Clients
Remote Management for Linux
Virtualization Client
Virtualization Hypervisor
Virtualization Tools
Windows File Server
$ yum groupinstall "Server with GUI" # 安装软件组Server with GUI

修改运行级别

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 查看运行级别
runlevel 或者 systemctl get-default
# 切换运行等级
init 3
init 5

# 在全新的Linux systemd中已经使用target代替Runlevel,详情见“运行级别”维基百科
systemctl get-default # 获取默认运行级别
systemctl set-default multi-user.target # 设置为多用户命令行状态(init 3),即关闭用户图形界面
systemctl set-default graphical.target # 设置为图形界面状态(init 5),即开启用户图形界面
reboot

startx # 启动X Window,需要安装 xinit 或者 x-window-system-core
init 3 # 切换为命令行界面