Centos5(RHEL5)上配置 linux 远程桌面(VNC,)

Oct 17th, 2007

转载本站文章请注明,转载自:扶凯[http://www.php-oa.com]

本文链接: http://www.php-oa.com/2007/10/17/rhel5-vnc.html

 

VNC一个远程显示系统,管理员通过它不仅仅可以在运行程序的本地机上察看桌面环境,而且可以从 Internet上的任何地方察看远程机器的运行情况,而且它具有跨平台的特性。 Linux 要使用远程桌面需要安装VNC,Centos5,RHCE5 已经自带了VNC,默认也已经安装了,只要配置一下就可以了。但是Windows客户端还是要安装的。
下面的方法都是指的远程用命令配置,要是可以拿到机器,直接在桌面设置一下就好了,可惜,我的机器都是远程.

1. 将要vnc的用户名称加入到配置文件:

注:用户名是指linux系统本身就加入过的用户的名称

# vim /etc/sysconfig/vncservers

VNCSERVERS="1:php-oa 2:root 3:root"
VNCSERVERARGS[1]="-geometry 1024×768"

2. 设置用户php-oa的密码
要设置哪个用户,就要转到那个用户.要是root就直接打命令就好了
#su – php-oa
$vncpasswd

Password:
Verify:

3. 启动VNC服务
要使用root来启动服务
#service vncserver start

4. 输入命令
要设置哪个用户,就要转到那个用户.要是root就直接打命令就好了
#su php-oa
$vim  ~/.vnc/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 80×24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session & #set starting GNOME desktop

注:有的系统配置里有 –nolisten tcp 和 –nohttpd ,这两个是阻止Xwindows登陆和HTTP方式VNC登陆的,如果需要图形界面,那就删除这部分。

5. 重启vncserver

#service vncserver restart

6. Windows和linux都可以登陆到VNC Server

(1).从IE和firefox登录

直接从IE浏览器中输入如下地址:

http://xxx.xxx.xxx.xxx:5801

输入密码即可使用。

(2).从VNC view登录

在windows上安装vnc view,然后输入xxx.xxx.xxx.xxx:5901,连接登录,输入密码即可。

备注:VNC给浏览器的端口是5800+N,给vncviewer的端口是5900+N,N是设置的display号.防火墙一定要打开vnc的设置,VNCViewer 切换全屏模式:F8

开启root用户Xmanager远程登录
编辑/etc/gdm/custom.conf文件:
#vi /etc/gdm/custom.conf
在[xdmcp]下填加
Enable=true
保存退出。
编辑/usr/share/gdm/defaults.conf文件:
#vi /usr/share/gdm/defaults.conf
改写如下:
AllowRemoteRoot=true
[xdmcp]下:
Enable=true
Port=177
保存退出。
重启gdm服务:
#gdm-restart
查看177端口是否打开,Xmanager使用177端口
#netstat –unpol
Xmanager可以root远程登录。
 

 

Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪 ViVi 365Key 网摘 天极网摘 和讯网摘 博拉网 POCO 网摘 饭否 QQ 书签 Digbuzz 我挖网 Mister Wong
No comments yet.