Install VNC-Server in CentOS 5.5
1. Install the required packages (if GNOME is installed on the system, all vnc packages are installed by default)
# Yum groupinstall "GNOME Desktop Environment"
# Yum install vnc-server
# Yum install vnc
2. Create a local user
# Useradd billy
# Passwdbilly
If you only want to use root to remotely log on to vncserver, skip this step.
3. Set the vnc logon password for the local user:
# Su-billy
# Vncpasswd
123. com
In this case, you can go to the. vnc directory in the home directory to check whether the passwd file is generated. If so, the password is successfully created.
# Ls/home/billy/. vnc/(you cannot see the password when viewing the file content, because it is encrypted .)
4. Modify the VNC server configuration file/etc/sysconfig/vncservers
All the content is a comment line, so you can directly Add the following statement below:
VNCSERVERS = "1: root 2: billy"
VNCSERVERARGS [1] = "-geometry 800x600"
VNCSERVERARGS [2] = "-geometry 1024x768"
The first line is to set the accounts that can use the VNC server. You can set multiple accounts, but separate them with spaces. Access Method: 10.0.0.70: 1 or 10.0.0.71: 2
The following two lines [1] [2] correspond to the above one. The 800x600 can be replaced with the resolution supported by your computer.
5. Create xstartup scripts
If you enable VNCserver once, it can be automatically created as follows:
#/Sbin/service vncserver start (note that it must be started under root)
#/Sbin/service vncserver stop (close after startup to facilitate the following operations)
Through the above method, you can create an xstartup file in the. vnc directory under the user's home directory.
6. Modify the xstartup file.
Vim/home/billy/. vnc/xstartup
Uncomment the following line:
# Unset SESSION_MANAGER
# Exec/etc/X11/xinit/xinitrc
Add notes:
Twm &
If you want to see a graphical interface when entering the VNC server, you need to add gnome-session $ to the last line.
The modified file content should be as follows:
#! /Bin/sh
# Add the following line to ensure you always have an xterm available.
# 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 &
Configuration complete!
Start vnc service: service vncserver start
You can use netstat-nutlp | grep LISTEN to view the port listening on the local machine.
Vncviewer uses the format 10.0.0.71: 2 to log on.