CentOS6.5 the VNC server Remote Desktop configuration

Source: Internet
Author: User

Reference documents:

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

Remote Desktop Connection tool vnc--license Key my download for the Pacific

Problems with VNC connection black screen

CentOS 6.5 Install Vncserver and turn on Remote Desktop

There is a service fixed IP to access, the system is centos6.5, remote SSH only command, execute command is OK, but open the Web page to see the connection effect is not, so need server desktop sharing.

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

# yum groupinstall "X window System" "Desktop" (CentOS 6.x Installation GNOME desktop environment) # Yum groupinstall Xfce (CentOS installation XFCE desktop environment, optional, I did not install) # 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: How to turn off the services that are turned on:

[[email protected]. VNC] # ps-ef|grep vncroot     117388      1  1 17:18 pts/1    00:00:00/usr/bin/xvnc:1-desktop bogon:1 (Root)-A uth/root/. Xauthority-geometry 1024x768-depth 16-rfbwait 30000-rfbauth/root/.vnc/passwd-rfbport 5901-fp Catalogue:/etc/X11/fon TPATH.D-PN-alwayssharedroot     117395 117393  0 17:18 pts/1    00:00:00 vncconfig-iconicroot      117476 113902  0 17:18 pts/1    00:00:00 grep vnc

Kill the PID.

Third, set the remote login to the GNOME desktop configuration:
# vim/etc/sysconfig/vncservers (SuSE Enterprise Edition does not configure this file) is configured as follows:

 #   vncservers= "2:myusername"  #   vncserverargs[2]="-geometry 800x600-nolisten tcp-localhost " vncservers  = 1:root   " vncserverargs[ 1]="  -geometry 1024x768-alwaysshared-depth   " vncserverargs[ 2]= " -geometry 1024x768-alwaysshared-depth   " 

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 .

I set the password to: vncpasswd

Five: Modify the Remote Desktop display configuration file:
# Vim/root/.vnc/xstartup (without this directory created by itself)

#!/bin/sh#uncomment the following-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 desktopStartkde &#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.

3. Gnome-session Gnome #添加这一句是连接时使用gnome Desktop environment

Note: Is the current operation user is the one that is created in that 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

Because I do not know the specific use of that port, when more than one vncserver will use multiple ports, my configuration is as follows: Open a batch of ports

# -A input-m State--state new-m tcp-p TCP--dport 5901:5920-j ACCEPT # -A input-m State--state new-m tcp-p TCP--dport 6001:6920-j ACCEPT

To restart the firewall:
# Service Iptables Restart

Seven, starting from the start Vncserver service:
# chkconfig Vncserver on level 35

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). Note: My change to 777
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)

CentOS6.5 the VNC server Remote Desktop configuration

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.