RedHat7 配置VNCServer

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/[email protected]中的:

        # Quick HowTo:

        # 1. Copy this file to /etc/systemd/system/vncserver@:1.service

        # 2. Edit /etc/systemd/system/[email protected], 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. 完成,现在应该可以通过客户端连接了。

    猜你喜欢

    转载自blog.51cto.com/sunhongbo/2340932