在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. 响应者链-----iOS

    正文 以触摸事件为例,说一下响应者链 当发生触摸事件后,Runloop监听到事件,会将其事件打包成一个UIEvent事件,并放入当前活动UIApplication的事件队列中,再会传给UIWindow ...

  2. iphone在iframe页面的宽度不受父页面影响,避免撑开页面

    工作中有个需求,就是产品页面通过iframe引用显示产品协议页,要求不要横向滑动,只需要竖向滑动,但在iphone中引用的iframe会撑开父页的宽度,而在android端浏览器这不会. <di ...

  3. 二cha树

    void porder(BTree *b) { BTree *St[MaxSize],*p; ; if(b!=NULL) { top++; St[top]=b; ) { p=St[top]; top- ...

  4. TI(德州仪器) TMS320C674x逆向分析之一

    一.声明 作者并不懂嵌入式开发,整个逆向流程都是根据自身逆向经验,一步一步摸索出来,有什么错误请批评指正,或者有更好的方法请不吝赐教.个人写作水平有限,文中会尽量把过程写清楚,有问题或是写的不清楚的地 ...

  5. WIn7下Ubuntu 14.04 安装

    1. 在Windows下下载Ubuntu14.04的ISO镜像,解压 2. 打开wubi.exe,填写用户名,密码等相关信息,在这里需要注意的是,磁盘空间最好选到最大(30G),执行安装 3. 按照提 ...

  6. 【转】JDBC连接数据库

    创建一个以JDBC连接数据库的程序,包含7个步骤: 1.加载JDBC驱动程序: 在连接数据库之前,首先要加载想要连接的数据库的驱动到JVM(Java虚拟机), 这通过java.lang.Class类的 ...

  7. 关于RunLoop

    首先我们要先认识一下这个RunLoop; NSRunLoop是Cocoa框架中的类,与之的Core Fundation 中CFRunLoopRef类. 这两者的区别是,前者不是线程安全的,而后者是线程 ...

  8. angular drag and drop (ngDraggable) 笔记

    这是原文 https://github.com/fatlinesofcode/ngDraggable 这是另一个dnd,这比较灵活,可以监听事件.我只用简单的排序功能,其他没去了解太多.有机会遇到功能 ...

  9. H5缓存-Manifest

    在app中更新h5页面一直有缓存问题.默认什么都不做的情况下,app有一定的空间缓存页面.一开始更新之后会马上加载,等到app缓存空间上来之后更新就无法下载了.安卓能够清理缓存空间,ios就只能卸载重 ...

  10. node环境安装(mac版和windows版)

    WINDOWS版本安装 nvm 是 Mac 下的 node 管理工具,有点类似管理 Ruby 的 rvm,如果是需要管理 Windows 下的 node,官方推荐是使用 nvmw 或 nvm-wind ...