重生之大纨绔下载:图片显示VNC配置远程Linux桌面控制好用 no displays configured

来源:百度文库 编辑:偶看新闻 时间:2024/05/03 10:29:18
VNC配置远程Linux桌面控制好用+no displays configured

   VNC涉及到的两个主要配置文件位置

vi /etc/sysconfig/vncservers

vi /root/.vnc/xstartup

   标准配置文件示例

   vi /etc/sysconfig/vncservers

[root@bogon /]# 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"

VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"

#!/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" &

#twm &

#startgno  &

gnome-session &


 二、vnc

  vnc client通过架构在tcp/ip上的vnc协议与vnc server沟通,通过认证后,把X server的桌面环境,输入设备,和X 资源交给vncserver掌控,vnc server将桌面环境通过vnc 协议送给vnc client端.让vnc client来操纵vnc server桌面环境和输入设备.
  
  首先下载到vnc的linux版本和windows版本.
  
  当前的linux版本是vnc-3.3.3r1_x86_linux_2.0.tgz
  
  当前的windows版本是vnc-3.3.3r7_x86_win32.zip
  
  1.安装linux版的vnc
  (1)安装
  
  tar zxvf vnc-3.3.3r1_x86_linux_2.0.tgz
  cd vnc_x86_linux_2.0
  cp *vnc* /usr/local/bin/
  mkdir /usr/local/vnc
  cp -r classes/ /usr/local/vnc/
  
  (2)设置vnc server的访问密码
  
  vncpasswd
  
  (3)启动vnc server
  
  vncserver
  
  注意运行后显示的信息,记下所用的端口号,一般从1开始,因为0被x server占用了.现在,你就能提供vnc服务了.vnc client的用法等会介绍.
  
  2、安装nt版的vnc
  1)安装
  
  解开vnc-3.3.3r7_x86_win32.zip包后,会产生winvnc和vncviewer两个目录.winvnc目录中是vnc server的安装程序,vncviewer目录中是vnc client的安装序.我只关心vnc server,在winvnc目录中执行setup即可.
  
  2)设置
  
  首先执行install default registry settings.
  
  run winvnc(app mode)就是执行vnc server
  
  这时可看到winvnc运行的小图标,用鼠标右键点击图标,在properties/incoming connections中设定密码.默认配置即可.
  
  现在,你的nt就能提供vnc服务了.
  
  3、使用vncviewer
  vnc server启动成功后,你就可用vncviewer来远程控制桌面了.
  
  vncviewer xxx.xxx.xxx.xxx:display number
  
  例如,vncviewer 172.16.1.2:1
  
  按要求输入密码就可以看到远程的桌面了.
  
  注意:viewers需要在16位色的显示模式下工作,如果您的操作系统中没上16位色,那么请您及时的调整您计算机的显示模式。不然vncviewer无法正常工作。
  
  4、linux版vnc server的改进
  linux上的vnc server内定的桌面管理环境是twm,实在是太简陋了.
  
  修改$HOME/.vnc/xstartup这个文件.
  
  把所有内容的行前加上#,再在接尾部份加上:
  
  startkde &(这个未测试,但在gnome下写成这样是错误的startgonme & ,必须写成gonme-session & 形式)
      
  你当然可用你喜好的桌面代替.我这是用kde来代替twm,速度会慢少少,但用起来方便不少.
  
  注意要重新启动vnc server.
  
  5、通过浏览器使用vnc
  
  通过浏览器使用vnc,要注意端口号的变化.
  
  假设vnc server是172.16.1.2:1的话,那么,可用浏览器访问http://172.16.1.2:5801

  端口号=display number + 5800

   疑难解答:

        1.2、启动/etc/init.d/vncserver startStarting VNC server: no displays configured                [  OK  ] 

                出现这个时,要修改vncserver的配置文件vi /etc/sysconfig/vncservers将下面这两个注释去掉即可。 #                    VNCSERVERS="1:root"

#VNCSERVERARGS[2]="-geometry 800x600 -nolisten t -nohttpd -localhost"

如果还有其他用户的话 先添加用户然后在VNCSERVERS="1:root" 添加即可如: VNCSERVERS="1:gavin 2:root 3:root"