CentOS下安装配置VNC

  1. 云栖社区>
  2. 博客>
  3. 正文

CentOS下安装配置VNC

shy丶gril 2016-05-25 13:08:21 浏览1477
展开阅读全文
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://navyaijm.blog.51cto.com/4647068/809453

1. 检查vnc客户端和服务器是否已经安装:

 

   [root@datacenter7 smdata]# rpm -q vnc vnc-server
   vnc-4.1.2-14.el5_6.6
   vnc-server-4.1.2-14.el5_6.6

 

cent os 5已包含vnc的安装包

 

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

(注:这里的“用户名”是指linux系统用户的名称)

[root@datacenter7 oracle]# 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:oracle"
#VNCSERVERS="2:root"
#VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
#VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
VNCSERVERARGS[1]="-geometry 800x600"

 

3. 设置用户navy的密码

[oracle@datacenter7 ~]$ vncserver

Password:

Verify:

 

4. 启动VNC服务

[root@datacenter7 ~]# /sbin/service vncserver start

Starting VNC server: 1:gavin             [ OK ] 

 

5. 输入命令

 

[oracle@datacenter7 ~]$ cd .vnc/

[oracle@datacenter7 .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" &
#startkde &
gnome-session &

 

6. 重启vncserver

[root@datacenter7 ~]# /sbin/service vncserver restart

 

7. Windows登陆到VNC Server

(1).从IE登录

 

直接从IE浏览器中输入如下地址:

 

http://xxx.xxx.xxx.xxx:5801

 

输入密码即可使用。

 

(2).从VNC view登录

 

在windows上安装vnc view,然后输入xxx.xxx.xxx.xxx:1,连接登录,输入密码即可。

 

备注:如果从vnc view登录时,提示connection refused(10061),则是因为linux防火墙的问题,登录centos系统,选择 System-->Preferences-->Remote Desktop,勾选sharing中的两项,Security两项不勾,点击关闭,然后再重新用vnc view登录

本文出自 “屌丝运维男” 博客,请务必保留此出处http://navyaijm.blog.51cto.com/4647068/809453

网友评论

登录后评论
0/500
评论
shy丶gril
+ 关注