systemctl stop firewalld.service
yum install tigervnc-server tigervnc-server-module
cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:1.service
cd /etc/systemd/system
vim [email protected]:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
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
systemctl enable [email protected]:1.service
vncpasswd
systemctl start [email protected]:1.service
systemctl status [email protected]:1.service
netstat -lnt | grep 590*
grep vnc /var/log/messages
关于centos7关闭防火墙
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
firewall:
systemctl start firewalld.service#启动firewall
systemctl stop firewalld.service#停止firewall
systemctl disable firewalld.service#禁止firewall开机启动