`
nlslzf
  • 浏览: 1026530 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

linux下vncserver配置与win下vnc客户端

 
阅读更多

http://tgyd2006.iteye.com/blog/871040

--begin vnc 远程桌面 
--注意:从服务端启动信息得知应该登录哪个桌面[第一次为桌面1] 

1,先看服务端启动了没有? 
[root@10 first]# ps -ef | grep vnc 
root      6608  6567  0 21:38 pts/0    00:00:00 grep vnc 

2,启动服务端 
[root@10 first]# vncserver 
perl: warning: Setting locale failed. 
perl: warning: Please check that your locale settings: 
        LANGUAGE = (unset), 
        LC_ALL = (unset), 
        LANG = "en_UTF-8" 
    are supported and installed on your system. 
perl: warning: Falling back to the standard locale ("C"). 
New '10.0.22.230:1 (root)' desktop is 10.0.22.230:1   --注意: 这里决定了客户端怎么登陆[10.0.22.230:1] 
Starting applications specified in /root/.vnc/xstartup 
Log file is /root/.vnc/10.0.22.230:1.log 

设置连接VNC服务器的密码  --注意:这一步一定不能少 
[root@10 first]#vnspassword 
Password:123456 
Verify:123456 

设置环境变量(否则远程连接使用图形界面时会报错) 
[root@localhost ~]# export DISPLAY=localhost:1   
[root@localhost ~]# xhost +  --注意:执行xhost +,并且提示“access control disabled, clients can connect from any host”才正确。 

3,客户端登录[Windown] 
服务器:10.0.22.230:1 回车 
用户名:灰掉[不能输入,即不需要] 
密码:123456[即前面设置的密码] 

--end vnc 远程桌面 

--================================= 

VNC最初由AT&T开发,是一个对系统进行远程管理的软件.其操作方式类似于现在Windows下常见的远程桌面,当然其资格比Windows的远程桌面更老.在Windows下的VNC软件有RealVNC等. 

linux系统当然不支持Windows的远程桌面登录,那么我们如何用一台Windows的笔记本来管理一台linux的服务器呢? 

下载页面: 
http://www.realvnc.com/products/download.html 
http://www.onlinedown.net/soft/45175.htm 

首先,我们当然会考虑SSH,在linux下安装SSH服务器,然后在windows下使用puTTY登录进行管理. 
但是现在,我们不满足仅仅使用命令行方式,我们同样想使用GUI界面.那么: 

1.在linux系统下安装VNC Server,大多数linux发行版都带了VNC Server的发行包.只要选择安装就可以了. 
2. 在Windows下安装VNC 客户端,以RealVNC为例,VNC客户端叫做VNC Viewer.VNC的使用相对比较简单,输入客户端的IP,然后VNC会进行连接,然后弹出密码框输入密码.没有问题的话就连接上了. 
3. 配置linux VNC Server. 

(1)启动VNC 服务.通过puTTY以SSH方式登录服务器,假设用户名为test 

login as: test 
[test@MyServer's password: 
[test@xok.la ~]$ /etc/init.d/vncserver start 
Starting VNC server: no displays configured                [  OK  ] 
(2)运行vncserver命令,如果第一次配置VNC Server,会要求提供登录VNC使用的密码.以后也可以使用vncpasswd来修改密码. 

[test@xok.la ~]$ vncserver 

You will require a password to access your desktops. 

Password:123456 
Verify:123456 
xauth:  creating new authority file /root/.vnc/.Xauthority 

New 'xok.la.localdomain:1 (test)' desktop is xok.la.localdomain:1 

Creating default startup script /root/.vnc/xstartup 
Starting applications specified in /root/.vnc/xstartup 
Log file is /root/.vnc/xok.la.localdomain:1.log 
(3)此时就可以在Windows使用VNC viewer登录了 
输入服务器地址:192.168.0.64:1 
然后提示输入密码,输入你刚才设定的密码就好了,如123456 

注意:IP地址后面的:1的意思是linux上面VNC设定的Display No.每运行一个vncserver就会多创建一个Display,Display No也就会加一. 
虽然此时可以登录,但是登录后看到的界面是X term的界面,还不是正常的X Window界面,我们要修改配置,使之使用X Window 

(4)修改配置文件/root/.vnc/xstartup,使之与下面内容相同 

[test@xok.la .vnc]$ cat 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 & 
(5)保存文件,在puTTY终端中输入vncserver,让VNC打开一个新的Display 

[test@xok.la ~]$ vncserver 

New 'xok.la.localdomain:1 (test)' desktop is xok.la.localdomain:2 

Starting applications specified in /root/.vnc/xstartup 
Log file is /root/.vnc/xok.la.localdomain:2.log 
(6)使用VNC Viewer重新登录 

win下VNC Viewer 下载(包括注册码在内):http://xok.la/file/2008/11/ha_vnc-e4_2_9-x86_win32.rar 

输入服务器地址:192.168.0.64:2 
然后提示输入密码,如123456 

服务器地址后面的Display No是根据第(5)步运行的vncserver命令的结果来的 
New ‘xok.la.localdomain:1 (test)’ desktop is xok.la.localdomain:2 
所以Display No就是2,别忘记加冒号哦. 

然后就看到你想要的界面了吧. 
以后如果服务器重新启动后,要重新输入vncserver后登录.如果服务器一直开机,就不用了. 

如果要杀掉vncserver 进程,可执行vncserver :1 kill ,1表示display的ID号

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics