1. Install GUI Gnome packages:
# yum groupinstall -y "GNOME Desktop"
2. Install VNC package:
# yum install -y tigervnc-server
3. Adding VNC user
# useradd myVNCUser
# cp /lib/systemd/system/vncserver@.service \
/etc/systemd/system/vncserver@:1.service
# vim /etc/systemd/system/vncserver@:1.service
---------------------------------------------------
.........
[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=/sbin/runuser -l myVNCUser -c "/usr/bin/vncserver %i"
PIDFile=/home/myVNCUser/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
---------------------------------------------------
4. Firewall setting:
# firewall-cmd --permanent --zone=public --add-service vnc-server
# firewall-cmd --reload
5. VNC user setting:
# su - myVNCUser
$ vncserver
$ vim ~/.vnc/xstartup
--------------------------------------
.........
gnome-session &
--------------------------------------
$ exit
6. VNC Daemon setting:
# systemctl daemon-reload
# systemctl enable vncserver@:1.service
7. Your VNC Daemon is failure after CentOS 7.0 reboot.
I give you a GREEDY Solution:
# chmod +x /etc/rc.d/rc.local
or
# systemctl start rc-local
, and then
# vim /etc/rc.d/rc.local
--------------------------------------
.........
/usr/bin/rm -rf /tmp/.X11-unix
systemctl restart vncserver@:1.service
--------------------------------------
Reference: https://www.howtoforge.com/vnc-server-installation...
留言列表