Centos5.6 vnc server

一.环境描述

server:centos5.6

client:ubuntu 11.4

 

二,任务

在centos5.6上搭建vncserver,通过client即ubuntu 11.4连接。

 

 

三,搭建vncserver

1,

[root@sss .vnc]# rpm -qa | grep vnc-server

vnc-server-4.1.2-14.el5_5.4

#查看软件包安装

 

2 ,

[root@sss .vnc]# vncpasswd

Password:

#设置vnc password注意:这里的vnc password并不是用户密码,是连接密码。

 

3,

[root@sss .vnc]# 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="2:myusername"

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

VNCSERVERS="2:root"

VNCSERVERARGS[2]="-geometry 800x600"

#编辑主配置文件

 

[root@sss /]# cd ~/.vnc/

[root@sss .vnc]# ls

passwd

#查看.vnc目录文件

 

4,

[root@sss .vnc]service vncserver start

#启动服务

[root@sss .vnc]# ls

passwd sss:2.log  sss:2.pid  xstartup

#查看启动脚本

 

5,

[root@sss .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" &

twm &

#编辑启动脚本

 

6,

[root@sss .vnc]# service vncserver restart

Shutting down VNC server: 2:root                           [FAILED]

Starting VNC server: 2:root xauth:  creating new authority file /root/.Xauthority

New 'sss:2 (root)' desktop is sss:2

Creating default startup script /root/.vnc/xstartup

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/sss:2.log

                                                          [ OK  ]

#重启服务

 

三,ubuntu client链接服务端

 

在ubuntu“应用程序”---“互联网”---“远程桌面查看器”

在远程桌面查看器中选择“连接”,在协议中选择“VNC”,主机中为主机IP:2,点击连接。

 

随后会出现验证窗口

在此需要输入的口令为vncpasswd,并不是系统口令。输入口令后就连接到centos5.6图形界面。

你可能感兴趣的:(centos,centos,ubuntu,职场,vnc,休闲)