Linux VNC搭建方法

首先介绍下VNC,

VNC是类似于向日葵的远程桌面控制工具,非常好用。本文详细介绍了VNC的搭建方法与使用教程。

yum安装指令

yum install -y tigervnc-server

复制服务文件放到配置文件夹下

cp /lib/systemd/system/[email protected] /etc/systemd/system/

配置服务文件

vim /etc/systemd/system/[email protected]
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
 
[Service]
Type=forking
WorkingDirectory=/root
User=root
Group=root
 
PIDFile=/root/.vnc/%H%i.pid
 
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver %i -geometry 1920x1080 
ExecStop=/usr/bin/vncserver -kill %i
 
Restart=on-success
RestartSec=15
 
[Install]
WantedBy=multi-user.target

配置VNC密码

vncpasswd

关闭防火墙

systemctl disable firewalld

放行5901端口

firewall-cmd --permanent --add-port=5901/tcp

重新加载软件,使配置文件生效

systemctl daemon-reload

启动VNC服务

systemctl start vncserver@:1.service

开机自启动VNC服务

systemctl enable vncserver@:1.service

Linux客户端连接方法

yum install -y tigervnc
vncviewer 192.168.1.1:1

Windows客户端连接方法

安装好VNC后,打开软件

VNC server一栏中输入192.168.1.1:5901

其他默认就可以了

参考文献:

1.https://blog.csdn.net/m0_46573967/article/details/112937905

猜你喜欢

转载自blog.csdn.net/qq_40717447/article/details/122302362