RHEL Linux6.3下的vnc安装和多用户配置

VNC (Virtual Network Computer)是虚拟网络计算机的缩写。VNC 是一款优秀的远程控制工具软件,由著名的 AT&T 的欧洲研究实验室开发的。VNC 是在基于 UNIX 和 Linux 操作系统的免费的开源软件,远程控制能力强大,高效实用,其性能可以和 Windows 和 MAC 中的任何远程控制软件媲美。 在 Linux 中,VNC 包括以下四个命令:vncserver,vncviewer,vncpasswd,和vncconnect。大多数情况下用户只需要其中的两个命令:vncserver 和 vncviewer。下面我们讲一下在RHEL Linux6.3下的vnc安装和多用户配置。

一、安装VNC

RHEL6.3中有关VNC的rpm包是:

客户端:tigervnc-1.0.90-0.17.20110314svn4359.el6.x86_64.rpm

服务端:tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64.rpm

1、yum安装:(配置本地YUM源)

[root@localhost yum.repos.d]# cat rhel6.repo

[rhel6]

name=Red Hat Enterprise Linux6.3

baseurl=file:///rhel6

enabled=1

gpgcheck=0

[root@rac1 oracle]# yum -y install tigervnc-server

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Installing : tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64 1/1

Installed products updated.

Verifying : tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64 1/1

Installed:

tigervnc-server.x86_64 0:1.0.90-0.17.20110314svn4359.el6

Complete!

2、启动vnc服务

#service vncserver start

3、添加系统启动

#chkconfig vncserver on

4、启动VNC桌面

[root@rac1 oracle]# vncserver

You will require a password to access your desktops.

Password:

Verify:

xauth: creating new authority file /root/.Xauthority

New ‘rac1.localdomain:1 (root)’ desktop is rac1.localdomain:1

Creating default startup script /root/.vnc/xstartup

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/rac1.localdomain:1.log

注: 第一次启动时系统会提示设置连接VNC时的登录密码,这个和ROOT设置的认证密码是可以不同的。

二、配置VNC

查看vnc桌面配置文件

[root@bogon ~]# vi /root/.vnc/xstartup

#######################################################################

1 #!/bin/sh

2

3 [ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n

4 export LANG

5 export SYSFONT

6 vncconfig -iconic &

7 unset SESSION_MANAGER

8 unset DBUS_SESSION_BUS_ADDRESS

9 OS=`uname -s`

10 if [ $OS = ‘Linux’ ]; then

11 case “$WINDOWMANAGER” in

12 *gnome*)

13 if [ -e /etc/SuSE-release ]; then

14 PATH=$PATH:/opt/gnome/bin

15 export PATH

16 fi

17 ;;

18 esac

19 fi

20 if [ -x /etc/X11/xinit/xinitrc ]; then

21 exec /etc/X11/xinit/xinitrc

22 fi

23 if [ -f /etc/X11/xinit/xinitrc ]; then

24 exec sh /etc/X11/xinit/xinitrc

25 fi

26 [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

27 xsetroot -solid grey

28 xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

29 twm &

######################################################################################

注: 左边的1-29是VIM显示的行号,便于编辑。

第7行和第21或24行在红帽5版本中默认是被注释掉的,,是要启用的,RHEL6.3是默认是启用的。

只需要把最后一句twm &改为gnome-session &即可。

然后vncserver -kill :1

再vncserver :1启用一下,就可以使用客户端正常连接了。(注:需关闭防火墙或放行相应端口)

三、多用户配置

修改vncserver配置文件

[root@bogon ~]# vi /etc/sysconfig/vncservers

#####################################################################################

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

2 #

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

4 # as my ‘myusername’ (adjust this to your own). You will also

5 # need to set a VNC password; run ‘man vncpasswd’ to see how

6 # to do that.

7 #

8 # DO NOT RUN THIS SERVICE if your local area network is

9 # untrusted! For a secure way of using VNC, see this URL:

10 #

11

12 # Use “-nolisten tcp” to prevent X connections to your VNC server via TC P.

13

14 # Use “-localhost” to prevent remote VNC clients connecting except when

15 # doing so through a secure tunnel. See the “-via” option in the

16 # `man vncviewer’ manual page.

17

18 #VNCSERVERS=”2:myusername”

19 #VNCSERVERARGS[2]=”-geometry 800×600 -nolisten tcp -localhost”

##########################################################################################

注:把18、19行复制一下,做如下修改

VNCSERVERS=”1:root 2:test”

VNCSERVERARGS[3]=”-geometry 800×600 -nolisten tcp -localhost”

最糟糕的行为是抱怨,最易见效 的努力是从自己做起。

RHEL Linux6.3下的vnc安装和多用户配置

相关文章:

你感兴趣的文章:

标签云: