This document uses centos 6.5 as an example.
Install GNOME Desktop Environment
yum groupinstall "X Window System" "Desktop"
CentOS (optional) is used to install the Xfce desktop environment.
yum groupinstall Xfce
Install tigervnc
yum install tigervnc-server tigervnc
Set the remote login to gnome Desktop configuration, and then add the following two lines at the end:
vim /etc/sysconfig/vncservers
VNCSERVERS="1:root"VNCSERVERARGS[1]="-geometry 1024x768 -alwaysshared -depth 24"
Modify the remote desktop display configuration file:
vim /root/.vnc/xstartup
#!/bin/sh# Uncomment the following two lines for normal desktop:unset SESSION_MANAGERexec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesxsetroot -solid greyvncconfig -iconic &xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &gnome-session & #set starting GNOME desktop#startkde & #kde desktop#twm & #Text interface#/usr/bin/startxfce4#exec /usr/bin/fluxbox
Create a service. Multiple services are created after multiple executions. The values are 1: 2: 3 in sequence. A prompt is displayed for setting the password at each startup.
vncserver
Disable specific vncserver commands
vncserver -kill :1 vncserver -kill :2
Start
chkconfig vncserver on
Firewall settings
After you start the vnc service, you can run the netstat-tunlp command to view the ports used by the vnc service, such as 6001, 5901, and. Run the following command to enable these ports:
Restart Firewall:
# netstat –tunlpProto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 2092/Xvnc tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1459/rpcbind tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 2092/Xvnc tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1711/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1557/cupsd # vim /etc/sysconfig/iptables-A RH-Firewall-l-INPUT -p tcp -m tcp –dport 5801 -j ACCEPT-A RH-Firewall-l-INPUT -p tcp -m tcp –dport 5901 -j ACCEPT-A RH-Firewall-l-INPUT -p tcp -m tcp –dport 6001 -j ACCEPT# /etc/init.d/iptables restart
Install Windows Client
Http://sourceforge.net/projects/tigervnc/files/latest/download
Start TrigerVNC Viewer
Enter the Server IP Address: 01, for example, 192.168.1.10: 1.
After the connection, enter the password set every time the vncserver is started to connect to the centos desktop.