RHEL 6 下VNC Server 的安装配置

发下牢骚:

在安装rhel 6 64Bit的系统时我有安装远程桌面,本远程桌面为系统自带的,可以通过VNC的客户端访问,只不过和VNCServer的访问方式有点不一样,rhel6自带的远程桌面访问方式是:在vnc-client中输入目标主机地址。如:192.168.1.20 。但是这种方式有一个非常致使的问题就是要使用rhel6自带的远程桌面,用户必须先行登录一次系统的桌面以后才能通过vnc-client访问。因为这样所以有了下面的配置方式。悲剧啊,人都要疯

首先:安装依赖包

系统里面有些rpm包没有安装,以下为我的rpm包信息

其中的xorg-x11-fonts-base这个包可以不安装

安装好了以后,其它的配置就和在rhle5中的配置没有区别了

首先:

[root@rhle ~]#vncserver   //输入此命令设置vncserver 密码

[root@rhle ~]#vi .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 &

取消红色字符串的注释,然后保存退出

[root@rhle ~]#vi /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 1280x800"

取消红色字符串的注释,里面的内容怎么修改网上的信息很多,这儿就不说了

[root@rhle ~]#chkconfig vncserver on         //设置vncserver 开机自启动

[root@rhle ~]#service vncserver restart      //重启vncserver

最后通过vnc-client访问

输入访问地址:192.168.1.20:1

搞定

原文地址:https://www.cnblogs.com/fengqingtao/p/3014786.html