cd /opt/x11vnc1
rpm -ivh *.rpm
cp /opt/x11vnc1/x11vnc.service /etc/systemd/system/
文件内容如下
cat /etc/systemd/system/x11vnc.service
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=forking
ExecStart=/usr/bin/x11vnc -display :0 -forever -shared -bg -rfbauth /etc/x11vnc.pass -o /var/log/x11vnc.log -capslock
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
x11vnc -storepasswd 123456 /etc/x11vnc.pass
systemctl start x11vnc.service
systemctl enable x11vnc.service
vncviewer ip地址:5900