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

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

实验环境:CentOS 7 minimal ,hostname:demo     IP:10.1.1.53

【1】GNOME桌面环境

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

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

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

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

[plain]  view plain  copy
  1. [root@linuxprobe ~]# yum -y groups install "GNOME Desktop"   
4、在完成新软件包的安装后输入如下所示的命令
[plain]  view plain  copy
  1. [root@linuxprobe ~]# startx  
5、GNOME桌面环境启动。对于第一次引导,初始设置运行如下。首先选择系统语言。

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

【2】KDE桌面环境

[plain]  view plain  copy
  1. [root@vdevops ~]# yum -y groups install "KDE Plasma Workspaces"   
  2. [root@dlp ~]# echo "exec startkde" >> ~/.xinitrc   
  3. [root@dlp ~]# statrx  
【3】Cinnamon桌面环境
[plain]  view plain  copy
  1. [root@linuxprobe ~]# yum -y groups install "Server with GUI"  
  2. # install from EPEL  
  3. [root@linuxprobe ~]# yum --enablerepo=epel -y install cinnamon*   
  4. [root@linuxprobe ~]# echo "exec /usr/bin/cinnamon-session" >> ~/.xinitrc  
  5.   
  6. [root@linuxprobe ~]# startx  
【4】MATE桌面环境
[plain]  view plain  copy
  1. [root@linuxprobe ~]# yum -y groups install "Server with GUI"  
  2. # install from EPEL  
  3. [root@linuxprobe ~]# yum --enablerepo=epel -y groups install "MATE Desktop"   
  4. [root@linuxprobe ~]# echo "exec /usr/bin/mate-session" >> ~/.xinitrc  
  5. [root@linuxprobe ~]# startx  
【5】Xfce桌面环境
[plain]  view plain  copy
  1. [root@linuxprobe ~]# yum -y groups install "Server with GUI"  
  2. # install from EPEL  
  3. [root@linuxprobe ~]# yum --enablerepo=epel -y groups install "Xfce"   
  4. [root@linuxprobe ~]# echo "exec /usr/bin/xfce4-session" >> ~/.xinitrc  
  5. [root@linuxprobe ~]# startx  
【5】VNC
安装VNC服务器从远程客户端连接
[plain]  view plain  copy
  1. [root@linuxprobe ~]# yum -y install tigervnc-server  
  2. [root@linuxprobe ~]# su - wang  
  3. # switch to a user you'd like to config VNC  
  4. [wang@linuxprobe ~]$ vncpasswd  
  5. # set VNC password  
  6. Password:# input  
  7. Verify:# confirm  
  8. # run with diplay number '1', screen resolution '800x600', color depth '24'  
  9. [wang@linuxprobe ~]$ vncserver :1 -geometry 800x600 -depth 24  
#下载VNC客户点连接VNC服务器

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

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

从EPEL源安装

[plain]  view plain  copy
  1. [root@linuxprobe ~]# yum --enablerepo=epel -y install novnc python-websockify numpy   
#创建证书
[plain]  view plain  copy
  1. [root@linuxprobe ~]# cd /etc/pki/tls/certs  
  2. [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   
  3. Generating a 2048 bit RSA private key  
  4. .................................+++  
  5. ......................+++  
  6. writing new private key to '/etc/pki/tls/certs/novnc.pem'  
  7. -----  
  8. You are about to be asked to enter information that will be incorporated  
  9. into your certificate request.  
  10. What you are about to enter is what is called a Distinguished Name or a DN.  
  11. There are quite a few fields but you can leave some blank  
  12. For some fields there will be a default value,  
  13. If you enter '.', the field will be left blank.  
  14. -----  
  15. Country Name (2 letter code) [XX]:CN         #国家  
  16. State or Province Name (full name) []:Shanghai    #地区  
  17. Locality Name (eg, city) [Default City]:Shanghai  #城市  
  18. Organization Name (eg, company) [Default Company Ltd]:LinuxProbe   #组织  
  19. Organizational Unit Name (eg, section) []:IT Solution  #部门  
  20. Common Name (eg, your name or your server's hostname) []:linuxprobe.org    #域名  
  21. Email Address []:shaon@linuxprobe.org   #邮件地址  

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

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

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



#连接成功显示

【7】安装Xrdp服务器

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

[plain]  view plain  copy
  1. # install from EPEL  
  2. [root@linuxprobe ~]# yum --enablerepo=epel -y install xrdp  
  3. [root@linuxprobe ~]# systemctl start xrdp  
  4. [root@linuxprobe ~]# systemctl enable xrdp   
7.2、从Windows客户端连接。例如在Windows 8.1上,在开始菜单上启动“远程桌面连接”。
按window键+r键,弹出运行框,输入mstsc调出windows远程连接客户端

总结:CentOS图形界面一般情况下是不需要的,但是特殊情况下需要用到图形界面 时可以根据上面来进行图形界面安装,特别注意,安装VNC服务器时,通过客户端连接如果不成功检查服务端的防火墙是不是没有关闭。


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值