linux 安装 vnc

来源:互联网 发布:远程控制软件破解版 编辑:程序博客网 时间:2024/04/30 12:59
下载URL:
http://www.realvnc.com/products/download.html

2010年08月13日 星期五 08:58

本次安装是redhat 下配置vnc,一般redhat操作系统已经安装了vnc

1. 检查vncserver是否已经安装

$ rpm -qa|grep vnc

vnc-server-4.1.2-14.el5_3.1

2.启动vncserver

# pwd

/root

# vncserver

 

You will require a password to access your desktops.

 

Password:

Verify:

xauth: creating new authority file /root/.Xauthority

 

New 'redhat:1 (root)' desktop is aiwm157:1

 

Creating default startup script /root/.vnc/xstartup

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/redhat:1.log

这时候在/root下面有个隐藏文件夹

#ls -a .vnc/

. .. redhat:1.log redhat:1.pid passwd xstartup

3.修改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 &

 

 

请修改为:

# more 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" &

startgnome&

DISPLAY=:1 gnome-session&

红色字体为修改后的内容

4.检测进程

# ps -ef|grep vnc    

root     11704     1 0 10:06 pts/7    00:00:00 Xvnc :1 -desktop redhat:1 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -pn

root    11711     1 0 10:06 pts/7    00:00:00 vncconfig -iconic

root     11754 11596 0 10:18 pts/7    00:00:00 grep vnc

5.杀掉进程
# vncserver -kill :1

这里的1,代表的是之前启动的桌面号。

6.启动进程

启动桌面号1的vncserver
# vncserver :1

 

New 'redhat:1 (root)' desktop is aiwm157:1

 

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/redhat:1.log

7.windows客户端安装vnc

在连接服务器地址输入类似以下格式     IP地址:桌面号        这里例子如:10.3.3.111:1

成功连接后,需要输入之前设置的密码,才允许访问。

注意:请关闭redhat的防火墙,否则会连接不上。