yum update
防火墙:
firewall-cmd --permanent --add-service vnc-server
systemctl restart firewalld.service
X-Window:
yum groupinstall "X Window System"
yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
unlink /etc/systemd/system/default.target
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
sync
reboot
VNC SERVER:
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
vim /etc/systemd/system/vncserver@:1.service
找到最下面的类似几行替换:
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=simple
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver :1 -geometry 1280x720 -depth 24"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
重启systemd:
systemctl daemon-reload
设置密码:
vncpasswd
控制命令:
开机启动VNC:
systemctl enable vncserver@:1.service
启动服务:
systemctl start vncserver@:1.service
or
vncserver
关闭 VNC 服务:
systemctl stop vncserver@:1.service
禁止VNC开机启动:
systemctl disable vncserver@:1.service
VNCview连接:
IP:1