【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/vncserver@.service    /etc/systemd/system/vncserver@:1.service

# cp /lib/systemd/system/vncserver@.service    /etc/systemd/system/vncserver@:2.service

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

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

[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

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

[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

# su - Michael

$ vncserver

.

注:设置和修改密码,需切换到相应用户,第一次设置密码用 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

六、设置防火墙

# 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

八、参考

怎样在 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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值