Centos6.X 下安装并使用VNC的操作记录

编程入门 行业动态 更新时间:2024-10-07 21:39:37

Centos6.X 下安装并使用VNC的<a href=https://www.elefans.com/category/jswz/34/1770947.html style=操作记录"/>

Centos6.X 下安装并使用VNC的操作记录

Centos6.X 下安装并使用VNC的操作记录

 

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

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

更多推荐

Centos6.X 下安装并使用VNC的操作记录

本文发布于:2024-02-06 05:24:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1746477.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:操作   VNC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!