RHL配置VNC Server

RHL配置VNC Server

0. 启动vncserver服务
[root@localhost ~]# service vncserver status
Xvnc 已停
[root@localhost ~]# service vncserver start
启动 VNC 服务器:no displays configured [确定]
1. 开启vncserver服务端
[root@localhost ~]# 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 applications 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@localhost ~]# vi /root/.vnc/xstartup
[root@localhost ~]# cat /root/.vnc/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 &
gnome-session &
如果要立即生效连接桌面方式,需要重启服务:
[root@localhost ~]# vncserver -kill :1
Killing Xvnc process ID 8135
[root@localhost ~]# vncserver :1
查看下监听状态:
[root@localhost ~]# netstat -tulnp
3. 在客户端连接
192.168.2.203:5901 http://192.168.2.203:5801
4. 配置vncserver自启动
[root@localhost ~]# chkconfig --list vncserver
vncserver 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
[root@localhost ~]# chkconfig --level 2345 vncserver on
[root@localhost ~]# chkconfig --list vncserver
vncserver 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
修改开机启动服务进程
[root@localhost ~]# vi /etc/sysconfig/vncservers
[root@localhost ~]# 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 vncpasswd' 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 tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based 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-

你可能感兴趣的:(server)