登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

herb

喜欢写博,喜欢安静,喜欢挑战!

 
 
 

日志

 
 

配置VNC 使window下vnc访问linux的桌面  

2011-02-25 16:45:50|  分类: Linux Support |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
安装vnc(centos默认已安装)
[root@localhost ~]# yum install vnc*

2. 将用户名称加入到配置文件

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
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# 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"      (一定为系统用户,且牢记桌面模式编号为1
 VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost" (可自行定义分辨率,为永久定义)

 

注释:

一次性定义为,重启将失效:

[root@localhost: ~]#vncserver -geometry 800×600        #设置vncserver的分辨率   

[root@localhost: ~]#vncserver -depth 16           #设置vncserver的色深

3设置密码

$    vncpasswd 2
Password: Verify:
4. 编辑配置文件

[root@localhost ~]# vi /root/.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
xsetroot -solid grey
vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &  这一步是为了能够在windows上显示linxu的桌面,否则只看到一个终端窗口
gnome-session gnome &
添加使用gnome桌面环境


  5 window访问Linux 

     vnc访问框输入

     192.168.0.1:1 或者: 192.168.0.1:5901

   

6 关闭和启动相应编号的VNC服务命令:

vncserver -kill :x (X为编号)

关闭 vncserver -kill:1

启动 vncserver 1

 

错误汇总:

If you get error messages like this

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
xhost: unable to open display ":0.0"

when running a program, you probably need to add the user to the X server access list.
You can add a user to the X server access list with

# xhost +local:username

This allows "username" to connect to the local running X server.

  评论这张
 
阅读(707)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018