close

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...

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 dreamtails 的頭像
    dreamtails

    雜七雜八的小筆記!

    dreamtails 發表在 痞客邦 留言(0) 人氣()