{"id":79,"date":"2017-01-24T20:23:25","date_gmt":"2017-01-25T04:23:25","guid":{"rendered":"http:\/\/courses.haigarmen.com\/intd320\/?p=79"},"modified":"2017-01-25T12:31:14","modified_gmt":"2017-01-25T20:31:14","slug":"raspberrypi-05-remote-desktop","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/intd320\/raspberrypi-05-remote-desktop\/","title":{"rendered":"RaspberryPi 05: Remote Desktop"},"content":{"rendered":"<h3>UPDATE:<\/h3>\n<p><strong>This article is out of date, RealVNC is now installed on Raspbian, see <a href=\"https:\/\/www.raspberrypi.org\/magpi\/vnc-raspberry-pi\/\">this article for more info<\/a><\/strong><\/p>\n<p>(excerpt from page 27 of MRE-RPi book)<\/p>\n<p>Often all you need to control your Raspberry Pi is an SSH connection, however sometimes it is useful to be able to remotely control your RPi using the mouse and seeing just what you would see on the screen of your RPi.<\/p>\n<p>VNC (Virtual Network Connection) is a standard for doing just this. To use it, you have to install some software on your Pi. There are a number of VNC server applications, and the one we are going to use is called \u201ctightvnc\u201d.<br \/>\nWe can install the VNC server software using the SSH connection that we established earlier.<\/p>\n<p>**sudo apt-get install tightvncserver**<br \/>\n\u201cvncserver :1 -geometry 1024&#215;768 -depth 24\u201d<\/p>\n<p>on mac: open screen sharing<br \/>\n\u201cvnc:\/\/192.168.10.70:5901\u201d<\/p>\n<h3>Starting TightVNCServer on Boot<\/h3>\n<p class=\"p1\">Having a remote desktop is extremely useful, but if we need to run the tightvncserver program on the Raspberry Pi each time we want to use the remote desktop, it would be extremely inconvenient. What we will do instead is set up tightvncserver so that it starts automatically each time the Raspberry Pi boots up.<\/p>\n<p class=\"p1\">To do this we are going to use a little bit of Linux cleverness. We\u2019ll explain it as we go along, but be aware, some will find the explanations a little tiresome (if you\u2019re already familiar) but I\u2019m sure that there will be some readers who will benefit.<\/p>\n<p class=\"p1\">Our first task will be to edit the file <span class=\"s1\">\/etc\/rc.local<\/span>. This file can contain commands that get run on start-up. If we look at the file we can see that there is already few entries in there;<\/p>\n<p class=\"p1\">#!\/bin\/sh -e<br \/>\n#<br \/>\n# rc.local<br \/>\n#<br \/>\n# This script is executed at the end of each multiuser runlevel.<br \/>\n# Make sure that the script will &#8220;exit 0&#8221; on success or any other<br \/>\n# value on error.<br \/>\n#<br \/>\n# In order to enable or disable this script just change the execution<br \/>\n# bits.<br \/>\n#<br \/>\n# By default this script does nothing.<br \/>\n# Print the IP address<\/p>\n<p class=\"p2\"><span class=\"s1\">_IP<\/span><span class=\"s2\">=<\/span><span class=\"s3\">$(<\/span>hostname -I<span class=\"s3\">) <\/span><span class=\"s2\">|| <\/span><span class=\"s3\">true<br \/>\n<\/span>if <span class=\"s2\">[ <\/span><span class=\"s4\">&#8220;<\/span><span class=\"s1\">$_<\/span><span class=\"s4\">IP&#8221; <\/span><span class=\"s2\">]<\/span><span class=\"s5\">; <\/span>then<br \/>\n<span class=\"s3\">printf <\/span>&#8220;My IP address is %s\u00c4n&#8221; &#8220;<span class=\"s1\">$_<\/span>IP&#8221;<br \/>\nfi<\/p>\n<p class=\"p3\">exit <span class=\"s5\">0<\/span><\/p>\n<p class=\"p1\">We will add the following command into <span class=\"s1\">rc.local<\/span>;<br \/>\nsu &#8211; pi -c &#8216;\/usr\/bin\/tightvncserver :1&#8217;<\/p>\n<p class=\"p1\">To do this we will edit the <span class=\"s1\">rc.local <\/span>file with the following command;<br \/>\nsudo nano \/etc\/rc.local<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE: This article is out of date, RealVNC is now installed on Raspbian, see this article for more info (excerpt from page 27 of MRE-RPi book) Often all you need to control your Raspberry Pi is an SSH connection, however sometimes it is useful to be able to remotely control your RPi using the mouse [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":4,"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"predecessor-version":[{"id":87,"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/posts\/79\/revisions\/87"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/intd320\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}