Enable VNC Server Remote Desktop in RedHat Linux 6 Enterprise Edition

Source: Internet
Author: User

Environment: RedHat Linux 6 Enterprise Edition.
Xwindows: GNOME (graphic interface installed by Red Hat by default)

Although we can use SSH to connect to a remote Linux operating system through the character interface, it is inconvenient for more people familiar with graphics,

Therefore, it is necessary to enable remote desktop for Linux. There are currently two popular methods: xdm (X Display Manager) Solution

Compared with the VNC solution, I personally prefer the VNC solution. One is that the VNC solution is relatively easy to configure, and the other is that the VNC solution supports many

For example, accessing the Linux Desktop through a browser saves the trouble of installing the client.

Next, go to the specific configuration instructions:

1. Confirm and install vncserver.

1. Check whether the vncserver is configured on your server. You can run the following command on the command line to check the Configuration:

[Root @ localhost: ~] # Rpm-Qa | grep VNC

Vnc-server-4.1.2-14.el5_3.1.i386.rpm # Return vncsever server-side version instructions you have installed vncserver.

2. If vncsever is not installed, find the installation package on the CD and install it.

First mount the disc (also called decompression) to a directory where a rhel5-64 directory is created under/var/FTP/pub/

Mount-o loop rhel-server-5.3-x86_64-dvd.iso/var/FTP/pub/rhel5-64/

Then find the rhel5-64 installation package in the/var/FTP/pub/vnc-server-4.1.2-14.el5.x86_64.rpm/Server Directory (you can also use the address:

Usage), use

Directly install the RPM command;

Rpm-IVH vnc-server-4.1.2-14.el5_3.1.i386.rpm

2. Start configuring vncserver

1. Start vncserver. The first time you start vncserver, you will be prompted to enter the password, which can be an administrator account or a common account.

Slightly different.

Administrator:

[Root @ localhost/] # vncserver

You will require a password to access your tops.

Password: 123456 # enter the VNC connection password

Verify: 123456 # confirm the VNC Password

Xauth: creating new authority file/root/. Xauthority

New 'localhost. localdomain: 1 (Root) 'desktop is localhost. localdomain: 1

Creating default startup script/root/. VNC/xstartup
Starting applications specified in/root/. VNC/xstartup
Log File is/root/. VNC/localhost. localdomain: 1.log

Common users:

[Root @ localhost/] # su ceboy # ceboy is the user name
[Ceboy @ localhost/] $ vncserver

You will require a password to access your tops.

Password: 123456 # enter the VNC connection password

Verify: 123456 # confirm the VNC Password

Xauth: creating new authority file/home/ceboy/. Xauthority

New 'localhost. localdomain: 2 (ceboy) 'desktop is localhost. localdomain: 2

Creating default startup script/home/ceboy/. VNC/xstartup
Starting applications specified in/home/ceboy/. VNC/xstartup
Log File is/home/ceboy/. VNC/localhost. localdomain: 2.log

# Note: each user can start their own vncserver remote desktop, and each user can start multiple vncserver Remote Desktop

Desktop, which are identified and distinguished by IP and port number: IP: 1, IP: 2, IP: 3. Using the same port will automatically enable other login users

Exit. In addition, most configuration files and log files of vncserver are in the. VNC directory under the user's home directory.

You can customize the startup number, for example:

[Ceboy @ localhost/] $ vncserver: 2 # Note: There must be spaces before 2.
A vnc Server is already running as: 2

III. For desktop configuration, RedHat Linux supports two graphical modes: KDE mode and gnome mode.

1. What graphics mode does your RH use? Generally, you only need to log on to the graphic interface to view it, or use the PS-a command to list

Check whether there are KDE or GNOME characters for all currently running programs.

If you are a GNOME desktop, You need to modify the/root/. VNC/xstartup configuration file.

 

[Root @ localhost. VNC] # vi xstartup

#! /Bin/sh

# Uncomment the following two lines for normal desktop:

Unset session_manager # Remove the comment of this row

Exec/etc/X11/xinit/xinitrc # Remove the comment of this row

[-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 "&

Gnome-session gnome # Add this sentence to use the GNOME Desktop Environment During connection

TWM &

It is best to restart the system once the settings are modified, otherwise the settings will not take effect. The method I used is to kill the vncserver process and re-run it.

Vncserver.

[Root @ localhost. VNC] # vncserver-kill: 1 # the port number corresponding to when you start vncserver.
[Root @ localhost. VNC] # vncserver: 1 # restart vncserver. Note: There must be spaces before 1.

2. Set User Information and resolution.

[Root @ localhost: ~] # Vi/etc/sysconfig/vncservers

# The VNCSERVERS variable is a list of display: user pairs.

#

# Uncomment the lines below to start a VNC server on display: 2

# As my 'myusername' (adjust this to your own). You will also

# Need to set a VNC password; run 'man vncpasswd' to see how

# To do that.

#

# Do not run this service if your local area network is

# Untrusted! For a secure way of using VNC, see

# <URL: http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting Login T when

# Doing so through a secure tunnel. See the "-via" option in

# 'Man vncviewer 'manual page.

Vncservers = "1: Root 2: ceboy" # Add a user here. Generally, only one 1: Root is added.

Vncserverargs [1] = "-geometry 800 × 600-nolisten TCP-nohttpd-localhost"
Vncserverargs [2] = "-geometry 1024 × 768-nolisten TCP-nohttpd-localhost"

# Note: The preceding figure shows the Resolutions of the root and ceboy users respectively. Note that the resolutions are distinguished by port numbers.

You can also use the command line to temporarily modify the resolution and color depth. After restart, the resolution will be lost, which is temporarily unavailable. The command is as follows:

[Root @ localhost: ~] # Vncserver-geometry 800 × 600 # Set vncserver resolution

[Root @ localhost: ~] # Vncserver-depth 16 # Set the color depth of vncserver

The configuration of the vncserver is complete.

4. Connect and use the client.

1. Access Method
A. in Linux, run the vncviewer command. The server address is written as 192.168.1.11: 1.
B. In Windows, run vncviewer of windows. Its usage is similar to that in Linux.
C. Use a browser (platform-independent) as a Java applet to start the program in the form of http: // 192.168.1.11: 5801.

(The VNC port starts from 5800 and is generally 5800,5900)

Common sense:

2. Change the password

Run vncpasswd.

3. Stop vncserver

# Vncserver-kill: 1
# Vncserver-kill: 2

Note that the vncserver can only be disabled by the user who starts it, And the vncserver enabled by other users cannot be disabled by the root user.

Kill command to kill the process.

4. Stability settings

By default, when multiple clients connect to the display port of the same vncserver, the old vncserver port is connected to the new connection server.

You can use-dontdisconnect to reject new connection requests and keep the old connection.

5. The same monitor can connect to multiple clients.

# Vncserver-alwaysshared

6. Restart the service.

Service vncserver restart

7. Enable the vncserver to be automatically started when the system starts.

Log on to the RedHat Linux GUI using VNC connection, click "system"> "manage"> "Server Settings"> "Service

", Find the vncserver in" backend service ", select it, and click Save.

 

The above installation method is the same as the operation method on as4. I have uploaded the RPM package in the attachment. If you have any questions, please contact me, qq0000282626.

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.