(summary) A detailed overview of the VNC server Remote Desktop configuration under CentOS Linux

Source: Internet
Author: User

PS: I used to basically do not use Linux remote graphics desktop, a few days ago the development of colleagues to configure CentOS VNC has problems, to find me to solve, on the way to summarize the summary, this summary is relatively complete. The following configurations are tested in centos5.x and 6.x, SuSE Enterprise, and other distributions are generally common:

First, install the corresponding desktop environment with the VNC server and client:

# yum groupinstall "GNOME Desktop Environment"(CentOS 5.x安装GNOME桌面环境)
# yum groupinstall "X Window System" "Desktop"(CentOS 6.x安装GNOME桌面环境)
# yum groupinstall Xfce(CentOS安装Xfce桌面环境,可选)
# 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, the start and restart of VNC:
#/etc/init.d/vncserver Restart
Note: Sometimes the above command start will error, direct operation can be:
# Vncserver
Note: Close the specific vncserver command: Vncserver-kill:1 vncserver-kill:2

Third, set the remote login to the GNOME desktop configuration:
# vim/etc/sysconfig/vncservers (SuSE Enterprise Edition does not configure this file)
Add the following two lines to the last face:

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

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

Five: Modify the Remote Desktop display configuration file:
# Vim/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 grey
vncconfig -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

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.

VI. VNC Client Login:
Enter in the VNC client: server-side ip:1 or server-side ip:2

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
Or shut down the firewall directly:
#/etc/init.d/iptables Stop

Seven, starting from the start Vncserver service:
# Chkconfig Vncserver on

Eight, VNC's reverse connection settings:

In most cases, the vncserver is always in the listening state, and the VNC client actively makes a request to the server to establish the connection. However in
On some special occasions, the VNC client needs to be in the listening state, Vncsrever actively send a connection request to the client, which is called VNC
Reverse connection.
Main steps:
A, start the VNC client, so that the vncviewer in the listening state;
# Vncviewer-listen
B, Start Vncserver
# Vncserver
C, execute vncconnect command on Vncserver side, initiate server-to-client request;
# vncconnect-display:1 192.168.80.135

Nine, may encounter the problem:

A, black screen
Installed in Linux in the configuration of the VNC server, the discovery of multi-user login will appear black screen situation, the specific phenomenon is:
The client can enter the system via IP to the session number, but landing in is dark, except for a forked mouse, pitch.

Cause: The user's VNC startup file permissions are not set correctly.
Workaround: Modify the properties of the black screen user's Xstartup (typically:/user directory/.vnc/xstartup) file to 755 (rwxr-xr-x).
After that, kill all the VNC clients that have started:
Vncserver-kill:1
Vncserver-kill:2 (Note:-kill with: 1 or: 2 with a space in the middle)
Finally restart the Vncserver service! #/etc/init.d/vncserver Restart

Note: Vncserver can only be turned off by the user who initiated it, and instant root cannot turn off the vncserver that other users have opened.
Kill the process unless you use kill to order the violence.

B. How to log into VNC Server under Windown
(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 own configuration. such as 192.168.80.128:1
B, login hint connection refused (10061), it is because of Linux firewall problems, check the firewall settings.
C, behind the suffix ": X" is also not less, otherwise the old hint failed to connect:connection refused (10061)

Permanent link : http://www.ha97.com/4634.html

(summary) A detailed overview of the VNC server Remote Desktop configuration under CentOS Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.