设为首页 收藏本站
查看: 794|回复: 0

[经验分享] centos 6.8 VNC 搭建(详细)

[复制链接]

尚未签到

发表于 2019-2-15 16:25:33 | 显示全部楼层 |阅读模式
  centos 6.8 VNC 搭建(详细)
  背景:考虑有些情况下,需要用到图形化界面操作(如:配置KVM虚拟化),但是又不想去机房,针对这种情况,我们可以配置vnc服务,使得何时何处都可以轻松的办公(只要网络可达)
  首先检查是否安装相应的软件包
  redhat@opman ~]$ rpm -qa |grep tigervnc
  [redhat@opman ~]$
  [redhat@opman ~]$
  没有,则安装!
  yum -y install tigervnc
  已加载插件:fastestmirror, refresh-packagekit, security
  设置安装进程
  Loading mirror speeds from cached hostfile
  * base: mirrors.aliyun.com
  * epel: mirrors.aliyun.com
  * extras: mirrors.aliyun.com
  * updates: mirrors.aliyun.com
  再次检查是否安装上
  [root@opman ~]# rpm -qa |grep tigervnc
  tigervnc-1.1.0-24.el6.x86_64
  tigervnc-server-1.1.0-24.el6.x86_64
  启动vnc,首次会生成/root/.vnc/xstartup 文件,后面要配置相关参数
  [root@opman ~]# vncserver
  You will require a password to access your desktops.
  Password:
  Verify:
  Passwords don't match - try again
  Password:
  Verify:
  xauth:  file /root/.Xauthority does not exist
  New 'opman:1 (root)' desktop is opman:1
  Creating default startup script /root/.vnc/xstartup
  Starting applications specified in /root/.vnc/xstartup
  Log file is /root/.vnc/opman:1.log
  vim  /root/.vnc/xstartup
  #twm &  //注释该行
  gnome-session &  //添加该行 如果为KDE桌面,则修改为:startkde &
  启动服务,发现报错,需要修改配置文件
  [root@opman ~]# /etc/init.d/vncserver  start
  正在启动 VNC 服务器:no displays configured                [失败]
  vim   /etc/sysconfig/vncservers ;添加末尾3行;作用是设定vnc用户和对应界面的设置。我设置了两个用户分别是redhat 和root

最后启动vncserver 并设置为开机启动,执行以下
# service vncserver start
# chkconfig vncserver on
  检查vnc服务的端口
  [root@opman ~]# netstat -tunlp |grep vnc
  tcp        0      0 0.0.0.0:5801                0.0.0.0:*                   LISTEN      3744/Xvnc
  tcp        0      0 0.0.0.0:5802                0.0.0.0:*                   LISTEN      4481/Xvnc
  tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      3744/Xvnc
  tcp        0      0 0.0.0.0:5902                0.0.0.0:*                   LISTEN      4481/Xvnc
  tcp        0      0 0.0.0.0:6001                0.0.0.0:*                   LISTEN      3744/Xvnc
  tcp        0      0 :::6001                     :::*                        LISTEN      3744/Xvnc
  查看vnc 进程
  [root@opman ~]#  ps -ef |grep vnc
  root       3744      1  0 16:56 pts/0    00:00:00 /usr/bin/Xvnc :1 -desktop opman:1 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn
  root       3754   3753  0 16:56 pts/0    00:00:00 vncconfig -iconic
  root       4481      1  0 17:09 pts/0    00:00:00 /usr/bin/Xvnc :2 -desktop opman:2 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 800x600 -depth 32 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn -nolisten tcp
  root       4492   4490  0 17:09 pts/0    00:00:00 vncconfig -iconic
  root       5090   4787  0 17:25 pts/0    00:00:00 grep vnc
  用vncview 连接测试效果:
  发现连接超时,在一切都正常的情况下,关闭防火墙。
  
  service iptables stop
  [root@opman .vnc]# service iptables stop
  iptables:将链设置为政策 ACCEPTnat mangle filter         [确定]
  iptables:清除防火墙规则:                                 [确定]
  iptables:正在卸载模块:                                   [确定]
  [root@opman .vnc]#
  再次连接,ip+:2(ip + 端口)








运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-672660-1-1.html 上篇帖子: CentOS 7 安装ovirt 下篇帖子: centos ping添加丢包记录
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表