VNC是一个的"远程桌面"工具。,通常用于“图形界面”的方式登录服务器,可视化操作。废话不多说了,操作记录如下:

  1. 1)安装桌面环境
  2. [root@vm01 ~]# yum -y groupinstall "X Window System"
  3. [root@vm01 ~]# yum -y groupinstall "Desktop"
  4. [root@vm01 ~]# yum -y groupinstall "General Purpose Desktop"
  5. [root@vm01 ~]# yum groupinstall "Chinese Support"
  6. [root@vm01 ~]# startx //或者使用"init 5"命令来启动图形界面;关闭图形界面则需要执行"init 3"命令
  7.  
  8. 执行上面startx命令后(可以放在后台执行,或者ctrl+zbg 1disown -a),就是把服务器的桌面模式启动了。使用VNC连接后,就会发现已经是桌面模式了。
  9.  
  10. 2)以桌面模式启动系统
  11. [root@vm01 ~]# cat /etc/inittab
  12. ......
  13. #id:3:initdefault: //以文本模式启动系统
  14. id:5:initdefault: //以桌面模式启动系统
  15.  
  16. 3VNC远程桌面连接环境安装
  17. [root@vm01 ~]# ps -eaf|grep vnc
  18. [root@vm01 ~]# rpm -qa | grep vnc
  19.  
  20. 安装VNC软件
  21. [root@vm01 ~]# yum install -y tigervnc tigervnc-server
  22. [root@vm01 ~]# yum install -y libvncserver*
  23. [root@vm01 ~]# rpm -qa | grep vnc
  24. libvncserver-0.9.7-7.el6_6.1.x86_64
  25. tigervnc-server-1.1.0-24.el6.x86_64
  26. libvncserver-devel-0.9.7-7.el6_6.1.x86_64
  27. tigervnc-1.1.0-24.el6.x86_64
  28. ------------------------------------------------------------------------------------
  29. 注意:
  30. 如果上面yum安装不行,可以直接下载rpm包进行安装:vnc-server-4.1.2-14.el5_6.6.x86_64.rpm
  31. 下载地址:https://pan.baidu.com/s/1nv1esBn
  32. 提取密码:syba
  33.  
  34. [root@vm01 ~]# rpm -ivh vnc-server-4.1.2-14.el5_6.6.x86_64.rpm
  35. ------------------------------------------------------------------------------------
  36.  
  37. 配置vncservers
  38. 配置vncservers,这里显示vnc远程连接到服务器的桌面窗口初始化大小,默认是800x600你也可以设置成你习惯的模式比如1280x960
  39. [root@vm01 ~]# vim /etc/sysconfig/vncservers
  40. ......
  41. VNCSERVERS="1:root"
  42. VNCSERVERARGS[1]="-geometry 800x600"
  43.  
  44. 设置vncserver密码
  45. 启动vnc之前必须设置密码:
  46. [root@vm01 ~]# vncpasswd
  47. Password:
  48. Verify:
  49.  
  50. 启动停止vncserver
  51. [root@vm01 ~]# service vncserver start/stop/restart
  52.  
  53. 默认监听端口是:5901
  54. [root@vm01 ~]# ps -ef|grep vnc
  55. root 3950 1 0 01:15 pts/0 00:00:00 /usr/bin/Xvnc :1 -desktop vm01:1 (root) -auth /root/.Xauthority -geometry 800x600 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn
  56. root 3958 3957 0 01:15 pts/0 00:00:00 vncconfig -iconic
  57. root 4145 3323 0 01:30 pts/0 00:00:00 grep vnc
  58. [root@vm01 ~]# lsof -i:5901
  59. COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
  60. Xvnc 3950 root 5u IPv4 55672 0t0 TCP *:5901 (LISTEN)
  61. [root@vm01 ~]#
  62.  
  63. 配置xstartup启动命令
  64. 将/root/.vnc/xstartup文件内容复制成下面的内容
  65. [root@vm01 ~]# cp /root/.vnc/xstartup /root/.vnc/xstartup.bak
  66. [root@vm01 ~]# vim /root/.vnc/xstartup //该配置文件要在vncserver服务启动后才能产生
  67. #!/bin/sh
  68. # Uncomment the following two lines for normal desktop:
  69. unset SESSION_MANAGER
  70. exec /etc/X11/xinit/xinitrc
  71. [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
  72. [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
  73. xsetroot -solid grey
  74. vncconfig -iconic &
  75. #xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
  76. #twm &
  77. gnome-session &
  78.  
  79. 然后重启vnc服务
  80. [root@vm01 ~]# service vncserver restart
  81.  
  82. --------------------------------------------------------------------
  83. 温馨提示:
  84.  
  85. 针对上面启动文件内容:
  86. 1)如果使用的是gnome图像界面,则需要注释掉以下两行,
  87. xterm -geometry80x24+10+10 -ls -title $VNCDESKTOP Desktop &
  88. twm &
  89. 并添加以下这行:
  90. gnome-session &
  91.  
  92. ====================================================================
  93. 安装gnome软件,即安装生成图形界面锁需要的组件:
  94. [root@vm01 ~]# yum install -y gnome*
  95. [root@vm01 ~]# yum install libXfont -y
  96. [root@vm01 ~]# yum install xorg-x11-xfs
  97. [root@vm01 ~]# yum install xorg-x11-xfs-utils
  98. [root@vm01 ~]# yum install xorg-x11-xinit
  99. [root@vm01 ~]# yum install xorg-x11-xdm
  100. [root@vm01 ~]# yum install xorg-x11-fonts*
  101. ====================================================================
  102. 2)如果黑屏了,后台日志报如下错误:
  103. Sat May 7 15:05:35 2016
  104. vncext: VNC extension running!
  105. vncext: Listening for VNC connections on all interface(s), port 5901
  106. vncext: created VNC server for screen 0
  107. /root/.vnc/xstartup: line 4: /etc/X11/xinit/xinitrc: No such file or directory
  108. /root/.vnc/xstartup: line 4: exec: /etc/X11/xinit/xinitrc: cannot execute: No such file or directory
  109. 然后去服务器检索 xinitrc检索不到的话,如下所示:
  110. [root@vm01 ~]# ll /etc/X11/xinit/xinitrc
  111. ls: cannot access /etc/X11/xinit/xinitrc: No such file or directory
  112. [root@vm01 ~]# find / -name xinitrc
  113. [root@vm01 ~]#
  114.  
  115. 采用的方案就是,注释掉 /root/.vnc/xstartup 里面的exec /etc/X11/xinit/xinitrc,让vncserver去选择默认的,让vnc加载默认图形界面程序 ok
  116. --------------------------------------------------------------------
  117.  
  118. 改变xstartup的权限
  119. 这是很多人容易忽视的问题,也是造成连接成功后黑屏的原因之一。
  120. CentOS中,xstartup的文件路径为:/root/.vnc/ (可以通过locatexstartup来查看xstartup的文件路径)
  121. 所以需要执行:chmod 777/root/.vnc/xstartup来赋予权限。之后再重启下vncserver
  122.  
  123. 最后在本地windows安装vnc viewer,远程访问
  124. windows下安装vnc客户端,
  125. 下载地址:https://pan.baidu.com/s/1hrSIr4K
  126. 提取密码:dqdt
  127.  
  128. VNC远程连接信息(下面ipVNC服务端的地址):
  129. VNC Server 172.16.220.139:5901
  130. EncrytionLet VNC Server choose
  131.  
  132. 然后输入vncpasswd的密码即可完成VNC远程连接!

Centos6.9下安装并使用VNC的操作记录的更多相关文章

  1. Centos下安装破解confluence6.3的操作记录

    confluence是一个专业的企业知识管理与协同软件,可以用于构建企业wiki.通过它可以实现团队成员之间的协作和知识共享.现在大多数公司都会部署一套confluence,用作内部wiki.现在co ...

  2. centos6.7下安装配置vnc

    vnc是一款使用广泛的服务器管理软件,可以实现图形化管理,下面简单介绍一下如何在centos6.7下安装vnc. 1.安装vncserver yum install tigervnc tigervnc ...

  3. 【转载】CentOS6.5_X64下安装配置MongoDB数据库

    [转载]CentOS6.5_X64下安装配置MongoDB数据库 2014-05-16 10:07:09|  分类: 默认分类|举报|字号 订阅      下载LOFTER客户端 本文转载自zhm&l ...

  4. CentOS6.5下安装apache2.2和PHP 5.5.28

    CentOS6.5下安装apache2.2 1. 准备程序 :httpd-2.2.27.tar.gz 下载地址:http://httpd.apache.org/download.cgi#apache2 ...

  5. CentOS6.5下安装配置MySQL

    CentOS6.5下安装配置MySQL,配置方法如下: 安装mysql数据库:# yum install -y mysql-server mysql mysql-deve 查看mysql-server ...

  6. CentOS6.5下安装Apache2.4+PHP7

    CentOS6.5下安装Apache2.4+PHP7 http://blog.csdn.net/along602/article/details/42695779 http://www.th7.cn/ ...

  7. 在CentOS6.8下安装Docker

    在CentOS6.8下安装Docker 一.查看系统版本 [root@localhost opt]# uname -a Linux localhost.localdomain -.el6.x86_64 ...

  8. coreseek/sphinx CentOS6.4下安装

    一.在CentOS6.4下安装coreseek之前需要预先安装以下软件 1.打开终端 输入 su 获取管理员权限 2.输入命令 yum install make gcc g++ gcc-c++ lib ...

  9. 建站笔记1:centos6.5下安装mysql

    近期买了个域名,想要玩玩自己建站点:接下来遇到的问题都会一次记录下来.以备自己以后复习查看: 首先建站方案选择: wordPress +centos6.5 +mysql; server买的:搬瓦工最低 ...

随机推荐

  1. Ubuntu下matplotlib的中文显示

    真真地被matplotlib的中文显示折磨的不行了.简要记下解决方案,防止以后重新配又是蛋疼菊紧. 我的环境:系统是Ubuntu 13.04,Python是系统自带的,matplotlib是apt安装 ...

  2. 查看tomcat项目中,具体占用cpu高的线程。

    1.查看主进程占用cpu高: 此处主进程:27823 ~]# top top - :0: up days, :, 3 users, load average: 13.12, 13.31, 13.23 ...

  3. win10 文件扩展名的更改

    win10 文件扩展名的改 随便打开一个文件夹,最好是"此电脑",  第二行是 "     文件  -   计算机  -  查看   " 在查看里面就可以更改了 ...

  4. 【项目 · WonderLand】 系 统 设 计

    团 队 作 业 ---- 系 统 设 计 Part 0 · 简 要 目 录 Part 1 · 完 善 需 求 规 格 说 明 书 Part 2 · 团 队 编 码 规 范 Part 3 · 数 据 库 ...

  5. 阿里八八β阶段Scrum(3/5)

    今日进度 叶文滔: 添加了侧边栏调用数据库用户名的功能,因为对Navigation View的不熟悉,走了很多弯路,尝试了三种方法才成功调用. 俞鋆: 研究了几个图像识别的api,最终决定使用ocr. ...

  6. 使用CefSharp的一些需要注意的点

    程序关闭的时候一定要加上: CefSharp.Cef.Shutdown(); 因为关闭的时候,不将浏览器关闭的话,会阻塞主线程导致报错. 修复CefSharp浏览器组件中文输入的bug // brow ...

  7. PyQt5--QSplitter

    # -*- coding:utf-8 -*- ''' Created on Sep 20, 2018 @author: SaShuangYiBing Comment: ''' import sys f ...

  8. JS获取本周、本季度、本月、上月的开始日期、结束日期

    /** * 获取本周.本季度.本月.上月的开始日期.结束日期 */ var now = new Date();                    //当前日期 var nowDayOfWeek = ...

  9. 深入分析escape()、encodeURI()、encodeURIComponent()的区别及示例

    JavaScript中有三个可以对字符串编码的函数,分别是: escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decod ...

  10. redis php扩展及基本命令

    linux 安装php mysql redis memchache 等工具 用 OneinStack 安装步骤 注意 如果有单独数据盘,建议您先挂载数据盘,建议将网站内容.数据库放在数据盘中.如何挂载 ...