找回密码
 注册
搜索
热搜: 回贴
微赢网络技术论坛 门户 服务器 Linux/BSD 查看内容

linux xen 之 vnc 配置详解

2009-12-20 13:24| 发布者: admin| 查看: 27| 评论: 0|原作者: 段誉


linux xen 之 vnc 配置详解

因为要远程在linux 下安装 windows 所以下要配置下 vnc 连接
当然 安装好一个之后拷贝更快但是第一次安装还是图形界面安装比较容易 o(∩_∩)o...

试验环境 centos 5.2
(virtual network computing,虚拟网络计算),是用来显示远程计算机整个桌面的轻量型远程控制
程序。

一、 安装:
1. 需要的软件包安装光盘里就有,
vnc-4.1.2-9.el5
vnc-server-4.1.2-9.el5
centos 5.2 默认装了 vnc-4.1.2-9.el5
没有装 vnc-server-4.1.2-9.el5
# mount /dev/cdrom /mnt/cdrom
# rpm -ivh /mnt/cdrom/CentOS/vnc-server-4.1.2-9.el5.rpm
再简单点: yum -y install vnc vnc-server o(∩_∩)o...
# rpm -qa | grep vnc*
vnc-4.1.2-9.el5
vnc-server-4.1.2-9.el5
这样就安装好了;

使用最新的可到 RealVNC 官网下载:
http://www.realvnc.com/
但是如果要是在windows 管理linux 就必须要下载一个 vnc 客户端:vncviewe 官方都有;
二、 使用方法:
1、 服务器端配置例如:
第一次启动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
普通用户:
[root@localhost /]#su huilin
[huilin@localhost /]$ vncserver
You will require a password to access your desktops.
Password: 输入vnc 连接密码
Verify: 确认vnc密码
xauth: creating new authority file /home/huilin/.Xauthority
New 'localhost.localdomain:2 (huilin)' desktop is localhost.localdomain:2
Creating default startup script /home/huilin/.vnc/xstartup
Starting applications specified in /home/huilin/.vnc/xstartup
Log file is /home/huilin/.vnc/localhost.localdomain:2.log
* 注意到每个用户都可以启动自己的 vncserver,每个用户可以启动多个 vncserver,
用ip加端口号 ip:1,ip:2,ip:3 来标识。
例:
[huilin@localhost /]$ vncserver :2
A VNC server is already running as :2
2、修改vnc 配置文件
在设置好密码后:
[root@localhost ~]# ls -a
. anaconda-ks.cfg .bash_logout .bashrc install.log .tcshrc .Xauthority
.. .bash_history .bash_profile .cshrc install.log.syslog .vnc
如果用的是gnome 桌面环境还需要修改
[root@localhost .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 添加连接时使用 gnome 桌面环境
twm &
下一步设置登陆用户桌面环境信息
#vi /etc/sysconfig/vncservers 添加:

VNCSERVERS="1:root 2:huilin" 添加用户名机设置用户登陆的桌面环境信息
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 800x600"
3、 设置vnc server分辨率:
#vncserver -geometry 800x600
#vncserver -geometry 640x480
4、 设置vncserver的色深:
8位为256色,16位为64k色
#vncserver -depth 8
#vncserver -depth 16
接下来就可以vnc 客户端连接了
windows 就用 windows版本的vncviewer 到
http://www.realvnc.com/
下载
5、 客户端:
a、在linux下,运行vncviewer命令即可,服务器地址的写法形如192.168.3.119:1
b、在windows下,运行windows版本的vncviewer即可,用法与linux下相近。
c、用浏览器(平台无关),作为java applet来实现,以形如
http://192.168.3.119:5801
的方式来启
动 (vnc 端口从5800 开始依次类推)
6、 密码修改:
运行:
#vncpassword
即可:
7、 停止vnc server:
#vncserver -kill :1
#vncserver -kill :2
注意到vncserver只能由启动它的用户来关闭,即时是root也不能关闭其它用户开启的vncserver,
除非用kill命令暴力杀死进程。
8、 指定显示端口号启动vnc server:
#vncserver :3
$vncserver :6
9、 稳定性设置:
vncserver默认在多个客户机连接同一个vncserver的显示端口时,vncserver端口旧连接,而为新连接
服务,可通过-dontdisconnect拒绝新连接请求而保持旧的连接。
10、 设置vncserver的同一个显示端口可以连接多个客户机
#vncserver -alwaysshared
11、 vnc的反向连接
大多数情况下,vncserver总处于监听状态,vnc client主动向服务器发出请求从而建立连接。然而在
一些特殊的场合,需要让vnc客户机处于监听状态,vncsrever主动向客户机发出连接请求,此谓vnc的
反向连接。主要步骤:
a、启动vnc client,使vncviewer处于监听状态
#vncviewer -listen
b、启动vncserver
#vncserver
c、在vncserver端执行vncconnect命令,发起server到client的请求
#vncconnect -display :1 192.168.3.69
因为在linux 重启以后 vnc 不会自动启动所以还要设置vnc 开机自动启动脚本
待续
下一篇就是 xen 下windows 的安装了 o(∩_∩)o...






最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 03:19 , Processed in 0.172660 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部