CentOS 5.3 quick configuration of VNC Server

Source: Internet
Author: User

By default, the VNC Server package has been installed in CentOS 5.3. You only need to select and start the package in the service list. By editing a file ~ HOME/. vnc/xstartup to start your window manager. Use startkde & to start KDE, and use gnome-session & to start GNOME.

1. Start the VNC Server Service: Use the vncserver command (generate the. vnc folder in the current user's home directory)



[Root @ CPAYNET005 ~] # Vncserver

You will require a password to access your tops.

Password: <enter the Password>
Verify: <enter the password>
Xauth: creating new authority file/root/. Xauthority

New CPAYNET005: 1 (root) desktop is CPAYNET005: 1

Creating default startup script/root/. vnc/xstartup
Starting applications specified in/root/. vnc/xstartup
Log file is/root/. vnc/CPAYNET005: 1.log

2. Configure the VNC Server Startup File

Create for the first time ~ At HOME/. vnc/xstartup, the specified Window manager is twm, which is a very small Window manager and has twm on almost every X Window System machine. Twm does not have most of the fancy features of the "Desktop Manager" (like KDE, GNOME, or WindowMaker. The following is a modified example:

#! /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 &
Gnome-session &

In the file, remove the second and third lines from the last, and add the first line to the last to start the GNOME Desktop System. Of course, the last line can also be changed to startkde & mentioned in the first section of the article, indicating to start the KDE Desktop System.

3. Disable the VNC Server Service

Vncserver-kill: desktop number
For example, close the above vnc connection
Vncserver-kill: 1

Iv. Advanced VNC Server Settings

1. Set the vncserver STARTUP script (/etc/init. d/vncserver) to enable vncserver when the system starts automatically.
# Add the following lines to the/etc/rc. d/rc. local file
/Etc/init. d/vncserver start
# You can also run the chkconfig command to enable vncserver when the system is started.
[Root @ CPAYNET005 ~] # Chkconfig -- level 2345 vncserver on

2. edit/etc/sysconfig/vncservers.

VNCSERVERS = "1: root"
VNCSERVERARGS [1] = "-geometry 1024x768"

Modify "1024x768" in ARGS to adapt to the actual X Desktop parameter configuration. You can add any other VNC Server parameter configuration here. In VNCSERVERS, modify root to the user you want to run the VNC desktop. 1 In VNCSERVERS indicates that VNC runs on desktop 1. If you want to add another desktop, you can modify the configuration as follows:

VNCSERVERS = "1: user1 2: user2 3: user3"

3. Set the vnc server access password
Use the vncpasswd command

4. On the RedHat system, run the following command to start VNC:
/Etc/init. d/vncserver start

5. View VNC Server startup status

[Root @ CPAYNET005 ~] # Netstat-tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

Tcp 0 0 0.0.0.0: 5801 0.0.0.0: * LISTEN 5248/Xvnc
Tcp 0 0 0.0.0.0: 5901 0.0.0.0: * LISTEN 5248/Xvnc
Tcp 0 0 0.0.0.0: 6001 0.0.0.0: * LISTEN 5248/Xvnc
Tcp 0 0: 6001: * LISTEN 5248/Xvnc

Note: If you access VNC through web in a browser, the port is 5801. If you access VNC through a VNC client (such as VNC Viewer), the port is 5901.
 

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.