在Linux下用VNC远程桌面是个很不错的玩意。但在CentOS中默认没有安装VNC的。可以用下面语句查询,如果出现下面情况说明没有安装vnc

#rpm -q tigervnc tigervnc-server

package tigervnc is not installed

package tigervnc-server is not installed

1、安装VNC服务

yum install tigervnc tigervnc-server

然后就等待安装完成。

2、为vncserver设置周密码

[root@www.linuxidc.com ~]# vncserver
You will require a password to access your desktops.
Password:<输入vnc登录密码>
Verify:<再次输入vnc登录密码>

3、 配置VNC
为了防黑屏,需要修改一下/root/.vnc/xstartup。
注释下面两行
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
然后再添加下面一行
gnome-session &

[root@GUOKE ~]# vi /root/.vnc/xstartup
#!/bin/sh

[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
export LANG
export SYSFONT
vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
if [ $OS = 'Linux' ]; then
case "$WINDOWMANAGER" in
*gnome*)
if [ -e /etc/SuSE-release ]; then
PATH=$PATH:/opt/gnome/bin
export PATH
fi
;;
esac
fi
if [ -x /etc/X11/xinit/xinitrc ]; then
exec /etc/X11/xinit/xinitrc
fi
if [ -f /etc/X11/xinit/xinitrc ]; then
exec sh /etc/X11/xinit/xinitrc
fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session &

修改用户配置文件:/etc/sysconfig/vncservers

去掉下面这两行前的“#”,也就是说把这两行的注释给去掉。

VNCSERVERS="2:root"
VNCSERVERARGS[1]="-geometry 1024x768 -depth 32"

改完后的配置文件如下

[root@GUOKE ~]# 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 this URL:
# http://kbase.redhat.com/faq/docs/DOC-7028

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# 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="2:root"
VNCSERVERARGS[2]="-geometry 1024x768 -depth 32"

4、改变xstartup的权限

chmod 777 /root/.vnc/xstartup

5、防火墙开端口,netstat -antpl查看可以发现有三个端口在监听。

5901 5801 6001
这三个端口:
默认的, vnc 服务监听3个TCP端口
RFB(Remote FrameBuffer)协议 默认端口 : 5900 显示器号
HTTP协议默认端口 : 5800 显示器号
X协议 默认端口 : 6000 显示器号
vncserver使用的显示器编号默认从1开始, 依次使用, 也可以参数指定端口号
我们只需要RFB协议就好了,所以,我们在防火墙中加5900到5903这几个,这样就可以开3个了。

vi /etc/sysconfig/iptables 找到下面的语句:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

在这之后填加:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5903 -j ACCEPT

重起防火墙

service iptables restart

6、起动vnc服务器

/etc/init.d/vncserver start

然后在windows中用vnc客户端登录

 
原文链接:http://zengwu3915.blog.163.com/blog/static/27834897201451591359528/

(转)centos6.5安装VNC的更多相关文章

  1. CentOS6.4安装VNC

    http://jingyan.baidu.com/article/ca2d939dd1dabbeb6c31ce24.html 一.安装 VNC 默认情况下,CentOS 6.4 是没有安装的. 检查是 ...

  2. Centos6.x 安装vnc

    一.安装gnome桌面环境 如果系统已经安装了gnome桌面环境,此步省略. # 安装fontforge,避免字体出现方框乱码 yum install fontforge -y # 安装gnome桌面 ...

  3. centos6.5安装VNC、远程及启动关闭

    标签: centos vnc 远程桌面 安装 详解 0.说明 安装服务的过程当中,最好是在联网环境下操作.由于涉及到远程连接的问题,系统的防火墙需要关闭,或者是做好相应的过滤策略.参考了网上很多大牛的 ...

  4. Centos6 安装vnc

    Centos6 安装vnc 1. 安装 使用yum方式安装 yum install tigervnc-server tigervnc #启动 vncserver #重启动 /etc/init.d/vn ...

  5. rhel7配置tiger vnc详解 centos6配置安装vnc-server

    参考网站:http://blog.51cto.com/xjsunjie/1963463     结合  https://blog.csdn.net/wamath/article/details/760 ...

  6. centos6和7安装vnc

    centos6安装vnc yum安装 yum groupinstall -y "Desktop" yum install -y tigervnc-server tigervnc-s ...

  7. Centos6.8安装并配置VNC

    一般服务器都会在IDC或云端,为了可以看到服务器的图形化界面,需要安装配置VNC,本例为Centos6.8上安装配置VNC. [root@hostname ~]#yum install -y tige ...

  8. CentOS-6.5x64:VNC安装配置

    1.安装软件前首先检查下系统是否已经安装了这个软件: rpm -qa tigervnc-server 2.根据前面命令的查询,显示系统还是没有安装VNC服务器端软件,那么我们就使用命令进行安装一下: ...

  9. centos6.5 安装、启动vnc

    一.安装vnc 1.确保当前账号是root2.查看本机是否已经安装vncserver rpm -qa|grep tigervnc 3.安装vncserver yum -y install tigerv ...

随机推荐

  1. 体验 WebFont,网页上的艺术字

    在最新项目中,由于要频繁使用艺术字, 而用户设备没有此字体,因此以往的经验都是使用图片... 所以在同事的瞩目期许之下,我开始实验研究这个问题的解决方案1. 直接使用字体文件 @font-face { ...

  2. 解决 Eclipse build workspace validation javascript 慢的问题

    参考: http://blog.csdn.net/zhangzikui/article/details/24805935 http://www.cnblogs.com/wql025/p/4978351 ...

  3. Robot Framework的安装

    一.安装环境:Windows 64位操作系统64位2.7版本Python 二.简要步骤:1. 安装Python(RF是基于python 的,所以需要有python环境):2. 安装wxPython ( ...

  4. .NET Core在WindowsServer服务器部署及发布

    VS使用WEB DEPLOY发布.NET Core程序   背景是这样的,公司有两台服务器,平时一台备用,另一台做为主生产机器.当有大量补丁或者安装什么东西需要重启的时候,交其中一台直接关掉IIS,然 ...

  5. C++ 头文件系列(streambuf)

    1. 简介 该头文件定义了basic_streambuf模版,从字面上看是作为流缓冲区之用. 2. basic_streambuf模版 The class template basic_stream& ...

  6. cli/php.ini和fpm/php.ini的区别

    1. 当从命令行执行PHP binary时,cli/php.ini会被使用,你可以通过在命令行运行php --ini来查看. 2. 当PHP运行做为FPM时,会使用fpm/phh.ini,其中一种情况 ...

  7. 8086cpu

    1.  8086CPU和8088CPU内部结构基本相同,不同之处在于8088有8条外部数据总线,因此为准16位.8086有16条外部数据总线.两个CPU的软件完全兼容,程序的编制也完全相同. 2.   ...

  8. 第三章:初识Jquery

    一.Jquery的优势 体积小,压缩后只有100KB左右 强大的选择器 出色的DOM封装 可靠的事件处理机制 出色的浏览器兼容性 使用隐式迭代简化编程 丰富的插件支持 二.Jquery语法 三.DOM ...

  9. python2.7读汉字的时候出现乱码,如何解决

    我使用的是window系统,安装Anaconda,所以用的是. 1.数据形式 2.读进来乱码 3.解决办法 3.1方法1 import pandas as pd #pd.read_csv('c:/us ...

  10. Keepalived安装与配置

      下载并解压Keepalived安装包到两台nginx所在的服务器   192.168.200.1   192.168.200.2     执行编译安装(安装目录设置为 /usr/local/kee ...