1. 安装软件(使用root账号)
# yum install tigervnc-server
2. 配置VNC用户密码
[root@localhost ~]# su – michael
Last login: Wed Jan 9 13:52:12 CST 2019 on pts/2
[michael@localhost ~]$ vncpasswd
Password:
Verify:
3. 配置并启动VNC Service
按照/lib/systemd/system/vncserver@.service中的:
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@:1.service
# 2. Edit /etc/systemd/system/vncserver@.service, replacing <USER>
# with the actual user name. Leave the remaining lines of the file unmodified
# (ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
# PIDFile=/home/<USER>/.vnc/%H%i.pid)
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
4. 配置防火墙(注意每个使用的端口都要配置)
-
#
iptables -I INPUT -m state –state NEW -p tcp –destination-port 5901 -j
ACCEPT -
#
iptables -I INPUT -m state –state NEW -p tcp –destination-port 5902 -j
ACCEPT -
#
service iptables save
5. 完成,现在应该可以通过客户端连接了。
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/184604.html