Ubuntu 8.10下的VNC服务

上一篇 / 下一篇  2009-04-13 15:52:10 / 个人分类:Linux

我的栏目
  • 栏目:
51Testing软件测试网N@wG Xis

Reference:http://hi.baidu.com/naruto6006/blog/item/873c704b6b76962409f7ef9e.html

;q+z4Pq(@$b1~n051Testing软件测试网]#P:[|\`5S"i-p

 51Testing软件测试网&I7fB`/bP:fx

51Testing软件测试网S _Uu$Ro2X

VNC(Virtual Network Computing)是一套由AT&T实验室所开发的可操控远程的计算机的软件,其采用了GPL授权条款,任何人都可免费取得该软件。VNC软件主要由两个部分组成:VNC server及VNC viewer。用户需先将VNC server安装在被控端的计算机上后,才能在主控端执行VNC viewer控制被控端。
4_+{D%bxspC0(在windows中也由一套著名的网络遥控软件――Symantec公司推出的pcAnywhere。51Testing软件测试网9eJ)eTa.db
VNC server与VNC viewer支持多种操作系统,如Unix系列(Unix,Linux,Solaris等),windows及MacOS,因此可将VNC server 及VNC viewer分别安装在不同的操作系统中进行控制。如果目前操作的主控端计算机没有安装VNC viewer,也可以通过一般的网页浏览器来控制被控端。
!|5G?.Jnzm}0整个VNC运行的工作流程如下:51Testing软件测试网RC$L;df^
(1) VNC客户端通过浏览器或VNC Viewer连接至VNC Server。51Testing软件测试网 M%{*R gR+[2]8e
(2) VNC Server传送一对话窗口至客户端,要求输入连接密码,以及存取的VNC Server显示装置。51Testing软件测试网V&``:yQQ
(3) 在客户端输入联机密码后,VNC Server验证客户端是否具有存取权限。
'l_ a ~~'fi [&KK6T8g0(4) 若是客户端通过VNC Server的验证,客户端即要求VNC Server显示桌面环境。51Testing软件测试网Uy ] X _0Lwt
(5) VNC Server通过X Protocol 要求X Server将画面显示控制权交由VNC Server负责。51Testing软件测试网8jE!LFY;U)}6j0gv
(6) VNC Server将来由 X Server的桌面环境利用VNC通信协议送至客户端,并且允许客户端控制VNC Server的桌面环境及输入装置。

Kw D2Sz6|k0|;?051Testing软件测试网/N2}-@h Q(],q%W5`

今天在ubuntu8.10下安装了VNC服务,centos没有安装gome和kde桌面,所以选择使用ubuntu linux:

$Jk9q:?C0

(M?SqRo0ylw@naruto:~$sudo apt-get install vnc4-common vnc4server (使用apt命令安装VNC软件包)51Testing软件测试网&F"tG9l8z
正在读取软件包列表... 完成51Testing软件测试网'z/}3Rj_
正在分析软件包的依赖关系树      
4}d(M pN8lO@x&|0正在读取状态信息... 完成      51Testing软件测试网E M yDDy,H)Z
下列软件包是自动安装的并且现在不再被使用了:51Testing软件测试网dV4IR8M |
libvncserver051Testing软件测试网 g\uo-X
使用'apt-get autoremove'来删除它们
F:i+V TI MLS]0建议安装的软件包:51Testing软件测试网'~"rd^7g/d.A
xvnc4viewer vncviewer vnc-java51Testing软件测试网M g4A'wv%g/s
下列【新】软件包将被安装:
;vs v9sc+J)v0vnc4-common vnc4server
G TS ^?O7w)W0共升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 0 个软件未被升级。
d ^ yb-r7L yN@7L-P0需要下载 1107kB 的软件包。
aE,uLKT`,`H0解压缩后会消耗掉 2634kB 的额外空间。
"}z#m;piC0获取:1
http://archive.ubuntu.comintrepid/universe vnc4-common 4.1.1+xorg1.0.2-0ubuntu7 [17.2kB]
pH)q|1x#G'_?0获取:2
http://archive.ubuntu.comintrepid/universe vnc4server 4.1.1+xorg1.0.2-0ubuntu7 [1089kB]51Testing软件测试网b.M,tJ9LXN
下载 1107kB,耗时 1min11s (15.4kB/s)                                                          51Testing软件测试网V+kL2NQ sS_%[ @
选中了曾被取消选择的软件包 vnc4-common。51Testing软件测试网||!B6n Hj#D5qD
(正在读取数据库 ... 系统当前总共安装有 119583 个文件和目录。)
'c*?m K(O7uq"e a0正在解压缩 vnc4-common (从 .../vnc4-common_4.1.1+xorg1.0.2-0ubuntu7_i386.deb) ...51Testing软件测试网_+p5Z3Vn3l`#x AA%e
选中了曾被取消选择的软件包 vnc4server。
#z1kN"Bd7O0正在解压缩 vnc4server (从 .../vnc4server_4.1.1+xorg1.0.2-0ubuntu7_i386.deb) ...
.A'V Dn;E0正在处理用于 man-db 的触发器...51Testing软件测试网,I)J^dy0fr"d
正在设置 vnc4-common (4.1.1+xorg1.0.2-0ubuntu7) ...

|"i)@3@2}}051Testing软件测试网8u:Z*LS MU(b

正在设置 vnc4server (4.1.1+xorg1.0.2-0ubuntu7) ...

%XnT(}oUZ:z j051Testing软件测试网 Kf*mQ&j"~)d,R

 51Testing软件测试网Xm){l~8A)UU

51Testing软件测试网G u'^$Dx(o

ylw@naruto:~$vncpasswd (使用vncpasswd设置VNC密码)51Testing软件测试网6OR5{!} ? Ft3e"`'}
Password:51Testing软件测试网u?x4z[&g5JA{
Verify:
2{D~*q~)u'a0
ylw@naruto:~$51Testing软件测试网BNx@DW/j4z`

Ux1A:A*Bg)`0ylw@naruto:~$sudo vi /home/ylw/.vnc/xstartup (编辑配置文件)51Testing软件测试网7m?{4x$w tR8_

51Testing软件测试网R#eb+_0K3]kj"u*{ F o

#!/bin/sh51Testing软件测试网\ aq+Iu0}1E

51Testing软件测试网0f ](Ze gF4\M'\

# Uncomment the following two lines for normal desktop:
-jO2vKX0# unset SESSION_MANAGER
.A C)i+\*Qw$LV$QE0# exec /etc/X11/xinit/xinitrc
51Testing软件测试网*],@9Ja7d YeZR#M

c3c~l#k SC*RP,y0[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup51Testing软件测试网R5hji"tx#Zo
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+}J] E(o TgO,d0xsetroot -solid grey
5v U'w0mpWq0vncconfig -iconic &
(zX,MI$bkU_.Y&{0xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
+t s6j&EH s@0# twm & (注释掉这行)
XB6s Bb`'w{_\0gnome-session & (在文件的末尾添加这行)

q{#_/[ B:n*A,h0

!{:hw WG)^!y0
U K*UN3`&@ V7V)C0ylw@naruto:~$vncserver :1 (启用vnc服务,并设置桌面的编号为1)51Testing软件测试网f G6X9atX7SC

51Testing软件测试网)FPy.t:Z ?V$pd UA

New 'naruto:1 (ylw)' desktop is naruto:151Testing软件测试网'Wz2]y(y1ks f

51Testing软件测试网&W*Y3S0VD"OQvG

Starting applications specified in /home/ylw/.vnc/xstartup51Testing软件测试网$hg2D vw*~4o%ti6H,cD
Log file is /home/ylw/.vnc/naruto:1.log

`n&f'P7vO |0

b`$q({agL(m1e0打开win下的vncview软件,输入:IP:1,点connect按纽51Testing软件测试网-Bd0R5dU2A

51Testing软件测试网l-]5Y B rus9n

(或者输入: 10.192.224.112 :5903)

0J mW$S U*e}%]L0

;XIAO w#x wK051Testing软件测试网$U:qgPl-G&e Ji

$N;Vo4ln(W?v0输入刚才设置的密码

h-U}y(Y8L&u0
51Testing软件测试网Oro*Az

T.ZEf0x0

"ZzD:a)}nY0出现这个很难看的界面,起先对这个问题很不明白为什么,正常情况应该是出现用户的桌面。后来才知道,原来在vnc服务中只有root用户才能使用桌面!51Testing软件测试网S8ytv1D l}&xA,_(S

51Testing软件测试网u3MT:War$U_r'b

ylw@naruto:~$sudo su - (使用命令切换到root用户,设置vnc密码和启动vnc服务)
0F"r ]?r4r\3ns0[sudo] password for ylw:
&H;\sB\x]0
root@naruto:~# vncpasswd
qG:u|^`/M0Password:51Testing软件测试网:uv8Zm4w
Password must be at least 6 characters - try again51Testing软件测试网 C q^$d)ZQ
Password:
#T~\+s.oB8{'?0Verify:
1Y,\|^ Vz;CQ} s0
root@naruto:~# vncserver :251Testing软件测试网+`RDK+hh
xauth: creating new authority file /root/.Xauthority
51Testing软件测试网bYg5an

51Testing软件测试网 C rLy.OF3{

New 'naruto:2 (root)' desktop is naruto:251Testing软件测试网c2^f!XJR-NQ

?3jW2wS|2u0Creating default startup script. /root/.vnc/xstartup
[:g9AM ?"QR-Vw0Starting applications specified in /root/.vnc/xstartup51Testing软件测试网+x2h ^Y*C Cn@
Log file is /root/.vnc/naruto:2.log

"GyI |%O051Testing软件测试网,O]ZuC1Y

root@naruto:~# vi /root/.vnc/xstartup51Testing软件测试网HR$\R]7L@+Mp

51Testing软件测试网+fm7aO5@

#!/bin/sh51Testing软件测试网W0~0N'F.t-P Im

51Testing软件测试网:?;p/~s5Q"v

# Uncomment the following two lines for normal desktop:
ni&P3Q Z0# unset SESSION_MANAGER
n cA/f_G2}|vu0# exec /etc/X11/xinit/xinitrc
51Testing软件测试网6IUi| k&B

51Testing软件测试网'V'v5{}fx(n

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup51Testing软件测试网2c.x?Jk ?/Rx"@
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources51Testing软件测试网2FS#bV:WbP7]
xsetroot -solid grey51Testing软件测试网#m#O4h7\#Ad1o!L*j
vncconfig -iconic &
#JL,\$N+qeY;j)X j0xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &51Testing软件测试网LWT.T&Hnd[
# twm &
.h$G^@+ce0gnome-session &
51Testing软件测试网)TIaE*d5l

51Testing软件测试网Z.\,W\(^w2n


)Zy9W}e`KT0
root@naruto:~# vncserver -kill :251Testing软件测试网 I'yo(W;A P(M
Killing Xvnc process ID 6491
!j y#L3~v)D F J0
root@naruto:~# vncserver :2

X_]0w;~!H051Testing软件测试网9?%uc3RAA.v ?4g

New 'naruto:2 (root)' desktop is naruto:2

X)\4B&z`,a.gM/L0

5PEjG` v;V3k C0Starting applications specified in /root/.vnc/xstartup
2AP$U$S*W,N o0Log file is /root/.vnc/naruto:2.log
51Testing软件测试网Xf#nb {

51Testing软件测试网b"^uG p9F1t0`

重新连接,此时的会话编号是2

KB R/vH0
51Testing软件测试网#lS0PZ2s

&W6LA vc@1~051Testing软件测试网Skz_5JF+H

成功出现gnome桌面.

_ct X&@%R^/d0

TAG: Linux Ubuntu ubuntu VNC

 

评分:0

我来说两句

Open Toolbar