一、安装vnc服务端
yum -y install tigervnc-server tigervnc
安装mate相关软件
yum install -y mate-panel mate-settings-daemon metacity nautilus
注意:如果不安装,vnc客户端看不到图标
设置vnc登陆密码
[root@localhost ovirt-engine-la]# vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
注意:不设置密码后边使用时会出错
配置服务端
[root@localhost ovirt-engine-la]# cat ~/.vnc/xstartup
#!/bin/sh
#启动桌面
mate-session &
#启动桌面工具
mate-panel &
#nautilus &
注意:不设置vnc客户端连接时可能是黑屏,或者看不到任务栏
开启vnc服务(端口可自定义)
[root@localhost ovirt-engine-la]# vncserver :2
WARNING: vncserver has been replaced by a systemd unit and is about to be removed in future releases.
Please read /usr/share/doc/tigervnc/HOWTO.md for more information.
New 'localhost.localdomain:2 (root)' desktop is localhost.localdomain:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:2.log
查看vnc开启的端口
[root@localhost ovirt-engine-la]# netstat -ntlp | grep vnc
tcp 0 0 0.0.0.0:5902 0.0.0.0:* LISTEN 2123489/Xvnc
tcp6 0 0 :::5902 :::* LISTEN 2123489/Xvnc
为vnc开启的端口配置防火墙规则
#添加
firewall-cmd --zone=public --add-port=5902/tcp --permanent #(--permanent永久生效,没有此参数重启后失效)
#重新载入
firewall-cmd --reload
#查看
firewall-cmd --zone=public --query-port=5902/tcp
二、客户端配置
sudo apt install tigervnc-viewer
注意:本次客户端使用的是基于debian的loongnix操作系统
如果使用的是基于centos的server系统,安装方式为sudo yum install tigervnc