centos安装vncserver

2083阅读 0评论2010-09-09 黑马王子
分类:LINUX

1. 检查vnc客户端和服务器是否已经安装在你的系统中:
[gavin@centos ~]$ rpm -q vnc vnc-server
package vnc is not installed
vnc-server-4.0-8.1

2. 将用户名称加入到配置文件:
(注:这里的“用户名”是指linux系统用户的名称)
[gavin@centos ~]# vi /etc/sysconfig/vncservers
#
# Uncomment the line below to start a VNC server on display :1
# 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
# <>.

# VNCSERVERS=”1:myusername”

# VNCSERVERS=”1:gavin 2:john” # use the method for more user
VNCSERVERS=”1:gavin”

# VNCSERVERARGS[1]=”-geometry 800×600″
 VNCSERVERARGS[1]=”-geometry 1024×768″

3. 设置用户gavin的密码
[gavin@centos ~]$ vncpasswd
Password:
Verify:

4. 启动VNC服务
[gavin@centos ~]# /sbin/service vncserver start
Starting VNC server: 1:gavin                [  OK  ] 

5.
[gavin@centos ~]$ cd ~/.vnc/
[gavin@centos .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 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session & #set starting GNOME desktop
#startkde &   #kde desktop
#twm &      #Text interface

6. 重启vncserver
[gavin@centos ~]# /sbin/service vncserver restart

Shutting down VNC server: 1:gavin                          [  OK  ]
Starting VNC server: 1:gavin                [  OK  ] 

将最后一行更改为
startgnome
DISPLAY=:1 gnome-session
就是启动gnome图形界面窗口。
保存后,重启vnc。
、下载windows vnc客户端软件。
运行VNC查看器,输入服务器的IP和桌面编号:
如:10.60.30.112:1
而后输入VNC连接密码就可以登录进去了。

、通过浏览器控制:
如果主控端没有安装vnc viewer,通过浏览器也可以控制,强大吧。例如访问地址:
(其中端口号=桌面显示编号 + 5800 ,前面我们配置时提示桌面编号是1,所以端口号就是5801),会出现登录界面。需要浏览器开启java applet.

上一篇:LINUX--修改IP地址
下一篇:快速工具栏的显示桌面图标不见了怎么办?