Chinaunix

标题: linux下vncserver配置 [打印本页]

作者: so_brave    时间: 2011-12-11 20:51
标题: linux下vncserver配置
linux下vncserver配置













一.
运行vncserver命令,如果第一次配置VNC Server,会要求提供登录VNC使用的密码.以后也可以使用vncpasswd来修改密码.

  1. [test@xok.la ~]$ vncserver




  2. You will require a password to access your desktops.




  3. Password:123456


  4. Verify:123456


  5. xauth:
  6. creating new authority file /root/.vnc/.Xauthority




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




  8. Creating default startup script /root/.vnc/xstartup


  9. Starting applications specified in /root/.vnc/xstartup


  10. Log file is /root/.vnc/xok.la.localdomain:1.log
复制代码
此时就可以在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



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

  1. [test@xok.la .vnc]$ cat xstartup

  2. #!/bin/sh



  3. # Uncomment the following two lines for normal desktop:


  4. unset SESSION_MANAGER


  5. exec /etc/X11/xinit/xinitrc



  6. [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

  7. [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

  8. xsetroot -solid grey

  9. vncconfig -iconic &

  10. xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

  11. twm &
复制代码
三.保存文件,在终端中输入vncserver,让VNC打开一个新的Display


然后就看到你想要的界面了吧.

以后如果服务器重新启动后,要重新输入vncserver后登录.如果服务器一直开机,就不用了(但密码不会变。).



如果要杀掉vncserver 进程,可执行vncserver -kill :1表示display的ID号
作者: 蓝猫淘气啦啦    时间: 2011-12-21 22:54
谢谢分享  希望于楼主多多交流




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2