万兆元紫砂壶价格:RHEL 6 下 VNC Server 的配置详解

来源:百度文库 编辑:偶看新闻 时间:2024/04/29 23:26:36
RHEL 6 下 VNC Server 的配置详解 2011-10-27 20:26:03标签:RHEL6 配置 vncLinux 可以通过使用 SSH 远程连接来进行控制,也可以在主机执行以下命令进行投射。
[root@localhost ~]# export DISPLAY=ipaddress:0[root@localhost ~]# xhost +
这个命令要求 ipaddress 的机器装有 X Server(比如 Xmanager),但有时需要将远程整个的 Linux 桌面投射到本地,这时仍可通过安装配置 Xmanager 来实现。本文主要介绍 VNC Server 的配置方法,需配置好 yum 源,文中的“主机”指安装 Linux 的机器。1. 首先验证主机上是否安装 VNC Server,使用
[root@localhost ~]# yum list | grep vnc
的命令。返回
tigervnc.x86_64                        1.0.90-0.10.20100115svn3945.el6    @localtigervnc-server.x86_64                 1.0.90-0.10.20100115svn3945.el6    @local
就代表已经存在,否则就通过
[root@localhost ~]# yum install "*vnc*"
的命令进行安装。2. 随后启动 VNC Server,这时会要求你输入两次进行连接的初始密码。
[root@localhost ~]# vncserverYou will require a password to access your desktops.Password: //输入密码Verify: //再次输入密码xauth: creating new authority file /root/.XauthorityNew ‘localhost.localdomain:1 (root)’ desktop is localhost.localdomain:1Creating default startup script /root/.vnc/xstartupStarting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost.localdomain:1.log
这里要注意:每个用户都可以启动多个 VNC Server 远程桌面,它们用 ip 加端口号:ip:1、ip:2、ip:3 来标识区分,使用同一端口会使另外登录的用户自动退出。另,VNC Server 的大部分配置文件及日志文件都在用户 home 目录的.vnc 目录下。用户可以自定义启动号码如:
[root@localhost ~]# vncserver :2        #注意:2前面一定要有空格。A VNC server is already running as :2
3. Red Hat Linux 支持两种图形模式:KDE 模式和 gnome 模式。你的 Redh Hat 使用的什么图形模式这个一般只有登录到图形界面查看一下才能知道,或者通过
[root@localhost ~]# ps -aux | grep gnome
这样的命令来判断。如果是 gnome 桌面,那么需要修改/root/.vnc/xstartup的配置文件。使用 vi 打开 xstartup 文件,如下:
[root@localhost /]# cd /root/.vnc[root@localhost .vnc]# vi xstartup
删除全部内容,然后添加如下内容:
unset SESSION_MANAGERexec /etc/X11/xinit/xinitrc
4. 重启动 VNC Server
[root@localhost ~]# vncserver -kill :1Killing Xvnc process ID 21198[root@localhost ~]# vncserverNew ‘localhost.localdomain:1 (root)’ desktop is localhost.localdomain:1Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost.localdomain:1.log
5. 在防火墙上打开 VNC Server 的监听端口VNC Server 用到了三个端口:5801、5901、6001。
[root@localhost /]# cd /etc/sysconfig[root@localhost sysconfig]# vi iptables
添加如下三行
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5801 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 6001 -j ACCEPT
注意,一定要在
-A INPUT -j REJECT --reject-with icmp-host-prohibited
的前面,否则不会生效。6. 重新启动 iptables。
[root@localhost sysconfig]# /etc/rc.d/init.d/iptables restartFlushing firewall rules: [  OK  ]Setting chains to policy ACCEPT: filter [  OK  ]Unloading iptables modules: [  OK  ]Applying iptables firewall rules: [  OK  ]Loading additional iptables modules: ip_conntrack_netbios_ns ip_conntrack_ftp [  OK  ]
7. 在 Windows 机器上使用 VNC Viewer 连接 VNC Server下载 VNC Viewer,运行然后输入IP:5901,输入刚才设定的密码,进入 RHEL 桌面。