centos vncserver

安装

1
yum install -y tigervnc-server

修改密码:

1
vncpasswd

systemd 配置文件

vim /etc/systemd/system/vncserver@:1.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=root

ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver -alwaysshared %i -geometry 1024x768"
ExecStop=-/usr/bin/vncserver -kill %i
PIDFile=/root/.vnc/%H%i.pid
[Install]
WantedBy=multi-user.target