Chinaunix首页 | 论坛 | 博客
  • 博客访问: 172324
  • 博文数量: 71
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 875
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-15 08:20
文章存档

2010年(13)

2009年(14)

2008年(44)

我的朋友

分类: LINUX

2008-09-30 16:05:57

我使用环境:

cnetos 5.2

[root@AA/]# rpm -qa|grep vnc
vnc-4.1.2-9.el5
vnc-server-4.1.2-9.el5
安装系统时选择安装好。

下面是安装时的源程序:

一、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
#
# 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 except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"

用下面的源程序覆盖上面的就OK了,用网上提供给的,会出错的,我TEST。

#

# Uncomment the line below to start a VNC server on display :1

# 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:


# VNCSERVERS="1:myusername"


# VNCSERVERS="1:mes 2:xiaofu" # use the method for more user

VNCSERVERS="2:root"


# VNCSERVERARGS[1]="-geometry 800x600"

VNCSERVERARGS[2]="-geometry 1024x768"

二、设置 root用户的密码,使用如下命令设置密码:vncpasswd,当提示Verify时,再次输入密码确认。

三、启动VNC服务,service vncserver start 。当显示如下信息时,表示启动成功:

Starting VNC server: 2:root                [   OK   ]
四、修改VNC SERVER的窗口管理器

vnc server默认使用的窗口管理器是twn,这是一个非常简单的窗口管理器,我们可以改成常用的GNOME或者KDE。

先使用如下命令进入用户的home目录:

cd ~/.vnc

编辑启动项:

vi xstartup 

按照如下方式修改启动项:

#!/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 8
0x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &     
#以GNOME作为VNC的窗口管理器
#startkde &                 #
kde desktop
#twm &                        #注掉系统默认的窗口管理器

 

五、重启VNC SERVER

     六、关键的,在CENTOS5.2 里系统--首选项-共享里选二个。然后在系统FIREWALL 里其它端口里添加:5901 TCP 。就可以使用VNC Viewer了。或是使用下面的方法:

有 root 操作

vi /etc/sysconfig/iptables

增加 下面的 记录

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT

5901 为默认桌面 1 的端口号




 vnc-3.3.7-x86_win32 下载:

文件: vnc-3.3.7-x86_win32.zip
大小: 564KB
下载: 下载

阅读(642) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~