LINUX VNC 配置

VNC ,全称为 Virtual Network Computing ,是一个桌面共享系统。它的功能,类似于 windows 中的远程 桌面功能。 VNC 使用了 RFB(Remote FrameBuffer ,远程帧缓冲)协议来实现远程控制另外一台计算机。它把键盘、鼠标动作发送到远程计算机,并把远程计算机的屏幕发回到本地,
VNC Viewer 可以和 VNC Server 在不同的操作系统上。 VNC 几乎支持所有的操作系统,也支持 Java ,甚至可以通过支持 Java 的浏览器来访问 VNC Server 。多个 VNC 客户端可以同时连接到一个 VNC Server 上。
一、在 centos5 下安装配置 VNC
 
1. 检查 VNC 客户端和服务器端是否已经安装
  执行如下命令:
rpm �Cqa | grep vnc vnc-server
如果返回类似如下信息,
package vnc is not installed
vnc-server-4.0-8.1
则说明系统已经默认安装了vnc服务器端(一般来说,系统都默认安装了vnc server)。
2. 将用户名加入到配置文件中
  使用如下命令编辑配置文件,添加帐户信息:
  vi /etc/sysconfig/vncservers
做如下修改(红色部分为添加的部分):
#
# 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:http://www.uk.research.att.com/vnc/sshvnc.html>.
 
# VNCSERVERS="1:myusername"
 
# VNCSERVERS="1:gavin 2:john"
# use the method for more user
VNCSERVERS="2:root"
 
# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 1024x768"
 3.设置 root用户的密码
       使用如下命令设置密码:
    vncpasswd
 当提示 Verify 时,再次输入密码确认。
  4. 启动 VNC 服务
使用如下命令启动 VNC SERVER
sbin/service vncserver start
当显示如下信息时,表示启动成功:
Starting VNC server: 2:root                 [ OK ]
5. 修改 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 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &     # GNOME作为VNC的窗口管理器
#startkde &                 #kde desktop
#twm &                        # 注掉系统默认的窗口管理器

 
6. 重启 VNC SERVER
/sbin/service vncserver restart
当系统提示如下信息时,表示重启成功:
Shutting down VNC server: 2:root [ OK ]
Starting VNC server: 2:root                 [ OK ]  
windows 登录到 VNC SERVER
  (1). IE 登录
直接从 IE 浏览器中输入如下地址:
  http://xxx.xxx.xxx.xxx:5802
输入密码即可使用。
  (2). VNC view 登录
  注意: linux 防火墙设置(允许VNC通过)
windows 上安装 vnc view ,然后输入 xxx.xxx.xxx.xxx:2 ,连接登录,输入密码即可。
  备注:如果从 vnc view 登录时,提示 connection refused(10061) ,则是因为 linux 防火墙的问题,登录 centos 系统,选择 System-->Preferences-->Remote Desktop ,勾选 sharing 中的两项, Security 两项不勾,点击关闭,然后再重新用 vnc view 登录即可。

你可能感兴趣的:(linux,职场,休闲)