All things are difficult before they are easy. 没有软件的裸机是一具僵尸,没有硬件的软件是一个幽灵。2012,专注于Linux和C语言,关注自动化、性能测试,关注开源社区和开源测试工具、方法,尝试测试团队管理!
VNC简介及RedHat中VNC的设置和使
上一篇 /
下一篇 2011-02-19 00:52:31
/ 个人分类:软件应用
公司的RHEL5u5服务器上设置VNC时,由于我开始不太明白,导致没设置成功,后来google了些资料看了,结合自己的一些实践,对VNC的配置和使用都比较清楚了,下面简单记录一下,以RedHat系统中VNC为例。0.What's VNC ?In computing,Virtual Network Computing (VNC)is a graphical desktop sharing system that uses the RFB protocol to remotely control another computer. It transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network.VNC is platform-independent – a VNC viewer on one operating system may connect to a VNC server on the same or any other operating system. There are clients and servers for many GUI-based operating systems and for Java. Multiple clients may connect to a VNC server at the same time. Popular uses for this technology include remote technical support and accessing files on one's work computer from one's home computer, or vice versa.VNC is a open source software under the GNU General Public License.1.install vnc 安装VNC在redhat中安装vnc server: rpm -ivh vnc-server-4.1.2-9.el5.rpm检查是否已经安装vnc的rpm包:rpm -qa | grep vnc2.configure vnc 配置VNC设置登陆用户桌面环境信息 #vi /etc/sysconfig/vncservers添加: VNCSERVERS="1:root 2:master" #添加用户名机设置用户登陆的桌面环境信息, 这里表示,1号桌面对应root账号,2号桌面对应master账号。 VNCSERVERARGS[1]="-geometry 800x600" VNCSERVERARGS[2]="-geometry 800x600" #参数说明:-geometry 800x600 桌面分辨率-nolisten tcp 阻止通过TCP连接VNC服务器-nohttpd 阻止基于浏览器的VNC客户端连接。用浏览器的方式连接VNC图象质量不大满意,速度也不快,也不安全。如果没有禁止浏览器Applet窗口登录,我们可以在浏览器里输入:[url]http://vnc-server-ip:5802[/url] 这样就会出弹出来一个类似VNC viewer客户端的登录小窗口。VNC服务使用的端口号与桌面号的关系 VNC服务使用的端口号与桌面号相关,VNC使用TCP端口从5900开始,对应关系如下 桌面号为“1” ---- 端口号为5901 #vncviewer链接的tcp端口号 5900+1 桌面号为“2” ---- 端口号为5902 …… 基于Java的VNC客户程序Web服务TCP端口从5800开始,也是与桌面号相关,对应关系如下 桌面号为“1” ---- 端口号为5801 #http协议网络连接的端口号 5800+1 桌面号为“2” ---- 端口号为5802 …… 基于上面的介绍,如果Linux开启了防火墙功能,就需要手工开启相应的端口,以开启桌面号为“1”相应的端口为例,命令如下: [root@testdb ~]# iptables -I INPUT -p tcp --dport 5901 -j ACCEPT [root@testdb ~]# iptables -I INPUT -p tcp --dport 5801 -j ACCEPT 命令vncpasswd建立登录vnc-server的密码。 配置启动vnc的X界面/home/root/.vnc/xstartup #这个文件是配置root账号的,账号根据实际情况选择 去掉如下两行的注释 unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc 配置桌面环境,将这个xstartup文件的最后一行修改为“startkde &”,再重新启动vncserver服务后就可以登陆到KDE桌面环境 将这个xstartup文件的最后一行修改为“gnome-session &”,再重新启动vncserver服务后就可以登陆到GNOME桌面环境3.start vncserver 启动vncserver如果已经配置好了上面的配置文件,启动命令: service vncserver start如果想启动其中一个桌面,则可用:vncserver :2 #就启动了序号为2的桌面的vnc服务4.vncviewers connect to vncserver 连接vnc服务器 4.1 redhat终端中,vncviewer Ip:x #x为桌面号,或者为5901(5900+1)这样的vnc端口 4.2 在web浏览器中,输入:http://IP:y #y为5800+x,x为桌面编号5.stop vnc service 关闭vnc服务service vncserver stop关闭一个vnc桌面,vncserver -kill x #kill掉了x号桌面6.other useful commands 其他一些有用的命令service vncserver status #查看vncserver的运行状态service vncserver restart #重新启动svnserver 设置VNC服务随系统启动自动加载 第一种方法:使用“ntsysv”命令启动图形化服务配置程序,在vncserver服务前加上星号,点击确定,配置完成。 第二种方法:使用“chkconfig”在命令行模式下进行操作,命令使用如下(预知chkconfig详细使用方法请自助式man一下) [root@testdb ~]# chkconfig vncserver on [root@testdb ~]# chkconfig --list vncserver vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off参考资料:
http://snailwarrior.blog.51cto.com/680306/141392
http://www.jz123.cn/text/0133176.html
http://www.xiaofeng.org/article/20090422360.htm
http://nic.dlou.edu.cn/s/14/t/21/0d/25/info3365.htm
http://www.51testing.com/?uid-64098-action-viewspace-itemid-142803
http://wenda.tianya.cn/wenda/thread?tid=3be1f26dea527034
收藏
举报
TAG:
Linux
linux
VNC
vnc