{"id":53057,"date":"2024-10-09T07:56:16","date_gmt":"2024-10-08T23:56:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/53057\/"},"modified":"2024-11-14T10:36:17","modified_gmt":"2024-11-14T02:36:17","slug":"%e5%9c%a8-ubuntu-18-04-%e4%b8%8a%e5%ae%89%e8%a3%9d%e5%92%8c%e9%85%8d%e7%bd%ae-vnc","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/53057\/","title":{"rendered":"\u5728 Ubuntu 18.04 \u4e0a\u5b89\u88dd\u548c\u914d\u7f6e VNC"},"content":{"rendered":"<h1 id=\"%e5%9c%a8-ubuntu-18-04-%e4%b8%8a%e5%ae%89%e8%a3%9d%e5%92%8c%e9%85%8d%e7%bd%ae-vnc-UknvcPBBZv\">\u5728 Ubuntu 18.04 \u4e0a\u5b89\u88dd\u548c\u914d\u7f6e VNC<\/h1>\n<p>\u865b\u64ec\u7db2\u7d61\u8a08\u7b97\uff08VNC\uff09\u662f\u4e00\u7a2e\u9060\u7a0b\u684c\u9762\u5354\u8b70\uff0c\u5141\u8a31\u7528\u6236\u901a\u904e\u7db2\u7d61\u8a2a\u554f\u548c\u63a7\u5236\u53e6\u4e00\u53f0\u8a08\u7b97\u6a5f\u7684\u684c\u9762\u74b0\u5883\u3002\u5728 Ubuntu 18.04 \u4e0a\u5b89\u88dd\u548c\u914d\u7f6e VNC \u53ef\u4ee5\u8b93\u7528\u6236\u65b9\u4fbf\u5730\u9032\u884c\u9060\u7a0b\u7ba1\u7406\u548c\u64cd\u4f5c\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39\u5982\u4f55\u5728 Ubuntu 18.04 \u4e0a\u5b89\u88dd\u548c\u914d\u7f6e VNC\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d-vnc-%e4%bc%ba%e6%9c%8d%e5%99%a8-UknvcPBBZv\">\u5b89\u88dd VNC \u4f3a\u670d\u5668<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5b89\u88dd VNC \u4f3a\u670d\u5668\u3002Ubuntu 18.04 \u4e2d\u5e38\u7528\u7684 VNC \u4f3a\u670d\u5668\u6709 TightVNC \u548c TigerVNC\u3002\u4ee5\u4e0b\u662f\u5b89\u88dd TigerVNC \u7684\u6b65\u9a5f\uff1a<\/p>\n<pre><code>sudo apt update\nsudo apt install tigervnc-standalone-server tigervnc-common<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u6aa2\u67e5 VNC \u4f3a\u670d\u5668\u662f\u5426\u5b89\u88dd\u6210\u529f\uff1a<\/p>\n<pre><code>vncserver -version<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%ae-vnc-%e4%bc%ba%e6%9c%8d%e5%99%a8-UknvcPBBZv\">\u914d\u7f6e VNC \u4f3a\u670d\u5668<\/h2>\n<p>\u5728\u5b89\u88dd\u5b8c VNC \u4f3a\u670d\u5668\u5f8c\uff0c\u60a8\u9700\u8981\u9032\u884c\u57fa\u672c\u914d\u7f6e\u3002\u9996\u5148\uff0c\u555f\u52d5 VNC \u4f3a\u670d\u5668\u4ee5\u751f\u6210\u521d\u59cb\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>vncserver<\/code><\/pre>\n<p>\u7cfb\u7d71\u6703\u63d0\u793a\u60a8\u8a2d\u7f6e\u4e00\u500b VNC \u5bc6\u78bc\u3002\u8acb\u6ce8\u610f\uff0c\u9019\u500b\u5bc6\u78bc\u5fc5\u9808\u81f3\u5c11\u5305\u542b 6 \u500b\u5b57\u7b26\u3002\u8a2d\u7f6e\u5b8c\u6210\u5f8c\uff0cVNC \u4f3a\u670d\u5668\u6703\u751f\u6210\u4e00\u500b\u986f\u793a\u865f\u78bc\uff0c\u901a\u5e38\u662f :1\uff0c\u9019\u610f\u5473\u8457\u60a8\u53ef\u4ee5\u901a\u904e <code>hostname:1<\/code> \u4f86\u8a2a\u554f\u8a72 VNC \u6703\u8a71\u3002<\/p>\n<h3 id=\"%e7%b7%a8%e8%bc%af-vnc-%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6-UknvcPBBZv\">\u7de8\u8f2f VNC \u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u7de8\u8f2f VNC \u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u4fbf\u8a2d\u7f6e\u684c\u9762\u74b0\u5883\u3002\u9996\u5148\uff0c\u505c\u6b62 VNC \u4f3a\u670d\u5668\uff1a<\/p>\n<pre><code>vncserver -kill :1<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u7de8\u8f2f\u914d\u7f6e\u6587\u4ef6 <code>~\/.vnc\/xstartup<\/code>\uff1a<\/p>\n<pre><code>nano ~\/.vnc\/xstartup<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>#!\/bin\/sh\nxrdb $HOME\/.Xresources\nstartxfce4 &amp;<\/code><\/pre>\n<p>\u9019\u88e1\u5047\u8a2d\u60a8\u4f7f\u7528\u7684\u662f XFCE \u684c\u9762\u74b0\u5883\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f\u5176\u4ed6\u684c\u9762\u74b0\u5883\uff0c\u8acb\u6839\u64da\u9700\u8981\u9032\u884c\u8abf\u6574\u3002\u4fdd\u5b58\u4e26\u9000\u51fa\u7de8\u8f2f\u5668\u5f8c\uff0c\u7d66\u4e88\u8a72\u6587\u4ef6\u57f7\u884c\u6b0a\u9650\uff1a<\/p>\n<pre><code>chmod +x ~\/.vnc\/xstartup<\/code><\/pre>\n<h2 id=\"%e5%95%9f%e5%8b%95-vnc-%e4%bc%ba%e6%9c%8d%e5%99%a8-UknvcPBBZv\">\u555f\u52d5 VNC \u4f3a\u670d\u5668<\/h2>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u91cd\u65b0\u555f\u52d5 VNC \u4f3a\u670d\u5668\uff1a<\/p>\n<pre><code>vncserver<\/code><\/pre>\n<p>\u518d\u6b21\u6aa2\u67e5 VNC \u4f3a\u670d\u5668\u7684\u72c0\u614b\uff0c\u78ba\u4fdd\u5b83\u6b63\u5728\u904b\u884c\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u7576\u524d\u904b\u884c\u7684 VNC \u6703\u8a71\uff1a<\/p>\n<pre><code>vncserver -list<\/code><\/pre>\n<h2 id=\"%e9%80%a3%e6%8e%a5%e5%88%b0-vnc-%e4%bc%ba%e6%9c%8d%e5%99%a8-UknvcPBBZv\">\u9023\u63a5\u5230 VNC \u4f3a\u670d\u5668<\/h2>\n<p>\u8981\u9023\u63a5\u5230 VNC \u4f3a\u670d\u5668\uff0c\u60a8\u9700\u8981\u4f7f\u7528 VNC \u5ba2\u6236\u7aef\u3002\u5e38\u7528\u7684 VNC \u5ba2\u6236\u7aef\u6709 RealVNC\u3001TightVNC \u548c TigerVNC\u3002\u5b89\u88dd\u597d VNC \u5ba2\u6236\u7aef\u5f8c\uff0c\u555f\u52d5\u5b83\u4e26\u8f38\u5165\u4f3a\u670d\u5668\u7684\u5730\u5740\uff0c\u4f8b\u5982 <code>hostname:1<\/code>\uff0c\u7136\u5f8c\u8f38\u5165\u60a8\u4e4b\u524d\u8a2d\u7f6e\u7684\u5bc6\u78bc\u5373\u53ef\u9023\u63a5\u3002<\/p>\n<h2 id=\"%e5%ae%89%e5%85%a8%e6%80%a7%e8%80%83%e9%87%8f-UknvcPBBZv\">\u5b89\u5168\u6027\u8003\u91cf<\/h2>\n<p>\u7531\u65bc VNC \u5354\u8b70\u672c\u8eab\u4e0d\u52a0\u5bc6\uff0c\u56e0\u6b64\u5efa\u8b70\u901a\u904e SSH \u96a7\u9053\u4f86\u52a0\u5bc6 VNC \u9023\u63a5\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5275\u5efa SSH \u96a7\u9053\uff1a<\/p>\n<pre><code>ssh -L 5901:localhost:5901 -N -f user@hostname<\/code><\/pre>\n<p>\u9019\u6a23\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u9023\u63a5\u5230 <code>localhost:5901<\/code> \u4f86\u5b89\u5168\u5730\u8a2a\u554f VNC \u4f3a\u670d\u5668\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-UknvcPBBZv\">\u7e3d\u7d50<\/h2>\n<p>\u5728 Ubuntu 18.04 \u4e0a\u5b89\u88dd\u548c\u914d\u7f6e VNC \u662f\u4e00\u500b\u76f8\u5c0d\u7c21\u55ae\u7684\u904e\u7a0b\uff0c\u901a\u904e\u4e0a\u8ff0\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u8f15\u9b06\u5730\u8a2d\u7f6e\u9060\u7a0b\u684c\u9762\u8a2a\u554f\u3002\u7121\u8ad6\u662f\u7528\u65bc\u9060\u7a0b\u7ba1\u7406\u9084\u662f\u65e5\u5e38\u64cd\u4f5c\uff0cVNC \u90fd\u662f\u4e00\u500b\u975e\u5e38\u5be6\u7528\u7684\u5de5\u5177\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u670d\u52d9\u4f86\u904b\u884c\u60a8\u7684\u61c9\u7528\u7a0b\u5e8f\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u9069\u5408\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002\u4e86\u89e3\u66f4\u591a\u95dc\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u7684\u4fe1\u606f\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u5728 Ubuntu 18.04 \u4e0a\u5b89\u88dd\u548c\u914d\u7f6e VNC\uff0c\u4ee5\u4fbf\u9060\u7a0b\u8a2a\u554f\u548c\u7ba1\u7406\u60a8\u7684\u684c\u9762\u74b0\u5883\u3002\u7c21\u55ae\u6b65\u9a5f\uff0c\u8f15\u9b06\u4e0a\u624b\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-53057","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/53057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=53057"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/53057\/revisions"}],"predecessor-version":[{"id":53058,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/53057\/revisions\/53058"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=53057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=53057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=53057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}