找回密码
 开放注册

QQ登录

只需一步,快速开始

微信登录

微信扫码,快速开始

搜索
查看: 724|回复: 0

linux下vncserver 安装配置

[复制链接]

155

主题

15

回帖

360

牛毛

一级牛人

积分
360
发表于 2011-9-28 13:28:27 | 显示全部楼层 |阅读模式 来自 河北省石家庄市
  说明:在linux系统下安装VNC Server,大多数linux发行版都带了VNC Server的发行包。只要选择安装就可以了。在Windows下安装VNC 客户端,VNC客户端叫做VNC Viewer.VNC。
  .配置linux VNC Server.
  (1)启动VNC 服务。通过puTTY以SSH方式登录服务器,
  [test@redhat~]$ /etc/init.d/vncserver start
  Starting VNC server: no displays configured                [  OK  ]
  (2)运行vncserver命令,如果第一次配置VNC Server,会要求提供登录VNC使用的密码。以后也可以使用vncpasswd来修改密码。
  [test@redhat ~]$ vncserver
  You will require a password to access your desktops.
  Password:redhat
  Verify:redhat
  xauth:  creating new authority file /root/.vnc/.Xauthority
  New 'xok.la.localdomain:1 (redhat)' 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.1.211:1
  然后提示输入密码,输入你刚才设定的密码就好了。
  注意:IP地址后面的:1的意思是linux上面VNC设定的Display No.每运行一个vncserver就会多创建一个Display,Display No也就会加一。
  虽然此时可以登录,但是登录后看到的界面是X term的界面,还不是正常的X Window界面,我们要修改配置,使之使用X Window
  (4)修改配置文件/root/.vnc/xstartup,使之与下面内容相同
  [test@redhat]$ 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@redhat ~]$ vncserver
  New 'xok.la.localdomain:1 (redhat)' 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重新登录
  输入服务器地址:192.168.1.211:2
  然后提示输入密码。输入刚才设置的密码。
  服务器地址后面的Display No是根据第(5)步运行的vncserver命令的结果来的
  New ‘xok.la.localdomain:1 (redhat)’ desktop is xok.la.localdomain:2
  所以Display No就是2,不要忘记加冒号。
  然后就看到你想要的界面了吧。
  以后如果服务器重新启动后,要重新输入vncserver后登录。如果服务器一直开机,就不用了。
  如果要杀掉vncserver 进程,可执行vncserver :2 kill ,2表示display的ID号
     本文由:SKF轴承 http://wwww.9-zc.com 整理发布
您需要登录后才可以回帖 登录 | 开放注册

本版积分规则

帮助|Archiver|小黑屋|通信管理局专项备案号:[2008]238号|NB5社区 ( 皖ICP备08004151号;皖公网安备34010402700514号 )

GMT+8, 2025-4-25 05:30 , Processed in 0.158811 second(s), 33 queries .

Powered by Discuz! X3.5

快速回复 返回顶部 返回列表