centos7 安装vnc-server

yum -y install tigervnc-server

vi /etc/systemd/system/vncserver@:1.service 写入以下内容:

==================================================================

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=root
# 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 -geometry 1920x1080 -depth 32 -securitytypes=no
ne -fp /usr/share/X11/fonts/misc"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]
WantedBy=multi-user.target

===================================================================

systemctl daemon-reload 
vncpasswd root
systemctl start vncserver@:1.service  或者 vncserver :1
#systemctl stop vncserver@:1.service   或者 vncserver -kill :1
systemctl enable vncserver@:1.service
systemctl stop firewalld
systemctl disable firewalld

猜你喜欢

转载自blog.csdn.net/imilli/article/details/81084785