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
- [[email protected] ~]# yum -y groups install "GNOME Desktop"
- [[email protected] ~]# startx
6、选择键盘类型为英文,根据提示完成安装
【2】KDE桌面环境
- [[email protected] ~]# yum -y groups install "KDE Plasma Workspaces"
- [[email protected] ~]# echo "exec startkde" >> ~/.xinitrc
- [[email protected] ~]# statrx
- [[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
- [[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
- [[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
安装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
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
按window键+r键,弹出运行框,输入mstsc调出windows远程连接客户端
总结:CentOS图形界面一般情况下是不需要的,但是特殊情况下需要用到图形界面 时可以根据上面来进行图形界面安装,特别注意,安装VNC服务器时,通过客户端连接如果不成功检查服务端的防火墙是不是没有关闭。
实验环境:CentOS 7 minimal ,hostname:demo 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"
- [[email protected] ~]# startx
6、选择键盘类型为英文,根据提示完成安装
【2】KDE桌面环境
- [[email protected] ~]# yum -y groups install "KDE Plasma Workspaces"
- [[email protected] ~]# echo "exec startkde" >> ~/.xinitrc
- [[email protected] ~]# statrx
- [[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
- [[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
- [[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
安装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
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
按window键+r键,弹出运行框,输入mstsc调出windows远程连接客户端
总结:CentOS图形界面一般情况下是不需要的,但是特殊情况下需要用到图形界面 时可以根据上面来进行图形界面安装,特别注意,安装VNC服务器时,通过客户端连接如果不成功检查服务端的防火墙是不是没有关闭。