Centos 5.5 configure vnc, open linux remote desktop tutorial

  
                  

vnc remote desktop connection configuration under Centos (full version, Centos5.5 pro test)


1. Check if the machine has vnc installed (centOS5 has vnc installed by default)

rpm -q vnc vnc-server


If the result is:

package vnc is not installed

vnc-server-4.1 .2-14.e15_3.1


Congratulations, vnc is already installed on the machine. If it is not installed, use the command:

#yum install vnc-server (note installing under root)

#yum install vnc

#yum groupinstall "GNOME Desktop Environment"


2. Add the remote desktop user to the configuration file (the following is a ROOT user)

vi /etc/sysconfig/vncservers


Open the configuration file with the vi editor and add the following two lines to the file

VNCSERVERS="1:root 2:leo"

VNCSERVERARGS[ ,null,null,3],1]="-geometry 800x600"

VNCSERVERARGS[2]="-geometry 1024x768"

Description:

First, here “username&rdquo Refers to the name of the Linux system user

Second, the first line of the above three lines is to set the account that can use the VNC server, you can set more than one, but the space should be separated by spaces. Note that the previous number "1" or "2", when you want to come from other computers to the VNC server, you need to use IP: 1 this method, and can not directly use IP. If you assume that your VNC server IP is 192.168.1.100, then if you want to enter the VNC server and log in as a peter user, you need to enter the IP address in the vncviewer: 192.168.1.100:1. If it is root, it is 192.168.1.100. :2.

Third, the following two lines [1][2] are best matched with the above one, the latter 800X600 can be replaced with the resolution supported by your computer. Note that the middle "x" is not “*”, but lowercase letters "x".


3.Set passwords for configured remote desktop users

vncpasswd

Note: Note that this is the password for the root remote user above, so it is configured under the root account; and so on, for other accounts with passwords, you must assign commands to other accounts. >


4. Modify Remote Desktop Display Configuration File

cd ~/.vnc/(/root/.vnc)

vi xstartup


The contents of the original xstartup file should be 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 grey

vncconfig -iconic &

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

twm &


Just cancel the third line above the fourth line #符,就, of course, if you want to enter the VNC server when you see a graphical interface, then you need to comment out the last line, and add gnome-session $.


The contents of the modified file 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 grey

vncconfig -iconic &

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#twm &

gnome- Session &


Description:

First, don't modify this file. The remote desktop you see is very simple, equivalent to command line operations, for remote operation like local As with the operation, be sure to modify it as follows

Second, as long as you enable one VNCserver can be created automatically, as follows:

#/sbin/service vncserver start (note that it can be started under root)

#/sbin/service vncserver stop (close after startup) For the following operations)

By the above method, you can create the xstartup file in the .vnc directory of the user's home directory.


Copyright © Windows knowledge All Rights Reserved