Reader small image

You're reading from  Raspberry Pi Super Cluster

Product typeBook
Published inNov 2013
Reading LevelBeginner
PublisherPackt
ISBN-139781783286195
Edition1st Edition
Languages
Right arrow
Author (1)
Andrew K. Dennis
Andrew K. Dennis
author image
Andrew K. Dennis

Andrew K. Dennis is a full stack and cybersecurity architect with over 17 years' experience who currently works for Modus Create in Reston, VA. He holds two undergraduate degrees in software engineering and creative computing and a master's degree in information security. Andy has worked in the US, Canada, and the UK in software engineering, e-learning, data science, and cybersecurity across his career, and has written four books on IoT, the Raspberry Pi, and supercomputing. His interests range from the application of pataphysics in computing to security threat modeling. Andy lives in New England and is an organizer of Security BSides CT.
Read more about Andrew K. Dennis

Right arrow

Chapter 2. Setting Up your Raspberry Pi Software and Hardware for Parallel Computing

Now we are familiar with the concept of parallel computing and we need to set up our Raspberry Pi's hardware and software in order to work with MPI and Hadoop.

In this chapter we will start by discussing our work environment and hardware configuration. Following this we will install the necessary software onto the SD card and complete the basic configuration required.

Setting up our work environment


In order for our devices to communicate with one another, we need to set up the networking hardware and cable connections. We will also need to connect the necessary peripherals in order to interact with the Raspberry Pi's boot loading software.

Provided is a list of recommended and optional items you will need and following this we will discuss each of them in detail:

  • Two Raspberry Pi Model B's, preferred with 512 MB RAM

  • HDMI-capable or VGA/DVI monitor with appropriate adapter or adapter cable

  • USB keyboard

  • USB mouse

  • Two 1A at 5 V Micro-USB power units

  • A desk-mounted power strip with both USB and mains outlets (optional)

  • Three Ethernet/RJ45 network cables

  • A small network switch

  • An existing Internet connection

  • Two SD cards that are compatible with the Raspberry Pi

  • Housing units for the Raspberry Pi boards (optional)

  • USB hard drives (optional)

  • Lego (optional)

HDMI-capable monitor or VGA/DVI monitor and adapter

The Raspberry Pi provides two easy options for connecting visual...

Future expansion and a scalable setup


The examples in this book are designed to be scalable. That is if you wish to add more Raspberry Pi's to your network, this should be very easy.

If you plan on running more than two devices you should therefore consider hardware that scales well. Switches for example come with as many as 48 ports.

One area you may find problematic is in providing power to multiple Raspberry Pi computers. Having a huge number of power units of USB hubs can be extremely cluttered. In Chapter 7, Going Further, we suggest several methods for providing power to multiple units.

With the preceding thoughts in mind, let's now complete the initial set up of our hardware.

Completing the initial setup


Each chapter in this book will guide you through when you need to connect each hardware device and install software as necessary.

There is however some setup you will need to perform initially:

  • Start by connecting your switch to your router using a network cable and then connect the power unit to the switch to power it up.

  • Using a PC or similar device with an Ethernet connection, plug it into the switch and test that you can access the network and Internet.

  • Next select a single Raspberry Pi. This will be your Master unit.

  • Connect the mouse, keyboard, and the monitor to the Raspberry Pi.

  • Test that the Raspberry Pi is in easy reach of the switch by connecting them together via an Ethernet cable. Once you have confirmed this you can disconnect the Ethernet cable.

  • If you are using an USB hub or two separate USB power units, plug these into your mains power and position them so they are within easy reach of the Raspberry Pi.

  • Next check that the USB cables can easily plug...

Using an SD card as our Raspberry Pi's storage device


The Raspberry Pi comes equipped with a Secure Digital (SD) card port and to begin with we will run the operating system from an SD card. It is possible to use an USB hard drive as we discussed earlier, which are generally faster and in Chapter 7, Going Further we will discuss this in more detail. For the earlier chapters, however, the SD card is convenient as it is easy to quickly clone for multiple devices, takes up no extra desk space, and leaves the USB ports free for connecting a mouse and keyboard for debugging issue, if for example, you cannot login to the device via the network.

There is a range of SD cards available in the market in a variety of sizes. You will need to use an SD card of at least 2 GB.

You can find a guide to supported SD card brands and models at eLinux's Raspberry Pi Wiki:

http://elinux.org/RPi_SD_cards

It is also possible to purchase an SD card with a pre-installed operating system; however we recommend following...

BerryBoot version 2


Next we are going to download and install BerryBoot version 2 onto the formatted SD card. For those of you who chose to download NOOBS from the Raspberry Pi site, you can ignore this step and should follow the readme guide.

BerryBoot is a Mac, Windows, and Linux compatible universal operating system installer, also known as a boot loader. BerryBoot is packaged as a ZIP file, which when unzipped onto your formatted SD card will launch once the SD card is connected to the Raspberry Pi.

Once BerryBoot launches, it gives you the option of installing one or more Raspberry Pi-compatible operating systems onto the SD card.

Downloading the BerryBoot version 2 ZIP file

In order to install BerryBoot, you will need to download the latest version of the ZIP file from the BerryBoot website. This can be found at:

http://www.berryterminal.com/doku.php/berryboot

Locate the download hyperlink; this will probably have a date stamp on it. As of May 28, 2013 the file is approximately 30 MB.

Using...

Starting up the Raspberry Pi


You are now ready to start up the Raspberry Pi and start using BerryBoot version 2.

The following steps will guide you through powering up your Raspberry Pi safely:

  1. Start by ejecting your SD card from your computer and place it into the SD card port of the Raspberry Pi you prepared for use earlier in this chapter.

  2. Plug in the mouse and keyboard to the USB ports. You will need these in order to complete the operating installation process.

  3. Hook up the monitor to the HDMI port.

  4. Connect the Raspberry Pi to the switch you set up earlier in this chapter.

  5. Now power up your Raspberry Pi by connecting the micro-USB power unit to it.

If you are using BerryBoot, displayed on your monitor will be the Welcome screen. This is the first step in setting up our operating system and is also a confirmation that we copied the boot loader onto the SD card successfully.

BerryBoot version 2 and NOOBS provide us with a number of Linux versions to choose from. For setting up our parallel-based...

Wrapping up


We now have our operating system installed and our RSA key set up. The following guides provide some optional tools and compilers you can now install onto Raspbian, including a guide to install Fortran.

Editing text files on Raspbian

While editing and running code on your Raspberry Pi, having a good code and text-editing tool is very useful. By default the Raspberry Pi comes installed with a text-editor called nano. You can read more about nano at:

http://www.nano-editor.org/

Vim is also a text editing tool—especially good for programming—with a wide variety of functions and features, including the ability to run shell commands while you are editing a file.

For those interested in checking out Vim, you can read more at:

http://www.vim.org/about.php

To install Vim from the terminal line run the following command:

sudo apt-get install vim

Throughout this book we will be using Vim to edit files; however, feel free to use nano or whichever tool you are most comfortable with.

Installing...

Summary


In this chapter we set up our work area and hardware for building our parallel computing system using Raspberry Pi. We then formatted our SD card and installed BerryBoot version 2 or NOOBS. This subsequently allowed us to set up our Master Raspberry Pi device. Finally we tested our SSH service running on the Raspberry Pi and created an SSH public and private key pair.

Next we will install MPICH, set up our second Raspberry Pi, test our SSH keys, and try out a parallel application that runs on both of our Raspberry Pi's.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Raspberry Pi Super Cluster
Published in: Nov 2013Publisher: PacktISBN-13: 9781783286195
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Andrew K. Dennis

Andrew K. Dennis is a full stack and cybersecurity architect with over 17 years' experience who currently works for Modus Create in Reston, VA. He holds two undergraduate degrees in software engineering and creative computing and a master's degree in information security. Andy has worked in the US, Canada, and the UK in software engineering, e-learning, data science, and cybersecurity across his career, and has written four books on IoT, the Raspberry Pi, and supercomputing. His interests range from the application of pataphysics in computing to security threat modeling. Andy lives in New England and is an organizer of Security BSides CT.
Read more about Andrew K. Dennis