linux下vncserver配置
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
linux下vncserver配置
(1)启动VNC 服务.通过puTTY以SSH方式登录服务器,假设用户名为yangj
telnet linux16
Trying 192.168.0.36...
Connected to linux16 (192.168.0.36).
Escape character is '^]'.
Red Hat Enterprise Linux AS release 3 (Taroon Update 8)
Kernel 2.4.21-47.ELsmp on an i686
login: yangj
Password:
Last login: Sun May 30 17:48:13 from linux16
[yangj@linux16 yangj]$ su
[yangj@linux16 .root]# service vncserver start
Starting VNC server: no displays configured [ OK ]
(2)运行vncserver命令,如果第一次配置VNC Server,会要求提供登录VNC使用的密码.以后也可以使用vncpasswd来修改密码.
[yangj@linux16 .vnc]$ vncserver
You will require a password to access your desktops.
Password:q1w2e3
Verify:q1w2e3
xauth: creating new authority file /root/.vnc/.Xauthority
New '.localdomain:1 (yangj)' desktop is .localdomain:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/.localdomain:1.log
(3)此时就可以在Windows使用VNC viewer登录了
输入服务器地址:192.168.0.36:1
然后提示输入密码,输入你刚才设定的密码就好了,如q1w2e3
注意:IP地址后面的:1的意思是linux上面VNC设定的Display No.每运行一个vncserver就会多创建一个Display,Display No也就会加一.
虽然此时可以登录,但是登录后看到的界面是X term的界面,还不是正常的X Window界面,我们要修改配置,使之使用X Window
(4)修改配置文件/root/.vnc/xstartup,将twm &改为:
gnome-session & #以GNOME作为VNC的窗口管理器
或
startkde & #kde desktop
注释掉
#twm & #注掉系统默认的窗口管理器
[yangj@linux16 .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" &
gnome-session &
(5)保存文件,在puTTY终端中输入vncserver,让VNC打开一个新的Display
[yangj@linux16 .vnc]$ vncserver
New '.localdomain:1 (yangj)' desktop is .localdomain:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/.localdomain:2.log
(6)使用VNC Viewer重新登录
输入服务器地址:192.168.0.64:2
然后提示输入密码,如123456
服务器地址后面的Display No是根据第(5)步运行的vncserver命令的结果来的
New ‘.localdomain:1 (test)’ desktop is .localdomain:2
所以Display No就是2,别忘记加冒号哦.
然后就看到你想要的界面了吧.
以后如果服务器重新启动后,要重新输入vncserver后登录.如果服务器一直开机,就不用了. 如果要杀掉vncserver 进程,可执行vncserver :1 kill ,1表示display的ID号
[yangj@linux16 .vnc]$ vncserver -kill :2
Killing Xvnc process ID 17769