上善若水,不浮不沉!
分类: LINUX
2015-01-05 15:48:42
Vnc相关依赖包:
gtk-vnc-python-0.3.2-3.el5
vnc-server-4.1.2-14.el5
gtk-vnc-0.3.2-3.el5
vnc-4.1.2-14.el5
[root@localhost: ~]#rpm -q gtk-vnc-python vnc-server gtk-vnc vnc
2. 创建VNCSERVER服务:
[root@localhost /]# vncserver
You will require a password to access your desktops.
Password: 输入vnc 连接密码
Verify: 确认vnc密码
xauth: creating new authority file /root/.Xauthority
New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1
Creating default startup script. /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
查看已经启动的vncserver
Ps –ef|grep vnc
3. 修改配置文件,实现图形化连接
修改~/.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
……….
………..
4. 启动对应的VNCSERVER,使用以下命令:
Vncserver :1 --启动端口号为5901的vncserver
Vncserver :2 --启动端口号为5902的vncserver
5. 关闭对应的VNCSERVER,使用以下命令:
Vncserver –kill :1 --关闭端口号为5901的vncserver
Vncserver –kill :2 --关闭端口号为5902的vncserver
6.修改vncserver的密码:
Vncpasswd
7. VNCSERVER修改登录用户的信息
[root@localhost: ~]#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="1:root 2:demo" 此处添加用户
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
#vncserver -geometry 800x600 设置vncserver的分辨率
#vncserver -geometry 640x480 设置vncserver的分辨率
#vncserver -depth 8 设置vncserver的色深
#vncserver -depth 16 设置vncserver的色深
8.客户端连接VNC服务器:
a、在linux下,运行vncviewer命令即可,服务器地址的写法形如192.168.3.119:1
b、在windows下,运行windows版本的vncviewer即可,用法与linux下相近。
c、用浏览器(平台无关),作为java applet来实现,以形如的方式来启动 (vnc 端口从5800 开始依次类推,一般会是5800,5900)