#!/bin/bash
yum install tigervnc-server -y
cat >/etc/systemd/system/vncserver@:1.service << EOF
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable vncserver@:1.service
echo "winchannel" | vncpasswd root -f
systemctl start vncserver@:1.service
systemctl status vncserver@:1.service
netstat -lnt | grep 590*
grep vnc /var/log/messages
阅读(1334) | 评论(0) | 转发(0) |