2023拉

在RHEL6.0安装VNC服务器

上一篇 / 下一篇  2015-05-05 15:44:10 / 个人分类:网址收集

转载

ENV Centos VNC 远程桌面程序的安装使用 

本文以centos 6.5为例


安装GNOME桌面环境

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    yum groupinstall "X Window System" "Desktop"  



CentOS安装Xfce桌面环境,可选

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    yum groupinstall Xfce  



安装tigervnc 

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    yum install tigervnc-server tigervnc  




设置远程登陆到gnome桌面的配置,再最后面加入如下两行:

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    vim /etc/sysconfig/vncservers  


[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    VNCSERVERS="1:root"  

    VNCSERVERARGS[1]="-geometry 1024x768 -alwaysshared -depth 24"  





修改远程桌面显示配置文件:修改为以下内容并保存


[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    vim /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 &

*/


[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    #!/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 & #set starting GNOME desktop  

    #startkde & #kde desktop  

    #twm & #Text interface  

    #/usr/bin/startxfce4  

    #exec /usr/bin/fluxbox 


新建服务,执行多次则建多个服务,依次为 :1 :2 :3,每一次启动时会提示设置密码

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    vncserver  


关闭具体的vncserver命令

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    vncserver -kill :1   

    vncserver -kill :2  


开机启动

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    chkconfig vncserver on  

防火墙 设置

当你启动vnc服务后,你可以用netstat –tunlp命令来查看vnc服务所使用的端口,可以发现有5801,5901,6001等。使用下面命令开启这些端口:

重启防火墙:

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片


    # netstat –tunlp  

    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name     

    tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      2092/Xvnc             

    tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1459/rpcbind          

    tcp        0      0 0.0.0.0:6001                0.0.0.0:*                   LISTEN      2092/Xvnc             

    tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1711/sshd             

    tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1557/cupsd        

    # vim /etc/sysconfig/iptables  

    -A RH-Firewall-l-INPUT -p tcp -m tcp –dport 5801 -j ACCEPT  

    -A RH-Firewall-l-INPUT -p tcp -m tcp –dport 5901 -j ACCEPT  

    -A RH-Firewall-l-INPUT -p tcp -m tcp –dport 6001 -j ACCEPT  

    # /etc/init.d/iptables restart  


安装Windows 客户端

http://sourceforge.net/projects/tigervnc/files/latest/download

启动  TrigerVNC Viewer

输入服务器IP:01,例如:192.168.1.10:1 

连接后再输入每一次启动vncserver时设置的密码即可要连接到centos桌面了


TAG: 服务器

 

评分:0

我来说两句

Open Toolbar