{"id":253,"date":"2012-07-24T23:22:43","date_gmt":"2012-07-24T23:22:43","guid":{"rendered":"c24cd76e1ce41366a4bbe8a49b02a028"},"modified":"2012-07-24T23:22:43","modified_gmt":"2012-07-24T23:22:43","slug":"","status":"publish","type":"post","link":"https:\/\/www.xiaobo.li\/notes\/archives\/253","title":{"rendered":"VNC \u5b89\u88c5"},"content":{"rendered":"<div>1\u3001\u5b89\u88c5<\/div>\n<div>yum install vnc*<\/div>\n<div>2\u3001\u542f\u52a8<\/div>\n<div>\/etc\/init.d\/vncserver start<\/div>\n<div>Starting VNC server: no displays configured [ OK ]<\/div>\n<div>3\u3001\u914d\u7f6e\u7528\u6237\u540d<br \/>\nCODE:[root@localhost ~]# vi \/etc\/sysconfig\/vncservers<br \/>\n# The VNCSERVERS variable is a list of display:user pairs.<br \/>\n#<br \/>\n# Uncomment the line below to start a VNC server on display :1<br \/>\n# as my 'myusername' (adjust this to your own). You will also<br \/>\n# need to set a VNC password; run 'man vncpasswd' to see how<br \/>\n# to do that.<br \/>\n#<br \/>\n# DO NOT RUN THIS SERVICE if your local area network is<br \/>\n# untrusted! For a secure way of using VNC, see<br \/>\n# URL:<a href=\"http:\/\/www.uk.research.att.com\/vnc\/sshvnc.html\" rel=\"nofollow\" target=\"_blank\">http:\/\/www.uk.research.att.com\/vnc\/sshvnc.html<\/a><\/p>\n<p># VNCSERVERS=\"1:myusername\"<br \/>\nVNCSERVERS=\"1:root\" \uff08\u6ce8\u610f\uff1aroot\u662fCentOS\u7528\u6237\u540d\uff09<br \/>\n\u5982\u679c\u5efa2\u4e2a\uff0c\u53ef\u4ee5\u7528VNCSERVERS=\"1:root 2:linglong\"\u6765\u914d\u7f6e<br \/>\n3.\u7528vncpasswd\u521b\u5efa\u4e00\u4e2avnc\u7684\u53e3\u4ee4<\/p>\n<p>\u6ce8\u610f\u8fd9\u5c06\u540c\u65f6\u5728\u4f60\u7684home\u76ee\u5f55\u4e0b\uff0c\u521b\u5efa\u4e00\u4e2a\u9690\u85cf\u7684\u76ee\u5f55.vnc\uff0c\u5176\u4e2d\u6709\u4e00\u4e2a\u6587\u4ef6passwd\u4fdd\u5b58\u7740\u4f60\u7684vnc\u53e3\u4ee4.<br \/>\nCODE:<br \/>\n[root@localhost ~]# vncpasswd<br \/>\nPassword:<br \/>\nVerify:<br \/>\n[root@localhost ~]# ls -d .vnc<br \/>\n.vnc<br \/>\n[root@localhost ~]# ls .vnc<br \/>\npasswd<\/div>\n<div>&nbsp;<\/div>\n<div>----------------------------------------------------------------------<\/div>\n<div>\n<div class=\"cnt\">\n<p><span><span style=\"color:#a52a2a;\">VNCServer\u914d\u7f6e<\/span><br \/>\nredhat \u4e00\u822c\u90fd\u81ea\u52a8\u5b89\u88c5\u4e86vncserver\u4e86 \u53ea\u8981\u5728<span style=\"color:#0000ff;\">\u670d\u52a1<\/span>\u5217\u8868\u4e2d\u9009\u4e2d\u542f\u52a8\u4e00\u4e0b\u5c31\u53ef\u4ee5.<br \/>\n<\/span><span>\u901a\u8fc7\u7f16\u8f91\u6587\u4ef6<span style=\"color:#0000ff;\">$HOME\/.vnc\/xstartup<\/span>\u6765\u542f\u52a8\u4f60\u559c\u6b22\u7684\u7a97\u53e3\u7ba1\u7406\u5668\u3002\u4f7f\u7528<br \/>\n<span style=\"color:#0000ff;\">startkde &amp;<\/span> \u6765\u542f\u52a8KDE\uff0c\u4f7f\u7528<span style=\"color:#ff0000;\"> gnome-session &amp;<\/span> \u6765\u542f\u52a8GNOME.<\/p>\n<p>\u9996\u6b21\u521b\u5efa ~\/.vnc\/xstartup \u65f6\uff0c\u6307\u5b9a\u7684\u7a97\u53e3\u7ba1\u7406\u5668\u662f twm \uff0c\u5b83\u662f\u4e00\u4e2a\u6781\u5c0f\u7684\u7a97\u53e3\u7ba1\u7406\u5668\uff0c\u51e0\u4e4e\u6bcf\u53f0 X Window \u7cfb\u7edf\u673a\u5668\u4e0a\u90fd\u6709 twm\u3002twm \u4e0d\u5177\u5907\u5b8c\u6574\u201c\u684c\u9762\u7ba1\u7406\u5668\u201d\uff08\u8c61 KDE\u3001GNOME \u6216 WindowMaker\uff09\u7684\u5927\u90e8\u5206\u82b1\u54e8\u529f\u80fd\u3002\u4e0b\u9762\u662f\u4fee\u6539\u8fc7\u7684\u793a\u4f8b\uff1a <\/span><\/p>\n<p><span style=\"color:#0000ff;\">#!\/bin\/sh<\/span><\/p>\n<p><span>[ -x \/etc\/vnc\/xstartup ] <span style=\"color:#008000;\">&amp;&amp;<\/span> <span style=\"color:#993300;\">exec<\/span> \/etc\/vnc\/xstartup<br \/>\n[ -r $HOME\/ .Xresources ]<span style=\"color:#008000;\">&amp;&amp;<\/span> xrdb $HOME\/.Xresources<br \/>\nxsetroot - solid grey<br \/>\nvncconfig - iconic <span style=\"color:#008000;\">&amp;<\/span><br \/>\n<span style=\"color:#0000ff;\">#xterm -geometry 80x24+10+10 -ls -title \"$VNCDESKTOP Desktop\" &amp;<br \/>\n#twm &amp;<br \/>\n#exec wmaker<br \/>\n#exec startkde<\/span> <br \/>\ngnome-session <span style=\"color:#008000;\">&amp;<\/span><\/span><\/p>\n<p><span>\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6ce8\u91ca\u6389\u4e86\u7f3a\u7701 twm \u548c xterm \u7684\u7f3a\u7701\u542f\u52a8\u3002\u914d\u7f6e\u4e86\u8fd9\u4e2a\u684c\u9762\u6765\u907f\u514d\u80cc\u666f\u548c\u6807\u9898\u680f\u4e0a\u7684\u989c\u8272\u6e10\u53d8\uff0c\u5e76\u4f7f\u7528\u6781\u5c11\u7684\u52a8\u753b\u6548\u679c\u3002<\/p>\n<p>\n<\/span><span><span style=\"color:#a52a2a;\">\u5173\u95ed\u670d\u52a1\u5668\u4e0a\u81ea\u5df1\u7684vnc\u8fde\u63a5<\/span><br \/>\n<span style=\"color:#0000ff;\">vncserver -kill :\u684c\u9762\u53f7<\/p>\n<p><\/span><\/span><span style=\"color:#a52a2a;\"><span>\u5f00\u673a\u81ea\u52a8\u8fd0\u884cvncserver<br \/>\n<\/span><\/span><span>1.\u8bbe\u7f6evncserver\u542f\u52a8\u811a\u672c(<span style=\"color:#0000ff;\">\/etc\/init.d\/vncserver<\/span>)\u5b9e\u73b0\u7cfb\u7edf\u81ea\u542f\u52a8\u65f6\u542f\u52a8vncserver.<\/p>\n<p>2.<\/span><span>\u7f16\u8f91<span style=\"color:#0000ff;\">\/etc\/sysconfig\/vncservers<\/p>\n<p><\/span><\/span><span><span style=\"color:#0000ff;\">VNCSERVERS=\"1:user1\"<br \/>\nARGS=\"-geometry 800x600 -alwaysshared \"<\/span><\/p>\n<p>\u5728ARGS \u4e2d\u4fee\u6539\"<\/span><span>800<\/span><span>x600\"\u6765\u9002\u5e94\u81ea\u5df1\u7684X\u684c\u9762\u5b9e\u9645\u53c2\u6570\u914d\u7f6e\u3002\u53ef\u4ee5\u5728\u8fd9\u91cc\u6dfb\u52a0\u4efb\u4f55\u5176\u4ed6VNC\u670d\u52a1\u5668\u53c2\u6570\u914d\u7f6e\u3002\u5728VNCSERVERS\u4e2d\u4fee\u6539 <\/span><span><span style=\"color:#0000ff;\">user1<\/span> <\/span><span>\u4e3a\u4f60\u5e0c\u671b\u8fd0\u884cVNC\u684c\u9762\u7684\u7528\u6237\u3002VNCSERVERS\u4e2d\u7684<span style=\"color:#0000ff;\">1<\/span>\u8868\u793aVNC\u4ee5\u684c\u97621\u8fd0\u884c\uff0c\u5982\u679c\u5e0c\u671b\u6dfb\u52a0\u5176\u4ed6\u7684\u684c\u9762\uff0c\u53ef\u4ee5\u4fee\u6539\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n<p><span style=\"color:#0000ff;\">VNCSERVERS=\"1:<\/span><\/span><span style=\"color:#0000ff;\"><span>user1<\/span><span> 2:<\/span><span>user2<\/span><span> 3:<\/span><span>user3<\/span><\/span><span><span style=\"color:#0000ff;\">\"<\/span><\/p>\n<p>3.<\/span><span class=\"normalfont\">\u8bbe\u7f6evnc server\u7684\u8bbf\u95ee\u5bc6\u7801<br \/>\n<span style=\"color:#0000ff;\">vncpasswd<\/span><\/p>\n<p><\/span><span>\u5728RedHat\u7cfb\u7edf\u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8VNC\uff1a<br \/>\n<span style=\"color:#0000ff;\">\/etc\/init.d\/vncserver start<\/span><\/span><\/p>\n<p><span><span style=\"color:#0000ff;\"><span><span style=\"color:#a52a2a;\">----------------------------------------------2--------------------------------------------------<\/span><\/span><\/span><\/span><\/p>\n<p><span><span style=\"color:#0000ff;\">Linux\u7cfb\u7edf\u8fdc\u7a0b\u684c\u9762\uff08VNC\uff09\u914d\u7f6e\u65b9\u6cd5<\/span><\/span><\/p>\n<p><span>Linux\u9ed8\u8ba4\u5b89\u88c5\u4e86VNC\u670d\u52a1\uff0c\u4e3a\u4e86\u4ee5\u540e\u65b9\u4fbf\u4f7f\u7528\uff0c\u53ef\u5728ntsysv\u91cc\u8bbe\u7f6evnc\u670d\u52a1\u4e3a\u5f00\u673a\u81ea\u52a8\u542f\u52a8\u3002<\/span><\/p>\n<p><span>\u5982\u679c\u7cfb\u7edf\u5b89\u88c5\u4e86\u9632\u706b\u5899\uff0c\u5efa\u8bae\u5173\u6389\u6216\u8005\u52a0\u5165vnc\u7684\u8bbf\u95ee\u89c4\u5219\u3002\uff08service iptables stop\uff09<\/span><\/p>\n<p><span><span style=\"color:#0000ff;\">\u4e8c\u3001\u5f00\u59cb\u914d\u7f6e<\/span><\/span><\/p>\n<p><span>\u547d\u4ee4\uff1avncserver<\/span><\/p>\n<p><span>\u7b2c\u4e00\u6b21\u4f7f\u7528\u6b64\u547d\u4ee4\u4f1a\u63d0\u793a\u4f60\u8f93\u5165\u8bbf\u95ee\u53e3\u4ee4\uff0c\u4e24\u6b21\u53e3\u4ee4\u540e\uff0cvncserver\u5373\u53ef\u6b63\u5e38\u5de5\u4f5c\u3002<\/span><\/p>\n<p><span>\u53ef\u4ee5\u4f7f\u7528\u6700\u5e38\u7528\u5de5\u5177VNC Viewer\u8bbf\u95ee\u8fdc\u7a0b\u684c\u9762\u4e86\u3002<\/span><\/p>\n<p><span><span style=\"color:#0000ff;\">\u4e09\u3001\u663e\u793a\u56fe\u5f62\u5316\u754c\u9762<\/span><\/span><\/p>\n<p><span>\u4e0d\u77e5\u662f\u51fa\u4e8e\u4ec0\u4e48\u8003\u8651\uff0c\u7b2c\u4e8c\u6b65\u540e\u65e0\u6cd5\u770b\u5230\u56fe\u5f62\u5316\u754c\u9762\uff0c\u4f46\u6539\u8d77\u6765\u8d85\u7b80\u5355\uff0c\u4fee\u6539\u4e00\u4e2a\u53c2\u6570\u5c31OK\u4e86\u3002<\/span><\/p>\n<p><span>\u7528\u7b2c\u4e8c\u6b65\u65f6\u7684\u7528\u6237\u767b\u5f55\uff0c\u4fee\u6539\u4e00\u4e0bVNC\u7684\u542f\u52a8\u6587\u4ef6<\/span><\/p>\n<p><span>vi .vnc\/xstartup<\/span><\/p>\n<p><span>\u5c06\u6700\u540e\u4e00\u884c\u201ctwm &amp;\u201d\u4fee\u6539\u4e3a\u201cgnome-session &amp;\u201d<\/span><\/p>\n<p><span>\u91cd\u542fvnc\u670d\u52a1\uff0ckill\u6389\u521a\u624d\u7684\u8fdb\u7a0b\uff0c\u518d\u65b0\u542f\u4e00\u4e2aVNC\u5373\u53ef\u3002<\/span><\/p>\n<p><span>service vncserver restart<\/span><\/p>\n<p><span>vncserver -kill :1<\/span><\/p>\n<p><span>vncserver<br \/>\n<\/span><\/p>\n<\/div>\n<p>======================================================<\/p>\n<h1>Xvnc in Linux RH6.2 problem<\/h1>\n<\/p>\n<hr \/>\n<pre>When you unzip vnc-3.3.3r1_x86_linux_2.0.tgz a folder called\r\nvnc_x86_linux_2.0 is created.\r\n\r\nFirst of all, that folder contains a readme file that explains everything I'm\r\nabout to tell you.:-)\r\n\r\nThere is only a couple of steps that need to be taken in linux before you can\r\n.\/vncserver....\r\n\r\n#1 Make sure that \/usr\/local\/bin is in your path.  If it isn't add it to the\r\nPATH statement in your .bash_profile.  A portion of your .bash_profile could\r\nlook like this ....\r\nPATH=\/usr\/local\/bin:$PATH:$HOME\/bin\r\n\r\nAfter you save this file you need to have your bash re-read it.  Type su -l\r\nroot.  To verify that you path is updated type echo $PATH\r\n\r\n#2 cd to the vnc_x86_linux_2.0 directory.  Type the following\r\ncp vncviewer vncserver vncpasswd Xvnc \/usr\/local\/bin\r\n\r\n#3 If you want to use the Java VNC viewer (http, 58xx) do the following\r\nmkdir -p \/usr\/local\/vnc\/classes\r\ncp classes\/* \/usr\/local\/vnc\/classes\r\n\r\nThat's It!\r\n\r\nGet back to \/root and type vncserver not .\/vncserver you will be prompted for\r\na password.\r\n\r\nAt this point vnc created a .vnc folder in your root directory.\r\n\r\nYou should be able to connect with no problem.\r\n\r\nNathan Lenz wrote:\r\n\r\n&gt;<em> when running(as root):<\/em>&gt;<em> .\/vncserver<\/em>&gt;<em> <\/em>&gt;<em> I get the error:<\/em>&gt;<em> vncserver: couldn't find \"Xvnc\" on your PATH.<\/em>&gt;<em> <\/em>&gt;<em> Is there any simple instructions on installing the vnc server on a default<\/em>&gt;<em> linux instalation...<\/em>&gt;<em> <\/em>&gt;<em> Nathan Lenz<\/em>&gt;<em> ---------------------------------------------------------------------<\/em>&gt;<em> To unsubscribe, send a message with the line: unsubscribe vnc-list<\/em>&gt;<em> to majordomo \"at\" uk.research.att.com<\/em>&gt;<em> See also: <a href=\"http:\/\/www.uk.research.att.com\/vnc\/intouch.html\">http:\/\/www.uk.research.att.com\/vnc\/intouch.html<\/a> <\/em>&gt;<em> ---------------------------------------------------------------------<\/em> --\r\nRegards<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div><strong>1\u3001\u5b89\u88c5<\/strong><\/div>\n<div>yum install vnc*<\/div>\n<div><strong>2\u3001\u542f\u52a8<\/strong><\/div>\n<div>\/etc\/init.d\/vncserver start<\/div>\n<div>Starting VNC server: no displays configured [ OK ]<\/div>\n<div><strong>3\u3001\u914d\u7f6e\u7528\u6237\u540d<\/strong><br \/>\nCODE:[root@localhost ~]# vi \/etc\/sysconfig\/vncservers<br \/>\n# The VNCSERVERS variable is a list of display:user pairs.<br \/>\n#<br \/>\n# Uncomment the line below to start a VNC server on display :1<br \/>\n# as my ...<\/div>\n<p> <a href=\"https:\/\/www.xiaobo.li\/notes\/archives\/253\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[273],"tags":[84],"class_list":["post-253","post","type-post","status-publish","format-standard","hentry","category-article","tag-vnc"],"_links":{"self":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/comments?post=253"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/253\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/media?parent=253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/categories?post=253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/tags?post=253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}