CentOS 7 minimal安装完成之后安装图形界面

实验环境:CentOS 7 minimal ,hostname:linuxprobe.org     IP:10.1.1.53

【1】GNOME桌面环境

1、先把最小化安装完成的CentOS7做下快照(本文安装的CentOS在workstation里)

2、通过远程连接上安装的CentOS7,(通过Xshell)

桌面环境不是服务器使用所必需的。但有时安装或使用应用程序需要桌面环境,然后构建桌面环境。

3、执行下面命令安装GNOME Desktop Environment

[root@linuxprobe ~]# yum -y groups install "GNOME Desktop"

4、在完成新软件包的安装后输入如下所示的命令

[root@linuxprobe ~]# startx

5、GNOME桌面环境启动。对于第一次引导,初始设置运行如下。首先选择系统语言。

6、选择键盘类型为英文,根据提示完成安装

【2】KDE桌面环境

[root@vdevops ~]# yum -y groups install "KDE Plasma Workspaces"
[root@dlp ~]# echo "exec startkde" >> ~/.xinitrc
[root@dlp ~]# statrx

【3】Cinnamon桌面环境

[root@linuxprobe ~]# yum -y groups install "Server with GUI"
# install from EPEL
[root@linuxprobe ~]# yum --enablerepo=epel -y install cinnamon*
[root@linuxprobe ~]# echo "exec /usr/bin/cinnamon-session" >> ~/.xinitrc

[root@linuxprobe ~]# startx

【4】MATE桌面环境

[root@linuxprobe ~]# yum -y groups install "Server with GUI"
# install from EPEL
[root@linuxprobe ~]# yum --enablerepo=epel -y groups install "MATE Desktop"
[root@linuxprobe ~]# echo "exec /usr/bin/mate-session" >> ~/.xinitrc
[root@linuxprobe ~]# startx

【5】Xfce桌面环境

[root@linuxprobe ~]# yum -y groups install "Server with GUI"
# install from EPEL
[root@linuxprobe ~]# yum --enablerepo=epel -y groups install "Xfce"
[root@linuxprobe ~]# echo "exec /usr/bin/xfce4-session" >> ~/.xinitrc
[root@linuxprobe ~]# startx

【5】VNC
安装VNC服务器从远程客户端连接

[root@linuxprobe ~]# yum -y install tigervnc-server
[root@linuxprobe ~]# su - wang
# switch to a user you'd like to config VNC
[wang@linuxprobe ~]$ vncpasswd
# set VNC password
Password:# input
Verify:# confirm
# run with diplay number '1', screen resolution '800x600', color depth '24'
[wang@linuxprobe ~]$ vncserver :1 -geometry 800x600 -depth 24

#下载VNC客户点连接VNC服务器

http://www.uvnc.com/downloads/ultravnc.html
【6】VNC客户端:noVNC

6.1、安装一些软件包并创建SSL证书。

从EPEL源安装

[root@linuxprobe ~]# yum --enablerepo=epel -y install novnc python-websockify numpy

#创建证书

[root@linuxprobe ~]# cd /etc/pki/tls/certs
[root@linuxprobe certs]# openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/pki/tls/certs/novnc.pem -out /etc/pki/tls/certs/novnc.pem -days
Generating a 2048 bit RSA private key
.................................+++
......................+++
writing new private key to '/etc/pki/tls/certs/novnc.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN         #国家
State or Province Name (full name) []:Shanghai    #地区
Locality Name (eg, city) [Default City]:Shanghai  #城市
Organization Name (eg, company) [Default Company Ltd]:LinuxProbe   #组织
Organizational Unit Name (eg, section) []:IT Solution  #部门
Common Name (eg, your name or your server's hostname) []:linuxprobe.org    #域名
Email Address []:[email protected]   #邮件地址

6.2、开始Websockify用户运行VNC服务器和代理localhost:5901年在端口6080上。

注:NOVNC一来VNC server,确保vnc server已设置完成,确认防火墙已关闭,这是个坑

[root@linuxprobe certs]# websockify -D --web=/usr/share/novnc/ --cert=/etc/pki/tls/certs/novnc.pem 6080 localhost:5902
WebSocket server settings:
  - Listen on :6080
  - Flash security policy server
  - Web server. Web root: /usr/share/novnc
  - SSL/TLS support
  - Backgrounding (daemon)
#从具有Web浏览器的客户端访问“http://(服务器的主机名或IP地址):6080 /”,然后显示noVNC表单,如下所示,使用VNC密码登录。如下图:



#连接成功显示

【7】安装Xrdp服务器

7.1、安装Xrdp服务器以从Windows远程桌面功能连接到CentOS

# install from EPEL
[root@linuxprobe ~]# yum --enablerepo=epel -y install xrdp
[root@linuxprobe ~]# systemctl start xrdp
[root@linuxprobe ~]# systemctl enable xrdp

7.2、从Windows客户端连接。例如在Windows 8.1上,在开始菜单上启动“远程桌面连接”。
按window键+r键,弹出运行框,输入mstsc调出windows远程连接客户端

总结:CentOS图形界面一般情况下是不需要的,但是特殊情况下需要用到图形界面 时可以根据上面来进行图形界面安装,特别注意,安装VNC服务器时,通过客户端连接如果不成功检查服务端的防火墙是不是没有关闭。
---------------------
作者:shaonbean
来源:CSDN
原文:https://blog.csdn.net/wh211212/article/details/52937299
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自www.cnblogs.com/pcoanet/p/10131723.html
今日推荐