最新版本RealVNC下载,截止本文撰写时的版本是6.2.1
http://www.realvnc.com/download/vnc/
用root登录系统
执行安装:
rpm -ivh https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.2.1-Linux-x64.rpm
或
rpm -ivh https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.2.1-Linux-x86.rpm
一个是64位系统的安装包,一个是32位系统的安装包,可用uname -a命令查看有x86_64就是64位系统。
如果错误提示:
error: Failed dependencies:
xterm is needed by realvnc-vnc-server-6.2.1.32538-1.x86_64
或是中文的错误提示:
错误:依赖检测失败:
xterm 被 realvnc-vnc-server-6.2.1.32538-1.x86_64 需要
我们就要执行安装xterm
yum install xterm
如果不提示前面的错误,就不需要安装xterm
安装好xterm后才能再安装VNC
rpm -ivh https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.2.1-Linux-x64.rpm
安装成功的提示:
Installed systemd unit for VNC Server in Service Mode daemon
Start or stop the service with:
systemctl (start|stop) vncserver-x11-serviced.service
Mark or unmark the service to be started at boot time with:
systemctl (enable|disable) vncserver-x11-serviced.service
Installed systemd unit for VNC Server in Virtual Mode daemon
Start or stop the service with:
systemctl (start|stop) vncserver-virtuald.service
Mark or unmark the service to be started at boot time with:
systemctl (enable|disable) vncserver-virtuald.service
安装VNC的许可:
vnclicense -add VKUPN-MTHHC-UDHGS-UWD76-6N36A
如果提示如下,就说明许可了:
Enterprise license key has been successfully applied
如果你的系统没安装图形界面,就请给系统安装图形界面:
yum -y groups install "GNOME Desktop" "X Window System"
查看当前系统的启动模式
systemctl get-default
multi-user.target //命令模式
graphical.target //图形模式
修改启动模式为图形界面:
systemctl set-default graphical.target
重启reboot后生效
注意:如果默认GNOME进入图形界面需要创建一个新用户
启动VNC服务端:
vncserver &
开启VNC服务器的命令是(一般不需要执行,因为已经启动了VNC服务):
systemctl start vncserver-x11-serviced.service
设置开机启动:
systemctl enable vncserver-x11-serviced.service
检查是否开机启动:
systemctl list-unit-files vncserver-x11-serviced.service
显示为enabled就是开机启动了
service vncserver-x11-serviced restart
service vncserver-x11-serviced.service restart
重启VNC,使其开启重启生效
这样就可以在windows上用VNC viewer连接Centos的远程桌面了
查看firewall中已经开放的端口:
firewall-cmd --list-ports
添加端口号5900-5905
firewall-cmd --permanent --zone=public --add-port=5900-5905/tcp
重新加载防火墙
firewall-cmd --reload
查看5900端口是否是被VNC服务端使用
ss -lnp|grep 5900