Reprinted please indicate the source: http://blog.csdn.net/guoyjoe/article/details/20647553
1. Configure and install VNC
[Root @ guodb2 Disk1] # yum install vnc *
2. Set the VNC Password
[Root @ guodb2 Disk1] # vncserver
You will require a password to access your tops.
Password:
Verify:
New 'guodb2: 1 (root) 'desktop is guodb2: 1
Creating default startup script/root/. vnc/xstartup
Starting applications specified in/root/. vnc/xstartup
Log file is/root/. vnc/guodb2: 1.log
3. Restart the VNC service.
[Root @ guodb2 Disk1] # service vncserver stop
Shutting down VNC server: [OK]
[Root @ guodb2 Disk1] # service vncserver start
Starting VNC server: no displays configured [OK]
4. logon error:
5. Check the VNC Port
[Root @ guodb2 Disk1] # netstat-tupln | grep vnc
Tcp 0 0 0.0.0.0: 6001 0.0.0.0: * LISTEN 9748/Xvnc
Tcp 0 0 0.0.0.0: 5801 0.0.0.0: * LISTEN 9748/Xvnc
Tcp 0 0 0.0.0.0: 5901 0.0.0.0: * LISTEN 9748/Xvnc
6. We can see from the above that the terminal number 0 is occupied and you can log on with the terminal number 1.
7. log on to VNC normally, but the graphic interface displays the following:
8. Modify the VNC configuration file, comment out the original two lines, and add the last two lines
[Root @ guodb2 Disk1] # vi/etc/sysconfig/vncservers
# VNCSERVERS = "2: myusername"
# VNCSERVERARGS [2] = "-geometry 800x600-nolisten tcp-nohttpd-localhost"
VNCSERVERS = "1: root"
VNCSERVERARGS [1] = "-geometry 1400x750-nolisten tcp"
9. Modify the graphic interface, comment out all, and add the last line
[Root @ guodb1 yum. repos. d] # vi/root/. vnc/xstartup
#! /Bin/sh
# Uncomment the following two lines for normal desktop:
# Unset SESSION_MANAGER
# Exec/etc/X11/xinit/xinitrc
# [-X/etc/vnc/xstartup] & exec/etc/vnc/xstartup
# [-R $ HOME/. Xresources] & xrdb $ HOME/. Xresources
# Xsetroot-solid gray
# Vncconfig-iconic &
# Xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
# Twm &
Gnome-session &
10. Restart the VNC service.
[Root @ guodb2 Disk1] # service vncserver stop
Shutting down VNC server: 1: root [OK]
[Root @ guodb2 Disk1] # service vncserver start
Starting VNC server: 1: root xauth: creating new authority file/root/. Xauthority
New 'guodb2: 1 (root) 'desktop is guodb2: 1
Starting applications specified in/root/. vnc/xstartup
Log file is/root/. vnc/guodb2: 1.log
[OK]
11. Log On normally and display the graphic interface normally