收藏 分享(赏)

linux VNCserver配置方法.doc

上传人:mcady 文档编号:7760940 上传时间:2019-05-25 格式:DOC 页数:5 大小:48KB
下载 相关 举报
linux VNCserver配置方法.doc_第1页
第1页 / 共5页
linux VNCserver配置方法.doc_第2页
第2页 / 共5页
linux VNCserver配置方法.doc_第3页
第3页 / 共5页
linux VNCserver配置方法.doc_第4页
第4页 / 共5页
linux VNCserver配置方法.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

1、linux VNCserver 配置 (linux 远程桌面)目前 linux 系统都自带 VNC在 Linux 操作系统最流行的图形化操作软件是 VNC,正如 windows 下的 mstsc 远程桌面,在大多数 Linux 发行版都带了 VNC Server 的发行包,通过 rpm -qa|grep vnc 检查,若没有,下载 rpm包进行安装即可.1.rootlocalhost # rpm -qa|grep vncvnc-4.1.2-14.el5_3.1vnc-server-4.1.2-14.el5_3.12.启动服务器端的 VNC 服务rootlocalhost # /etc/init

2、.d/vncserver startStarting VNC server: OK 目前 linux 系统都自带 VNC,不用安装启动 VNCrootlocalhost # service vncservice restart3.运行 vncserver 命令,如果第一次配置 VNC Server,会要求提供登录 VNC 使用的密码。以后也可以使用 vncpasswd 来修改密码。rootlocalhost # vncserverYou will require a password to access your desktops.Password:Verify:New localhost.l

3、ocaldomain:1 (root) desktop is localhost.localdomain:1Creating default startup script /root/.vnc/xstartupStarting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost.localdomain:1.log4.修改配置文件 /root/.vnc/xstartuprootlocalhost # cat /root/.vnc/xstartup ,如下两行的注释去掉 .#!/bin/sh#

4、Uncomment the following two lines for normal desktop:unset SESSION_MANAGERexec /etc/X11/xinit/xinitrc -x /etc/vnc/xstartup & exec /etc/vnc/xstartup -r $HOME/.Xresources & xrdb $HOME/.Xresourcesxsetroot -solid greyvncconfig -iconic &xterm -geometry 8024+10+10 -ls -title “$VNCDESKTOP Desktop” &twm &5.

5、在 Windows 使用 VNC Viewer 登录了输入服务器地址:ip:1然后提示输入密码,输入你刚才设定的密码就好了.注意:IP 地址后面的 :1 的意思是 Linux 上面 VNC 设定的 Display No. 每运行一个 vncserver 就会多创建一个 Display,Display No 也就会加 1。6.在 SSH 终端中输入 vncserver,让 VNC 打开一个新的 Displayrootlocalhost # vncserver New localhost.localdomain:2 (root) desktop is localhost.localdomain:2

6、Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost.localdomain:2.log附一些常见的问题:VNC Viewer 下载地址:http:/ vncserver 后才能登录。如果服务器一直没有重启过,就不用了。如果要杀掉 vncserver 进程,可执行 vncserver :1 kill ,1 表示 display 的 ID 号。(1) 重设 VNC 密码rootlocalhost # vncpasswdPassword:Verify:(2) 启动和 kill v

7、ncserverrootlocalhost # vncserver :23New localhost.localdomain:23 (root) desktop is localhost.localdomain:23Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost.localdomain:23.log如下:kill display 的 ID 1,1 的 pid 是:6653rootlocalhost # ps -auxwf|grep vnc|grep -v grepWar

8、ning: bad syntax, perhaps a bogus -? See /usr/share/doc/procps-3.2.7/FAQroot 6653 0.0 1.3 13660 6836 pts/0 S 04:44 0:00 Xvnc :1 -desktop localhost.localdomain:1 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport

9、 5901 -pnroot 6661 0.0 0.2 4276 1304 pts/0 S 04:44 0:00 vncconfig -iconicroot 6716 0.1 2.1 20972 11276 pts/0 S 04:51 0:01 Xvnc :2 -desktop localhost.localdomain:2 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbpo

10、rt 5902 -pnroot 6936 0.4 2.1 20856 11116 pts/0 S 05:06 0:00 Xvnc :23 -desktop localhost.localdomain:23 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5923 -pnrootlocalhost # kill -9 6653rootlocalhost # ps -a

11、uxwf|grep vnc|grep -v grepWarning: bad syntax, perhaps a bogus -? See /usr/share/doc/procps-3.2.7/FAQroot 6716 0.1 2.1 20972 11276 pts/0 S 04:51 0:01 Xvnc :2 -desktop localhost.localdomain:2 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024768 -depth 16 -rfbwait 30000 -rfba

12、uth /root/.vnc/passwd -rfbport 5902 -pnroot 6936 0.3 2.1 20856 11116 pts/0 S 05:06 0:00 Xvnc :23 -desktop localhost.localdomain:23 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5923 -pn当然,vncserver -kill :2

13、 也可以了,rootlocalhost # vncserver -kill :2Killing Xvnc process ID 6716rootlocalhost # ps -auxwf|grep vnc|grep -v grepWarning: bad syntax, perhaps a bogus -? See /usr/share/doc/procps-3.2.7/FAQroot 6936 0.2 2.1 20856 11116 pts/0 S 05:06 0:00 Xvnc :23 -desktop localhost.localdomain:23 (root) -httpd /usr

14、/share/vnc/classes -auth /root/.Xauthority -geometry 1024768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5923 -pn(3)重新启动一个手动 kill 的 vncserverrootlocalhost # vncserver :1Warning: localhost.localdomain:1 is taken because of /tmp/.X1-lockRemove this file if there is no X server localho

15、st.localdomain:1A VNC server is already running as :1rootlocalhost # rm -rf /tmp/.X1-lockrootlocalhost # vncserver :1 Warning: localhost.localdomain:1 is taken because of /tmp/.X11-unix/X1Remove this file if there is no X server localhost.localdomain:1A VNC server is already running as :1rootlocalho

16、st # rm -rf /tmp/.X11-unix/X1rootlocalhost # vncserver :1 New localhost.localdomain:1 (root) desktop is localhost.localdomain:1Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost.localdomain:1.logrootlocalhost #rootlocalhost # ps -auxwf|grep vnc|grep -v grepWarning

17、: bad syntax, perhaps a bogus -? See /usr/share/doc/procps-3.2.7/FAQroot 6936 0.0 2.4 22296 12680 pts/0 S 05:06 0:00 Xvnc :23 -desktop localhost.localdomain:23 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport

18、5923 -pnroot 7337 1.0 2.1 20252 10856 pts/0 S 05:19 0:00 Xvnc :1 -desktop localhost.localdomain:1 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -pn说明:因是手动删除的,所以也要把.lock 删除掉,才能重新启动了 .(4).VNC 服务使用的端口号与桌面

19、号的关系VNC 服务使用的端口号与桌面号相关,VNC 使用 TCP 端口从 5900 开始,对应关系如下桌面号为“1” - 端口号为 5901桌面号为“2” - 端口号为 5902桌面号为“3” - 端口号为 5903基于 Java 的 VNC 客户程序 Web 服务 TCP 端口从 5800 开始,也是与桌面号相关,对应关系如下桌面号为“1” - 端口号为 5801桌面号为“2” - 端口号为 5802桌面号为“3” - 端口号为 5803基于上面的介绍,如果 Linux 开启了防火墙功能,就需要手工开启相应的端口,以开启桌面号为“1”相应的端口为例,命令如下rootlocalhost# i

20、ptables -I INPUT -p tcp dport 5901 -j ACCEPTrootlocalhost # iptables -I INPUT -p tcp dport 5801 -j ACCEPT(5)配置 VNC 图形桌面环境为 KDE 或 GNOME 桌面环境rootlocalhost # cat /root/.vnc/xstartup#!/bin/sh# Uncomment the following two lines for normal desktop:unset SESSION_MANAGERexec /etc/X11/xinit/xinitrc -x /etc/v

21、nc/xstartup & exec /etc/vnc/xstartup -r $HOME/.Xresources & xrdb $HOME/.Xresourcesxsetroot -solid greyvncconfig -iconic &xterm -geometry 8024+10+10 -ls -title “$VNCDESKTOP Desktop” &twm &将这个 xstartup 文件的最后一行修改为“startkde & ”,再重新启动 vncserver 服务后就可以登陆到KDE 桌面环境将这个 xstartup 文件的最后一行修改为“gnome-session &”,再重

22、新启动 vncserver 服务后就可以登陆到 GNOME 桌面环境重新启动 vncserver 服务的方法:rootlocalhost # vncserver -kill :1rootlocalhost # vncserver :1(6) 配置多个桌面可以使用如下的方法启动多个桌面的 VNCvncserver :1vncserver :2但是这种手工启动的方法在服务器重新启动之后将失效,因此,下面介绍如何让系统自动管理多个桌面的 VNC,方法是将需要自动管理的信息添加到/etc/sysconfig/vncservers 配置文件中,先以桌面 1 为 test 用户桌面 2 为 test1 用

23、户为例进行配置如下:格式为:VNCSERVERS=”桌面号:使用的用户名 桌面号:使用的用户名”rootlocalhost # vi /etc/sysconfig/vncserversVNCSERVERS=”1:test 2:test1VNCSERVERARGS1=”-geometry 1024768VNCSERVERARGS2=”-geometry 1024768(7) 设置 VNC 服务随系统启动自动加载第一种方法:使用“ntsysv”命令启动图形化服务配置程序,在 vncserver 服务前加上星号,点击确定,配置完成。第二种方法:使用“chkconfig”在命令行模式下进行操作,命令使用如下:rootlocalhost # chkconfig vncserver onroottestdb # chkconfig list vncservervncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off第三种方法:把这行命令/etc/init.d/vncserver start 加到/etc/rc.local 启动项里。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报