1.  检查是否有安装 VNC rpm

     [root@erp-dev /]# rpm -qa | grep vnc

    若未安装,则安装之

   [root@erp-dev tmp]# rpm -ivh vnc-server-4.1.2-14.el5.x86_64.rpm

2.  启动服务并指定端口号

      [root@erp-dev /]# vncserver :1        ### 指定VNC连接端口号为1, 此端口可自行定义,但不能与其他冲突

        You will require a password to access your desktops.     

        Password:                                                                    ###第一次启动此服务时,会要求输入VNC连接密码
        Verify:
        xauth:  creating new authority file /root/.Xauthority

 New 'erp-dev:1 (root)' desktop is erp-dev.gtbf-ltd.com:1

 Creating default startup script /root/.vnc/xstartup             ### 创建 .vnc 目录及xstartup 文件
        Starting applications specified in /root/.vnc/xstartup
        Log file is /root/.vnc/erp-dev.gtbf-ltd.com:1.log

[root@erp-dev ~]#

3.  修改登陆桌面配置

[root@erp-dev /]# cd /root/.vnc       ### 此目录只有在启动过一次vnc服务后才会被自动创建
[root@erp-dev .vnc]# ls
erp-dev.gtbf-ltd.com:1.log  erp-dev.gtbf-ltd.com:1.pid  erp-dev.gtbf-ltd.com:2.log  passwd  xstartup
[root@erp-dev .vnc]# vi 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 &             ### 添加此行记录
~

wq!    保存退出

 

 

5.   其他

      停止此端口之服务的方法:   

       [root@erp-dev /]# vncserver -kill :1

       修改vnc密码之方法:

      [root@erp-dev /]# vncpasswd
   
   Password:
      Verify: