1. 程式人生 > >CentOS 7 minimal安裝完成之後安裝圖形介面

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

[[email protected] ~]# yum -y groups install "GNOME Desktop"

4、在完成新軟體包的安裝後輸入如下所示的命令

[

[email protected] ~]# startx

5、GNOME桌面環境啟動。對於第一次引導,初始設定執行如下。首先選擇系統語言。

 

6、選擇鍵盤型別為英文,根據提示完成安裝

【2】KDE桌面環境

[[email protected] ~]# yum -y groups install "KDE Plasma Workspaces"
[[email protected] ~]# echo "exec startkde" >> ~/.xinitrc
[[email protected] ~]# statrx

【3】Cinnamon桌面環境

[

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

[[email protected] ~]# startx

【4】MATE桌面環境

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

【5】Xfce桌面環境

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

【5】VNC
安裝VNC伺服器從遠端客戶端連線

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

#下載VNC客戶點連線VNC伺服器

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

6.1、安裝一些軟體包並建立SSL證書。

從EPEL源安裝

[[email protected] ~]# yum --enablerepo=epel -y install novnc python-websockify numpy

#建立證書

[[email protected] ~]# cd /etc/pki/tls/certs
[[email protected] 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已設定完成,確認防火牆已關閉,這是個坑

[[email protected] 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
[[email protected] ~]# yum --enablerepo=epel -y install xrdp
[[email protected] ~]# systemctl start xrdp
[[email protected] ~]# 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
版權宣告:本文為博主原創文章,轉載請附上博文連結!