RHL配置VNC Server
0. 启动v
ncserver服务
[root@linuxso.com ~]# service vncserver
status
Xvnc 已停
[root@linuxso.com ~]# service vncserver start
启动 VNC 服务器:no displays configur
ed [确定]
1. 开启vncserver服务端
[root@linuxso.com ~]# vncserver :1
You will require a password to access your desktops.
Password:
Verify:
New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1
Creating default startup script /root/.vnc/xstartup
Starting appli
cations specified in /root/.vnc/xstartup
Log
file is /root/.vnc/localhost.localdomain:1.log
2. 修改vnc显示方式
默认情况下是shell,下面设置使用xwindows方式登录到远程linux,将默认的twm &注释掉,增加一行gnome-session &,使用的是GNOME桌面,还有KED方式:startkde&。
[root@linuxso.com ~]# vi /root/.vnc/xstartup
[root@linuxso.com ~]# cat /root/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for no
rmal desktop:
#
set.html' target='_blank'>
unset SESSION_MANAGER
#
exec /etc/X11/xinit/xini
trc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -sol
id grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -
ls -title "$VNCDESKTOP Desktop" &
# twm &
gnome-session &
如果要立即生效连接桌面方式,需要重启服务:
[root@linuxso.com ~]# vncserver -
kill :1
Killing Xvnc process ID 8135
[root@linuxso.com ~]# vncserver :1
查看下监听状态:
[root@linuxso.com ~]#
netstat -tu
lnp
3. 在客户端连接
192.168.2.203:5901 http://192.168.2.203:5801
4. 配置vncserver自启动
[root@linuxso.com ~]#
chkconfig --list vncserver
vncserver 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
[root@linuxso.com ~]# chkconfig --level 2345 vncserver on
[root@linuxso.com ~]# chkconfig --list vncserver
vncserver 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
修改开机启动服务进程
[root@linuxso.com ~]# vi /etc/sysconfig/vncservers
[root@linuxso.com ~]# cat /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vnc
passwd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.
# Use "-nolisten t
cp" to prevent X connections to your VNC server via TCP.
# Use "-no
httpd" to prevent web-ba
sed VNC clients connecting.
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768"
-The End-