【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7

一、实验环境

操作系统:CentOS7.3 桌面版

用户: 管理员root、普通用户Michael

二、安装 VNC server

# yum  -y install epel-release

#   yum  -y install tigervnc-server

三、配置 

VNC server

# cp /lib/systemd/system/[email protected]    /etc/systemd/system/vncserver@:1.service

# cp /lib/systemd/system/[email protected]    /etc/systemd/system/vncserver@:2.service

# vim  /etc/systemd/system/vncserver@:1.service

#####################################################

【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第1张图片

[Unit]

Description=Remote desktop service (VNC)

After=syslog.target network.target

[Service]

Type=forking

# Clean any existing files in /tmp/.X11-unix environment

ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

ExecStart=/usr/sbin/runuser -l root  -c "/usr/bin/vncserver %i"

PIDFile=/root/.vnc/%H%i.pid

ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]

WantedBy=multi-user.target

######################################################

# vim  /etc/systemd/system/vncserver@:2.service

【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第2张图片

#####################################################

[Unit]

Description=Remote desktop service (VNC)

After=syslog.target network.target

[Service]

Type=forking

# Clean any existing files in /tmp/.X11-unix environment

ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

ExecStart=/usr/sbin/runuser -l Michael -c "/usr/bin/vncserver %i"

PIDFile=/home/Michael/.vnc/%H%i.pid

ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]

WantedBy=multi-user.target

#####################################################

四、设置密码

# vncserver

【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第3张图片

# su - Michael

$ vncserver

【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第4张图片

.

注:设置和修改密码,需切换到相应用户,第一次设置密码用 vncserver,以后如果需要修改密码,用 vncpasswd

五、 启动服务

# systemctl daemon-reload

# systemctl enable vncserver@:1.service

# systemctl enable vncserver@:2.service

# systemctl start   vncserver@:1.service

# systemctl start   vncserver@:2.service

# systemctl status    vncserver@:1.service

# systemctl status    vncserver@:2.service

【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第5张图片

六、设置防火墙

# systemctl start firewalld

# systemctl enable firewalld

# firewall-cmd --permanent --add-service vnc-server

# firewall-cmd --reload

七、安装VNC客户端

Windows上使用VNC Viewer连接远程CentOS服务器

https://www.realvnc.com/en/connect/download/vnc/windows

【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第6张图片
【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第7张图片
【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第8张图片
【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第9张图片
【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第10张图片
【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第11张图片
【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7_第12张图片

八、参考

怎样在 CentOS 7.0 上安装和配置 VNC 服务器

https://linux.cn/article-5335-1.html

Download and Install VNC Viewer on Windows

https://www.realvnc.com/en/connect/download/viewer/windows


How to Install and Configure VNC Server in CentOS 7 / RHEL 7

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-tigervnc

https://www.itzgeek.com/how-tos/linux/centos-how-tos/configure-vnc-server-on-centos-7-rhel-7.html

How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7

How To Set Up SSH Tunneling on a VPS

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-tunneling-on-a-vps

你可能感兴趣的:(【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7)