First, install the corresponding desktop environment with the VNC server and client:
Yum groupinstall "GNOME desktop Environment" (CentOS 5.x installs the GNOME desktops environment) Yum groupinstall "X window System" "Desktop" (CentOS 6. X Install GNOME desktop environment) Yum Groupinstall Xfce (CentOS installation XFCE desktop environment, optional) yum install Vnc-server vnc* (CentOS 5.x) yum Install Tigervnc-server Tigervnc (CentOS 6.x)
Description: Xfce and kde,gnome are both graphical desktop environments, which are characterized by a small footprint of resources, roughly: GNOME>KDE>XFCE. The specific situation is related to the version. The more recent the general version, the greater the resource footprint.
Second, set the remote login to the GNOME desktop configuration:
Vim/etc/sysconfig/vncservers (SuSE Enterprise Edition does not configure this file) #在最后面加入如下两行: vncservers= "1:root" vncserverargs[1]= "-geometry 1024x768 -alwaysshared-depth 24 "
Description
1,-alwaysshared means that the same display port allows multiple users to log in at the same time-depth for color depth, parameters are 8, 16, 24, 32;
2, the "user name" refers to the name of the Linux system users;
3, the above three lines in the first row is set to use the VNC server account, you can set multiple, but the middle of a space separated. Note that the previous number "1" or "2", when you want to from other computers to the VNC server, you need to use ip:1 this method, and not directly with the IP. If your VNC server IP is 192.168.1.100, and you want to enter the VNC server and log in as a Peter user, you need to enter the IP in the vncviewer: 192.168.1.100:1, if it is root, that is 192.168.1.100:2;
4, the following two lines [the] best with the above that corresponds to, the back of 800x600 can be replaced by your computer-supported resolution. Note that the middle "x" is not "*", but the lowercase letter "x".
Third, set the VNC access password:
# VNCPASSWD
Note: Here is a password for the root remote user above, so under the root account, and so on, for other accounts with the password, it is necessary to set up a password in other accounts.
Iv. Modifying the Remote Desktop display configuration file:
vim/root/.vnc/xstartup#!/bin/sh# uncomment the following and the 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" &gn Ome-session & #set starting GNOME Desktop#startkde & #kde desktop#twm & #Text interface#/usr/bin/startxfce4#e Xec/usr/bin/fluxbox
Description
1, do not modify this file you see the Remote Desktop is very simple, equivalent to command-line operation, in order to remote operation as a local operation, it is necessary to refer to the above way to modify;
2, as long as you enable Vncserver, you can automatically create, the method is as follows:
# Vncserver
The above method allows you to create a Xstartup file in the. VNC directory in the user's home directory.
V. Start and restart of VNC:
/etc/init.d/vncserver restart
Note: Sometimes the above command start will error, direct operation can be:
Vncserver
Close the specific vncserver command:
Vncserver-kill:1 Vncserver-kill:2
Vi. Firewall settings
Iptables firewall will block VNC Remote Desktop by default, so it needs to be allowed in iptables. When you start the VNC service, you can use the NETSTAT–TUNLP command to view the port used by the VNC service, you can find 5801,5901,6001 and so on. Use the following command to turn on these ports:
Vim/etc/sysconfig/iptables
Add to:
-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
To restart the firewall:
/etc/init.d/iptables restart
Seven, starting from the start Vncserver service:
Chkconfig Vncserver on
Viii. Login to VNC Server
(1) login from the browser (the browser needs to install Java Support Library, as a Java applet to implement, to login to control the VNC server, can be installed yum install java*)
Enter the following address directly from the browser:
http://xxx.xxx.xxx.xxx:5801
(2) login from VNC client
Install the VNC client on Windows, and then enter XXX.XXX.XXX.XXX:X to connect to the login.
Note:
A, enter the format for the IP: number, the number depends on your configuration. such as 192.168.80.128:1
b, Login prompt connection refused (10061), please check the firewall settings.
C, behind the suffix ": X" is also not less, otherwise the old hint failed to connect:connection refused (10061)
A detailed description of the VNC server Remote Desktop configuration under CentOS Linux