{"id":409,"date":"2017-08-19T13:45:14","date_gmt":"2017-08-19T12:45:14","guid":{"rendered":"http:\/\/chewett.co.uk\/blog\/?p=409"},"modified":"2018-10-20T22:56:31","modified_gmt":"2018-10-20T21:56:31","slug":"setting-raspberry-pi-cluster-node","status":"publish","type":"post","link":"https:\/\/chewett.co.uk\/blog\/409\/setting-raspberry-pi-cluster-node\/","title":{"rendered":"Setting up a Raspberry Pi Cluster Node"},"content":{"rendered":"<p>To set up a Raspberry Pi node I will follow a specific set of steps so that every Pi is set up \u00a0similarly. For the initial deployment I will follow this once and then <a href=\"\/blog\/441\/cloning-raspberry-pi-sd-card-another\/\">clone the SD Card multiple times<\/a>. If at a later date more are added I will use this guide to follow a basic setup.<\/p>\n<p>This guide can be followed to set up any headless (no monitor\/keyboard\/mouse attached) Raspberry Pi.<\/p>\n<p><!--more--><\/p>\n<h2>Burning Raspbian and configuring it<\/h2>\n<p>The first step is to burn Raspbian to a SD card, some <a href=\"http:\/\/chewett.co.uk\/blog\/241\/installing-raspbian-onto-raspberry-pi\/\">additional details here<\/a>. Once this has done, but before you put the SD card into the Raspberry Pi you need to ensure you set up SSH. I recommend following my previous guide \u00a0to <a href=\"http:\/\/chewett.co.uk\/blog\/407\/ssh-connect-host-raspberrypi-port-22-connection-refused-error-fixed\/\">setting up SSH for Raspberry Pi<\/a>.<\/p>\n<p>Without following this you will need to log onto the Raspberry Pi using a keyboard, mouse, and monitor and set up SSH using the GUI.<\/p>\n<h2>Setting up Raspbian to run headless<\/h2>\n<p>Since I am not currently planning to connect the Raspberry Pi to a screen I will set it up to focus on setting it up for headless operation.<\/p>\n<p>The system utility <code>raspi-config<\/code>\u00a0can be used to change a number of import settings. It can be run by running `sudo raspi-config`.<\/p>\n<p>Once in the Raspi-config menu I will set the hostname using that option on the menu. Under boot options I will also change it to cli mode. This will stop it booting to the desktop when loading and will conserve CPU and RAM during running.<\/p>\n<p>In the advanced options I will select <code>expand filesystem<\/code>. This wont be needed if I have burned the Raspbian image to a SD card but if I clone the SD card to a larger card this is required. If no changes are needed this option will have no effect.<\/p>\n<p>To update the Raspberry Pi you can run the following commands<\/p>\n<pre>sudo apt-get update\r\nsudo apt-get upgrade<\/pre>\n<p>Running <code>apt-get update<\/code> will update the package list. This will then allow running <code>apt-get upgrade<\/code>\u00a0to install new packages.<\/p>\n<h2>Installing packages and setting up user accounts<\/h2>\n<p>Now I have the Raspberry Pi updated and ready to run headless I will install a couple more programs.<\/p>\n<p>Personally to run a headless Raspberry Pi I always install at least the below programs using the command<\/p>\n<pre>sudo apt-get install vim htop byobu screen<\/pre>\n<ul>\n<li><code>vim<\/code> is my preferred command line editor. It appears its not installed by default so it must be installed first!<\/li>\n<li><code>htop<\/code> is a more graphical version of the standard linux tool <code>top<\/code>. Its colour more than wins me over from standard top<\/li>\n<li><code>byobu<\/code> is a very useful addition on top of screen or tmux. It customises how screen\/tmux works and adds some useful information along the top\/bottom<\/li>\n<li><code>screen<\/code> is my chosen terminal multiplexer that I use with byobu.<\/li>\n<\/ul>\n<p>Once these programs have been installed I create a new user to run my scripts. This can be done by following my previous <a href=\"\/blog\/521\/add-new-user-account-raspbian-raspberry-pi\/\">&#8220;how to create a user&#8221; guide<\/a>.<\/p>\n<p>Once the user has been created I give it the <code>video<\/code>\u00a0group. This is important so I can run <a href=\"http:\/\/chewett.co.uk\/blog\/258\/vchi-initialization-failed-raspberry-pi-fixed\/\">vcgencmd commands<\/a>.<\/p>\n<pre>sudo usermod -aG video chewett<\/pre>\n<p>In addition to giving my user the video group, I also want to give myself sudo rights.<\/p>\n<pre>sudo usermod -aG sudo chewett<\/pre>\n<p>This will let be run anything that needs super user rights.<\/p>\n<p>Finally I set up my SSH keys by copying the SSH keys from my bunker-master Raspberry Pi to the newly created image.<\/p>\n<pre>mkdir .ssh\r\nscp bunker-master:~\/.ssh\/* .<\/pre>\n<p>This I will use to log in via my private key and removes the need to enter my password every time.<\/p>\n<p>Now I have set up my Raspberry Pi Image I can then <a href=\"http:\/\/chewett.co.uk\/blog\/441\/cloning-raspberry-pi-sd-card-another\/\">clone the image to my other SD Cards<\/a>. Saving this image will give me a standard image that I can deploy to any new slave I want to add into the system.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To set up a Raspberry Pi node I will follow a specific set of steps so that every Pi is set up \u00a0similarly. For the initial deployment I will follow this once and then clone the SD Card multiple times. If at a later date more are added I will use this guide to follow [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":557,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[122],"tags":[101,114],"class_list":["post-409","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-cluster","tag-raspberry-pi-cluster","tag-raspbian"],"wppr_data":{"cwp_meta_box_check":"No"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p2toWX-6B","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":448,"url":"https:\/\/chewett.co.uk\/blog\/448\/testing-performance-raspberry-pi\/","url_meta":{"origin":409,"position":0},"title":"Testing the performance of a Raspberry Pi","author":"Chewett","date":"July 12, 2017","format":false,"excerpt":"I will be testing the performance of each Raspberry Pi version in my cluster. This is to determine what each one is best suited to running. To do this I need a similar set of tests to run for each and compare them. Ideally the tests will also be runnable\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":407,"url":"https:\/\/chewett.co.uk\/blog\/407\/ssh-connect-host-raspberrypi-port-22-connection-refused-error-fixed\/","url_meta":{"origin":409,"position":1},"title":"ssh: connect to host raspberrypi port 22: Connection refused Error Fixed","author":"Chewett","date":"June 24, 2017","format":false,"excerpt":"I was setting up a new install of Raspbian Pixel and found I couldn't login to the Raspberry Pi. It was giving me an error: chewett@bunker-master:~$ ssh pi@raspberrypi ssh: connect to host raspberrypi port 22: Connection refused It turns out that recently the Raspberry Pi Foundation have changed the default\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":241,"url":"https:\/\/chewett.co.uk\/blog\/241\/installing-raspbian-onto-raspberry-pi\/","url_meta":{"origin":409,"position":2},"title":"Installing Raspbian onto a Raspberry Pi","author":"Chewett","date":"May 17, 2017","format":false,"excerpt":"Here I suggest some recommended steps to install Raspbian on top of their install guide. Choosing an OS for the Raspberry Pi One of the main ways to install a Raspberry Pi OS is to download a disk image called NOOBS.\u00a0This lets you\u00a0choose to easily install a number of different\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":567,"url":"https:\/\/chewett.co.uk\/blog\/567\/upgrading-raspbian-jessie-raspbian-stretch\/","url_meta":{"origin":409,"position":3},"title":"Upgrading Raspbian Jessie to Raspbian Stretch","author":"Chewett","date":"November 4, 2017","format":false,"excerpt":"This post describes how you can upgrade Raspbian Jessie, version 8, to Raspbian Stretch, version 9. Raspbian Stretch was recently released and while they recommend installing from fresh you are able to upgrade the versions. Here I follow the steps of upgrading the Raspberry Pi's in my cluster including some\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/upgrading_to_raspbian_stretch.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/upgrading_to_raspbian_stretch.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/upgrading_to_raspbian_stretch.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/upgrading_to_raspbian_stretch.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":375,"url":"https:\/\/chewett.co.uk\/blog\/375\/setting-up-the-ci20-for-the-cluster\/","url_meta":{"origin":409,"position":4},"title":"Setting up the CI20 for the cluster","author":"Chewett","date":"October 27, 2018","format":false,"excerpt":"This post talks about the steps I have followed to set up my Creator CI20 for the Raspberry Pi Cluster. Burning Debian to the onboard NAND and configuring it To run the CI20 on the Raspberry Pi Cluster I am going to write Debian 8 to the NAND storage. First\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":764,"url":"https:\/\/chewett.co.uk\/blog\/764\/virtualized-raspian-os-virtualbox\/","url_meta":{"origin":409,"position":5},"title":"Virtualized Raspian OS with Virtualbox","author":"Chewett","date":"October 21, 2017","format":false,"excerpt":"This post walks you through the process of installing the Raspberry Pi OS, Raspbian, with VirtualBox. I am going to use this at times to test my software running on the OS that the Raspberry Pi Cluster runs. Why do I need a special version of Raspbian OS to work\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/raspbian_on_virtualbox.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/raspbian_on_virtualbox.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/raspbian_on_virtualbox.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/10\/raspbian_on_virtualbox.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=409"}],"version-history":[{"count":11,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/409\/revisions"}],"predecessor-version":[{"id":1669,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/409\/revisions\/1669"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media\/557"}],"wp:attachment":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}