RedHatEnterpriseLinuxAS5 VNC Remote Desktop Server Configuration tutorial

Source: Internet
Author: User
VNC is short for VirtualNetworkComputing. VNC is an excellent cross-platform remote desktop control software developed by AT & amp; T's European research laboratory. It supports cross-platform remote desktop control for Linux, Unix, Windows, and other operating systems. VNC consists of two parts: the server (vncserver) and the client (vncviewer ). The following describes the Linux (VNC Server) and Windows (VNC client) platforms.

VNC is short for Virtual Network Computing. VNC is an excellent cross-platform remote desktop control software developed by AT&T's European research laboratory. It supports cross-platform remote desktop control for Linux, Unix, and Windows operating systems. VNC consists of two parts: the server (vncserver) and the client (vncviewer ). The following describes how to install, configure, and use VNC on Linux (VNC Server) and Windows (VNC client.
 
Lab Environment
 
VNC Server:
 
Operating System: Red Hat Enterprise Linux AS 5
Kernel version: 2.6.18-8. el5
CPU architecture: i386 SMP
Attachment software: Red Hat Enterprise Linux AS 5 DVD installation disk
 
VNC client:
 
Operating System: Windows Server 2008 Enterprise
Browser: Windows Internet Explorer 7
 
1. Install VNC in Linux
 
Add the Red Hat Enterprise Linux AS 5 DVD installation disk to the DVD drive and run the following command to install it:
 
# Mkdir-p/mnt/cdrom
# Mount-t auto/dev/cdrom/mnt/cdrom
# Cd/mnt/cdrom/Server
# Rpm-ivh vnc-server-4.1.2-9.el5.i386.rpm
# Rpm-ivh vnc-4.1.2-9.el5.i386.rpm
 
2. Configure the VNC Server in Linux
 
(1) Introduction to the running mechanism of VNC
 
Before configuring VNC, you must understand the running mechanism of VNC. In Linux, VNC can start multiple vncservers at the same time. Each vncserver is differentiated by the display number. Each vncserver listens to three ports, which are:
5800 + display number: httpd listening port of VNC. It must be enabled if the VNC client is IE or Firefox or other non-vncviewer.
5900 + display number: the real port used for communication between the VNC server and the client, which must be opened unconditionally.
6000 + display number: X listening port, optional.
 
The displayed numbers and open ports are controlled by vncservers and VNCSERVERARGS in the/etc/sysconfig/VNCSERVERS file. VNCSERVERS is set as "VNCSERVERS =" display ID 1: User Name 1... "", Such as: VNCSERVERS = "1: root 2: aiezu ". VNCSERVERARGS is set
 
VNCSERVERARGS [display number 1] = "parameter 1 parameter value 1 parameter 2 parameter value 2 ...... ", Such as VNCSERVERARGS [2] ="-geometry 800x600-nohttpd ", detailed VNCSERVERARGS parameters include:
 
-Geometry desktop resolution. The default value is 1024x768;
-Nohttpd does not listen to HTTP port (58xx port );
-Nolisten tcp does not listen to port X (Port 60xx );
-Localhost can only be accessed from the local machine;
-AlwaysShared only allows one vncviewer connection by default. This parameter allows multiple vncviewer connections at the same time;
-SecurityTypes: password authentication is not required for non-Logon of SecurityTypes. The default value is VncAuth. password authentication is required.
 
(2) modify the/etc/sysconfig/vncserver File
 
After familiarizing yourself with the running mechanism of VNC in Linux, you can officially configure the VNC Server. Vi/etc/sysconfig/vncserver, add the following three lines:
 
VNCSERVERS = "1: root 3: aiezu"
VNCSERVERARGS [1] = "-geometry 800x600-nolisten tcp"
VNCSERVERARGS [3] = "-geometry 1024x768-nolisten tcp"
 
In this example, we start two vncservers, namely the root user. The numbers are 1 and aiezu, and the numbers are 3. The X listening port 60xx is not enabled at all.
 
(3) set the VNC User Password
 
Next, set the VNC password. This step cannot be skipped. Otherwise, the VNC Server cannot be started. Run the following command in Linux Shell:
 
# Su-aiezu
# Vncpasswd
Password:
Verify:
# Su-root
# Vncpasswd
Password:
Verify:
Service vncserver start // start vncserver
 
After running the preceding command, a series of files are generated under the ". vnc" folder under the user root directory ($ HOME. Passwd is the vnc user password file generated by vncpasswd. Other scripts are generated when vnc is started for the first time and xstartup is the script started when the VNC client is connected.
 
(4) modify the ". vnc/xstartup" File
 
After performing the preceding steps, the VNC Server can run properly. However, xterm is enabled when the client connects to the desktop by default ". comment out the last two lines in the vnc/xstartup file, and add a line "startkde &" or "gnome-session &" based on the desktop environment you have installed &". As follows:
 
#! /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 &
Startkde &
# Gnome-session &
 
After ". vnc/xstartup" under the root directory of each user is configured, run service vncserver restart to restart vncserver to make the configuration take effect.
 
(5) configure the firewall
 
If the firewall is enabled in Linux, The VNC ports (58xx, 59xx, 60xx) must be allowed ). For details about the specific port, refer to the VNC Running Mechanism in step 1 of step 1. In this example, enable the ports 5801,5803 and 5901,5903. Enter "system-config-securitylevel-tui" at the Linux Command Prompt to start the firewall configuration tool. Click "Customize" and enter "5801: tcp 5803:" in "Other Port: tcp 5901: tcp 5903: tcp ", and click" OK.
 
3. VNC client configuration and Connection
 
(1) Use IE for remote control connection in windows
 
When using a browser to connect, The VNCSERVERARGS settings of the server must not have the "-nohttpd parameter", and the firewall allows the 58xx and 59xx ports of the VNC to pass through. The browser must have the Java support plug-in installed. The Java Plug-in is here.

(2) Use vncviewer to remotely control the connection in windows
 
Using vncviewer for remote control is the easiest way. You only need to enable the "59xx" port on the server. The client does not need to be configured. After double-clicking vncviewer, enter the IP address and port of vncserver in the server text box (in this example, 192.168.1.22: 5901 ). The local vncviewer Green Edition is:

Free onHttp://linux.linuxidc.com/

Both the user name and password areWww.linuxidc.com

The specific download directory is in/Pub/2011/09/24/Red Hat Enterprise Linux AS 5 VNC Remote Desktop Server Configuration tutorial/

 
(3) Use vncviewer for remote control connection in Linux
 
The vnc-4.1.2-9.el5.i386.rpm package must be installed before you use vncviewer, which is used as: vncviewer host: Display number.
 
(4)use vncviewer1_putty.exe in Windows to connect through the ssh Secure Channel
 
Open putty and click "Connection"-> "SSH"-> "Tunnels" in the "Category" on the left ". In the "Source Port" text box, enter "5901", "Destination" text box, enter "localhost: 5901", and click "Add" to Add Port forwarding. Click "Session" under "Category" on the left of putty, enter the IP address of the server, click "Open", and enter the password to log in. port forwarding is enabled successfully. Start vncviewer on the local machine and enter "127.0.0.1: 5901" to connect to the remote port 5901.
 
(5) Use vncviewer + ssh Secure Channel Connection in Linux
 
Similarly, run the "ssh-L 5901: localhost: 5901 vncserverhost" command in the shell of the linux vnc client and enter the user name and password. That is, the remote port 5901 is forwarded to the local port 5901 through the shh security channel. Then run the "vncviewer 127.0.0.1: 1" command in shell to connect to the remote VNC Server.
In the above five connection modes, the data in the first three modes is transmitted in unencrypted form on the network, which is extremely insecure and is not recommended.

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.