使用VNC访问Red Hat Enterprise Linux
作者:张盎
邮箱:ziqiang_ak@126.com
系统环境:
服务器:Red Hat Enterprise Linux AS release 4 (Nahant Update 8) / VNC服务端程序已安装
客户端:windows xp / 需下载客户端程序vnc_x86_win32_chs.exe
确认Linux版本
[root@localhost ~]# su - root
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
内核版本
[root@localhost ~]# uname -r
[root@localhost ~]# cat /proc/version
2.6.9-89.ELsmp
启动linux的窗口界面:
startx
VNC 的配置
1.检查rpm包是否安装
[root@localhost ~]$ rpm -qa|grep vnc
vnc-server-4.0-11.el4 (或vnc-server-4.0-12.el4_7.1)
vnc-4.0-11.el4
只要有第一个vnc-server-4.0-11.el这个就足够,这是服务端运行程序。如未安装,请安装。
2.安装好后运行 vncserver
安装,如已安装,则不用再次安装。
rpm –Uvh vnc-3.3.7.i386.rpm
启动vnc服务
[root@localhost ~]$ vncserver
You will require a password to access your desktops.
Password: 例如输入111111
Verify: 例如输入111111
xauth: creating new authority file /home/test/.Xauthority
New 'niuge:1 (test)' desktop is niuge:1
Creating default startup script. /home/test/.vnc/xstartup
Starting applications specified in /home/test/.vnc/xstartup
Log file is /home/test/.vnc/niuge:1.log
会提示你输入登录密码,同时会给你提示,记住这个":1" 这是你vnc客户端登录时候要用到的。
或者例如:
New 'test:1 (root)' desktop is test:1
Creating default startup script. /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/test:1.log
3.在windows机器上装好vnc客户端,装好后运行客户端程序,即可进入命令行方式,
需要修改一下配置才可以进入windows模式。
运行 C:\Program Files\RealVNC\VNC4\vncviewer.exe
输入 198.198.198.101:1
或者在浏览器中输入
http://198.198.198.101:5801
如果显示编号为1,一般第一次设置的显示编号都是1,端口号就用5800+1=5801
VNC给浏览器的端口是5800+N,给vncviewer的端口是5900+N,N是设置的display号
4.刚才在开启vncserver时候有如下提示:
Creating default startup script. /home/test/.vnc/xstartup
Starting applications specified in /home/test/.vnc/xstartup
Log file is /home/test/.vnc/niuge:1.log
我们来看看xstartup内容:
vi /home/test/.vnc/xstartup
或 vi /root/.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 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
取消/root/.vnc/xstartup文件中下面两行的注释,就可以正常进入desktop了
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
修改后保存退出
为什么连接后,不能显示桌面,而只有一个Terminal窗口?
试着 vi /root/.vnc/xstartup,把最后一行 twm& 改成 gnome-session&
或者 kde&(据说KDE在目前的VNC Viewer上的表现不太稳定)
Linux启动后自动运行VNCServer
1)在 系统设置>服务器设置>服务中把vncserver打勾。
2)打开配置文件/etc/sysconfig/vncservers,去掉下面这行的注释,
vi /etc/sysconfig/vncservers
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600"
1表示VNC以桌面1运行,这样可以启动root的桌面。
VNC端口
如果需要从外网控制内网的某台Linux,则需要打开防火墙相应的端口,并在路由器上进行端口映射。
如果选择注销,或如法登陆窗口界面,则
先停止vncserver:
[root@localhost ~]$ vncserver -kill :1
Killing Xvnc process ID 30475
[root@localhost ~]$
重启vncserver:
[root@localhost ~]$ vncserver
New 'niuge:1 (test)' desktop is niuge:1
Starting applications specified in /home/test/.vnc/xstartup
Log file is /home/test/.vnc/niuge:1.log
让我们重复上边的步骤重新登录vnc
熟悉的窗口画面出现了。
-----------------------------------
软件说明:VNC(Virtual Network Computing,虚拟网络计算)
最早是一套由英国剑桥大学AT&T实验室在2002年开发的轻量型的远程控制计算机软件,
其采用了 GPL 授权条款,任何人都可免费取得该软件。VNC软件主要由两个部分组成:VNC server及VNC viewer。
用户需先将VNC server安装在被控端的计算机上后,才能在主控端执行 VNC viewer 控制被控端。
RealVNC Enterprise Edition 4.5.1注册码
D97KS-BL7S6-BYJH4-MPD7U-WEG3A --ok
G7EK6-BVZM3-LK2H8-N44GQ-SUERA
4CU4S-L52CA-2M4LJ-NS34T-Q2L5A
MTF8G-JN2W2-FSBWP-QPVPU-ELP3A
BNSVG-PBTWD-R2CJA-NHNJY-2NNAA
若需要用户名则为www.mechi.cn
VNC server 与 VNC viewer 支持多种操作系统,如 windows,Linux,MacOS 及 Unix 系列(Unix,Solaris等),
因此可将 VNC server 及 VNC viewer 分别安装在不同的操作系统中进行控制。
RealVNC 的优越性还在于如果操作系统的主控端计算机没有安装 VNC viewer,
也可以通过一般的网络浏览器(如 IE 等)来控制被控端(需要 Java 虚拟机的支持)。
注册码:
LBYLA-24UMW-6BGAP-4YKV4-TUMCA
H3598-HLK67-HJCA4-3CJZQ-Q8SFA
85ETM-ZHMHQ-8PGAY-982H2-NLWRA
KKYJA-DJBDY-E7A39-NYJAZ-P4F3A
PMAV7-VAAXE-HLAAX-TLW6G-HD3PA
-----------------------------------
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13670701/viewspace-661583/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13670701/viewspace-661583/