100% found this document useful (2 votes)
147 views

Raspberry Pi Networking Cookbook Golden all chapter instant download

The document promotes the 'Raspberry Pi Networking Cookbook' by Rick Golden, which offers practical recipes for utilizing the Raspberry Pi for various networking tasks. It includes links to download the book and other related ebooks, along with a brief overview of the author's background and the book's content structure. The book aims to guide users from basic setup to advanced networking solutions without requiring extensive programming knowledge.

Uploaded by

esefaboqnka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
147 views

Raspberry Pi Networking Cookbook Golden all chapter instant download

The document promotes the 'Raspberry Pi Networking Cookbook' by Rick Golden, which offers practical recipes for utilizing the Raspberry Pi for various networking tasks. It includes links to download the book and other related ebooks, along with a brief overview of the author's background and the book's content structure. The book aims to guide users from basic setup to advanced networking solutions without requiring extensive programming knowledge.

Uploaded by

esefaboqnka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Visit https://ebookultra.

com to download the full version and


explore more ebooks

Raspberry Pi Networking Cookbook Golden

_____ Click the link below to download _____


https://ebookultra.com/download/raspberry-pi-
networking-cookbook-golden/

Explore and download more ebooks at ebookultra.com


Here are some suggested products you might be interested in.
Click the link to download

Raspberry Pi By Example 1st Edition Pajankar

https://ebookultra.com/download/raspberry-pi-by-example-1st-edition-
pajankar/

Raspberry Pi The Complete Manual 7th Edition Coll.

https://ebookultra.com/download/raspberry-pi-the-complete-manual-7th-
edition-coll/

Raspberry Pi Media Center 1st Edition Sam Nazarko

https://ebookultra.com/download/raspberry-pi-media-center-1st-edition-
sam-nazarko/

Penetration Testing with Raspberry Pi Second Edition


Michael Mcphee

https://ebookultra.com/download/penetration-testing-with-raspberry-pi-
second-edition-michael-mcphee/
Raspberry Pi Hardware Projects 1 1st Edition Andrew
Robinson

https://ebookultra.com/download/raspberry-pi-hardware-projects-1-1st-
edition-andrew-robinson/

Raspberry Pi Projects For Dummies 1st Edition Mike Cook

https://ebookultra.com/download/raspberry-pi-projects-for-dummies-1st-
edition-mike-cook/

Raspberry Pi robotics essentials harness the power of


Raspberry Pi with Six Degrees of Freedom 6DoF to create an
amazing walking robot Grimmett
https://ebookultra.com/download/raspberry-pi-robotics-essentials-
harness-the-power-of-raspberry-pi-with-six-degrees-of-freedom-6dof-to-
create-an-amazing-walking-robot-grimmett/

Raspberry Pi Home Automation with Arduino 1st Edition K.


Dennis

https://ebookultra.com/download/raspberry-pi-home-automation-with-
arduino-1st-edition-k-dennis/

Raspberry Pi A Quick Start Guide 1st Edition Maik Schmidt

https://ebookultra.com/download/raspberry-pi-a-quick-start-guide-1st-
edition-maik-schmidt/
Raspberry Pi Networking Cookbook Golden Digital
Instant Download
Author(s): Golden, Richard
ISBN(s): 9781849694605, 1849694605
Edition: New edition
File Details: PDF, 10.87 MB
Year: 2013
Language: english
www.it-ebooks.info
Raspberry Pi
Networking Cookbook

An epic collection of practical and engaging recipes for


the Raspberry Pi!

Rick Golden

BIRMINGHAM - MUMBAI

www.it-ebooks.info
Raspberry Pi Networking Cookbook

Copyright © 2013 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the publisher,
except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged to be caused directly or
indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies
and products mentioned in this book by the appropriate use of capitals. However, Packt
Publishing cannot guarantee the accuracy of this information.

First published: March 2013

Production Reference: 1270213

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-84969-460-5

www.packtpub.com

Cover Image by Faiz Fattohi (faizfattohi@gmail.com)

www.it-ebooks.info
Credits

Author Project Coordinator


Rick Golden Anurag Banerjee

Reviewers Proofreader
Hector Cuesta-Arvizu Jonathan Todd
Shea Silverman
Indexer
Acquisition Editor Monica Ajmera Mehta
Erol Staveley
Production Coordinator
Lead Technical Editor Shantanu Zagade
Mayur Hule
Cover Work
Technical Editors Shantanu Zagade
Sharvari Baet
Devdutt Kulkarni

www.it-ebooks.info
About the Author

Rick Golden sat in the computer lab at SUNY Fredonia and completed his first CAI tutorial
for programming in APL. It was the summer of 1972; he was nine years old.

Most of the programming that he has done since then has been in Algol-based languages
such as PL/I, FORTRAN, BASIC, Pascal, C, C++, C#, Objective C, and Java. He did occasionally
write code in languages such as APL, FORTH, LISP, and Scheme; however, he could not find
an employer that would actually pay him to develop solutions using those non-structured
languages. In recent years he has had more success introducing organizations to scripting
languages such as Python, Perl, TCL, Ruby, Groovy, and Node.js.

He also had the privilege to work in many different domains applying leading technologies
through each cutting-edge wave of structured programming, architectural frameworks,
and design patterns. He has championed distributed computing, scripting languages, SOA,
browser applications, CMS, ESBs, web services, nosql and map-reduce, top-down structured
approach, UML, use cases, XP - extreme programming, iterative development, and agile
development. And, he is still moving forward.

Now, as he approaches his 40th year as a programmer, software architect, and product
manager—a career that has spanned eighty percent of his life. He greatly enjoys guiding and
coaching the next generation of programmers and software architects—awakening others to
the same joy and passion for computing that he has had for the past 40 years.

I'd like to thank my family for giving me the space to complete this book.
They have always been supportive and remain my biggest fans.
I'd also like to thank my colleagues Corny, David, Darren, and Pete who have
always been available for advice and snippets of code when I needed them;
Greg, John, and Steve who were long ago my interns but still remain sources
of inspiration; and Ingo who is now and will remain always my muse.
And, most importantly, I'd like to thank my father, George H. Golden Jr.,
who sat me down in front of a teletype when I was eight years old and
showed me how to play Hunt The Wumpus. Not only did my dad introduce
me to computers and computer programming, he also introduced me to
the Raspberry Pi. Without his encouragement, I could not have written
this book.

www.it-ebooks.info
About the Reviewers

Hector Cuesta-Arvizu provides consulting services for software engineering and data
analysis with over 8 years of experience in a variety of industries including financial services,
social networking, e-learning, and Human Resources. He is a Raspberry Pi enthusiast.

Hector holds a Bachelor's Degree in Informatics and a Master's Degree in Computer


Science. His main research interests lie in Machine Learning, High Performance Computing,
Simulation, and Visualization. He has published 12 Scientific Papers in International
Conferences and Journals.

You can follow him on Twitter at https://twitter.com/hmCuesta.

Shea Silverman has been using computers since he was two years old. He has always
been drawn to technology, video games, education, and the public sector. He is currently a
member of the Orlando hackerspace FamiLAB, an alumni of the University of Central Florida,
and is working towards his Masters in Nonprofit Management.

I would like to thank my family and friends for their ongoing support in
my endeavors. I would also like to thank Liz, Eben, and the Raspberry
Pi Foundation for the creation of the Raspberry Pi, and the wonderful
community that has flourished since its release.

www.it-ebooks.info
www.PacktPub.com

Support files, eBooks, discount offers and more


You might want to visit www.PacktPub.com for support files and downloads related to
your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
service@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
and eBooks.

TM

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can access, read and search across Packt's entire library of books.

Why Subscribe?
ff Fully searchable across every book published by Packt
ff Copy and paste, print and bookmark content
ff On demand and accessible via web browser

Free Access for Packt account holders


If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view nine entirely free books. Simply use your login credentials for
immediate access.

www.it-ebooks.info
Table of Contents
Preface 1
Chapter 1: Installation and Setup 7
Introduction 7
Preparing for the initial boot 9
Printing a case – the Punnet 18
Setting up new SD cards 22
Image writer for Windows cards (Win32DiskImager) 25
Convert and copy for Linux (dd) 27
Creating SD cards with BerryBoot 30
Booting the "official" Raspbian Linux distribution 37
Shutting down the Raspberry Pi (shutdown) 41
Chapter 2: Administration 45
Introduction 45
Configuring remote access (raspi-config) 46
Configuring memory usage (raspi-config) 50
Remote access (SSH) 53
Remote access (PuTTY) 58
Changing the login password (passwd) 62
Chapter 3: Maintenance 65
Introduction 65
Updating the operating system (apt-get) 66
Searching for the software packages (apt-cache) 74
Installing a package (apt-get) 75
Package management (aptitude) 79
Reading the built-in documentation (man) 83
Reading the built-in documentation (info) 86

www.it-ebooks.info
Table of Contents

Chapter 4: File Sharing 91


Introduction 91
Mounting USB drives (pmount) 92
Sharing folders from other computers (mount.cifs) 99
Automounting USB disks at boot (/etc/fstab) 103
Automounting a shared folder at boot 110
Creating a file server (Samba) 114
Sharing an attached USB disk via Samba 122
Accessing another computer's files (smbclient) 125
Chapter 5: Advanced Networking 133
Introduction 133
Creating a firewall with ufw 133
Connecting to the desktop remotely (xrdp) 137
Installing a web server (Apache, lighttpd, Nginx) 142
Installing a wiki (MediaWiki) 154
Creating a wireless access point with hostapd 170
Index 185

ii

www.it-ebooks.info
Preface
Back in 2006, Eben Upton and his colleagues at the University of Cambridge's Computer
Laboratory noticed a disturbing trend—interviewees for degree course placement did not know
enough about what a computer is or how it worked. So, he set out to design an inexpensive
computer that would inspire kids to experiment with computers at home—a similar to the
hobbyist computers, such as the Apple II, Amiga, and Commodore 64 computers of a
generation before. On February 29, 2012, the first batch of 10,000 Raspberry Pis sold out
within a few minutes, crashing the websites of the stores selling them. By the end of 2012
more than 500,000 Raspberry Pis have been sold and not just to school children.

The Raspberry Pi credit-card-sized single-board computer costs about $35 and has as much
computing power as the early Xbox—more than enough power for playing games, running a
home media center, a file server, a website, a small database, or a wireless access point. Its
Broadcom System on a chip (SoC) architecture includes a powerful graphics processing
unit (GPU), and the single-board design includes a network port, an HDMI connection, two
USB ports, an SD card slot, and 512 MB of memory. There is more power and there are more
features available on this small, inexpensive computer today than there were on the expensive
desktop computers that ran the original Windows operating system.

This book contains recipes that take advantage of the power and features of the Raspberry Pi
to create a number of practical solutions that can be realized without programming—solutions
that anyone with minimal computer skills can apply in their home or office. This book is not
about educating or inspiring children to learn computer programming. This book is for parents,
hobbyists, and computer geeks who would like to learn more about the Raspberry Pi's "official"
Raspbian Linux operating system and the advanced networking solutions that are available
for the Raspberry Pi today.

www.it-ebooks.info
Preface

What this book covers


Chapter 1, Installation and Setup, introduces the Raspberry Pi, explains how to download
and install fresh images of popular Raspberry Pi distributions, and describes how to set up
for the initial boot.

Chapter 2, Administration, contains a collection of recipes for the Raspberry Pi that cover the
basic administration of the Raspberry Pi including how to access the Raspberry Pi remotely
using Secure Shell.

Chapter 3, Maintenance, has recipes that are for the basic maintenance of the Raspberry Pi
including installing and updating new software and accessing the built-in documentation.

Chapter 4, File Sharing, has recipes that are for sharing files with other computers on the
same local network including automounting disks and installing a file server.

Chapter 5, Advanced Networking, has recipes that are for advanced networking solutions
including setting up a webserver, a wiki, and a wireless access point.

What you need for this book


For the recipes in this book you will need the following:

ff A Raspberry Pi
ff A 5V power supply (the Raspberry Pi does not usually come with one)
ff A keyboard
ff A mouse
ff A display (a TV or a monitor)
ff A handful of SD cards
ff USB devices ( such as an external disk)
ff A network connection

Some recipes require:

ff An external USB disk


ff A USB wireless network adapter

You may also want to purchase a case and a powered USB hub. They will help you protect your
Raspberry Pi. The case protects the Raspberry Pi from the elements, and the powered USB
hub protects it from the power drain that results from connecting too many devices.

www.it-ebooks.info
Preface

The recipes in the first three chapters do not require any additional devices other than the
Raspberry Pi and a network connection. The recipes in Chapter 4, File Sharing, show how to
connect a USB disk to the Raspberry Pi. And in Chapter 5, Advanced Networking, the final
recipe shows how to use a USB wireless network adapter to turn the Raspberry Pi into a
wireless access point.

For most of the recipes in this book, you will just need the Raspberry Pi, a power supply, and a
network connection. After completing the recipes in Chapter 2, Administration, the Raspberry
Pi can be accessed remotely and does not require a display, keyboard, or mouse.

Who this book is for


This book is for those who would like to use the Raspberry Pi for more than just an
educational tool or an experimenter's toy.

The book is also intended to turn the beginning Raspberry Pi user into an accomplished
Linux administrator. Even an advanced Linux user will find the recipes in this book useful
as a reference for creating advanced networking solutions with the Raspberry Pi.

The recipes in this book begin simply leading the reader through the installation and basic
administration of the Raspberry Pi. As the book progresses, the solutions become more
advanced, building on the knowledge gained from previous recipes. The final chapter contains
a number of advanced networking solutions.

Although inexpensive, the Raspberry Pi has enough power for a number of practical solutions
both at home and at the office. This book is for those who would like to use the Raspberry Pi
in practical solutions, not just as an educational toy.

Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of
information. Here are some examples of these styles and an explanation of their meaning.

Code words in text are shown as follows: "This recipe shows how to update the Raspberry Pi
using the apt-get command."

Any command-line input or output is written as follows:


$ sudo apt-get install pianobar

New terms and important words are shown in bold. Words that you see on the screen, in
menus or dialog boxes for example, appear in the text like this: "Clicking the Next button
moves you to the next screen."

www.it-ebooks.info
Preface

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or may have disliked. Reader feedback is important for us to
develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to feedback@packtpub.com,


and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or
contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to
get the most from your purchase.

Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do
happen. If you find a mistake in one of our books—maybe a mistake in the text or the
code—we would be grateful if you would report this to us. By doing so, you can save other
readers from frustration and help us improve subsequent versions of this book. If you find
any errata, please report them by visiting http://www.packtpub.com/submit-errata,
selecting your book, clicking on the errata submission form link, and entering the details of
your errata. Once your errata are verified, your submission will be accepted and the errata
will be uploaded on our website, or added to any list of existing errata, under the Errata
section of that title. Any existing errata can be viewed by selecting your title from
http://www.packtpub.com/support.

www.it-ebooks.info
Preface

Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt,
we take the protection of our copyright and licenses very seriously. If you come across any
illegal copies of our works, in any form, on the Internet, please provide us with the location
address or website name immediately so that we can pursue a remedy.

Please contact us at copyright@packtpub.com with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions
You can contact us at questions@packtpub.com if you are having a problem with any
aspect of the book, and we will do our best to address it.

www.it-ebooks.info
www.it-ebooks.info
Installation and Setup
1
In this chapter we will cover:

ff Preparing for the initial boot


ff Printing a case – the Punnet
ff Setting up new SD cards
ff Image writer for Windows cards (Win32DiskImager)
ff Convert and copy for Linux (dd)
ff Creating SD cards with BerryBoot
ff Booting the "official" Raspbian Linux distribution
ff Shutting down the Raspberry Pi (shutdown)

Introduction
This chapter introduces the Raspberry Pi and explains how to download and install fresh
images of popular Raspberry Pi distributions and how to set them up for the initial boot.

Developed by Raspberry Pi Foundation in the U.K. for promoting the teaching of basic
computer science in schools, the Raspberry Pi is a single-board computer about the
size of a credit card. The Raspberry Pi is based on a Broadcom BCM2835 System on
a Chip (SoC) that includes a 700 MHz ARM1176JZF-S processor. The Raspberry Pi is well
designed for experimenting with computers and learning computer programming. Its eight
General-Purpose Input/Output (GPIO), I2C bus, and SPI bus also make it an ideal choice
for experimenting with computer hardware and peripheral devices.

www.it-ebooks.info
Installation and Setup

The Raspberry Pi also has two USB ports, an onboard Ethernet network connector (RJ45),
both HDMI and Composite RCA video outputs, and audio output via a 3.5 mm jack or over
HDMI—the same type of high-speed connections that are found on most desktop computers
and laptops. With these standard peripheral connections the Raspberry Pi has the potential
to be much more than just an educational tool or an experimenter's toy.

The preceding image shows two Raspberry Pis with their original packaging.

The Raspberry Pi on the left-hand side comes from RS Components Ltd


(www.rs-online.com). The one on the right-hand side comes from Premier
Farnell/element 14 (www.element14.com). Both were shipped in electrostatic
bags and contained only simple instructions on how to begin experimenting with
the Raspberry Pi.

Although the Raspberry Pi was designed for experimenting, this book is about using the
Raspberry Pi in practical networking solutions both at home and at the office. This chapter
begins by listing the components you will need, in addition to the Raspberry Pi, for practical
application of the solutions described in this book. The first recipe explains how to create a
simple yet sturdy case for the Raspberry Pi, out of paper. The remaining recipes describe
how to download, install, and configure a number of common Raspberry Pi-optimized
operating systems.

Once you've completed this chapter, you will have created a simple case to protect your
Raspberry Pi; you will have downloaded, installed, and configured an operating system for
your Raspberry Pi; and you will have booted your Raspberry Pi for the first time. You will also
understand how to create application cartridges for your Raspberry Pi.

www.it-ebooks.info
Chapter 1

Preparing for the initial boot


This recipe explains which components are needed in addition to the Raspberry Pi before it
can be powered on for the first time; that is, the components needed for the initial boot.

The Raspberry Pi is shipped without a case and without a power supply. There is no keyboard.
There is no monitor. Depending on how you intend to use the Raspberry Pi, you will need
additional components. As a minimum, you will need a power supply, an SD card, and a
network cable.

An HDMI cable (or composite video cable), a USB keyboard, and a USB mouse are needed
if you'd like to use the Raspberry Pi as you would use a desktop computer. You may wish
to attach additional peripherals depending on how you intend to use the Raspberry Pi.
This recipe suggests a number of different hardware combinations.

After completing this recipe you will be ready for the initial boot of your Raspberry Pi.

The preceding image shows a Raspberry Pi without a case, an SD card, and a power supply.

Getting Ready
The following are the basic components required for this recipe:

ff Raspberry Pi
ff Class 4 SD card of 4 GB (or greater)
ff 5V micro USB power supply
9

www.it-ebooks.info
Installation and Setup

The Raspberry Pi draws its power from a 5V micro USB power supply and needs an SD card
for its operating system. A single 4-GB SD card has more than enough room for hosting the
operating system, as well as many useful applications. While no further components are
required to boot the Raspberry Pi, the networking solutions in this book will require
additional components.

The preceding image shows a Raspberry Pi with an SD card, a network, and power cables.

The essential networking required for this recipe is a network connection. For the simplest
networking solutions, the only additional component that the Raspberry Pi needs is a network
connection. Once the operating system on the SD card has been configured, remote logins to
the Raspberry Pi are possible.

10

www.it-ebooks.info
Chapter 1

The media center required is a HDMI television or monitor. For the simplest media solutions,
in addition to the basic components, the only additional component that the Raspberry Pi
needs is an HDMI connection. Both audio and video can be streamed through the Raspberry
Pi's HDMI connection. There is enough room on a 4 GB SD card to store a small collection of
music and video files, in addition to the operating system.

The preceding image shows a Raspberry Pi in the Punnet with monitor, keyboard, and mouse.

The interactive whiteboard requires the following components:

ff HDMI television or monitor


ff Bluetooth adapter
ff Bluetooth keyboard
ff Bluetooth mouse

11

www.it-ebooks.info
Installation and Setup

The Raspberry Pi has two USB ports, with enough power to support low-power devices such as
a USB Bluetooth adapter, a simple keyboard, or a mouse.

The network hub requires the following components:

ff Powered USB hub


ff USB LAN adapter
ff USB WLAN adapter
ff USB hard drive
ff USB printer

When using the Raspberry Pi as a firewall or wireless access point, an additional LAN or WLAN
adapter is required. If the adapter is powered by the USB connection, an additional powered
USB connector will be required for the adapter to operate reliably.

The teleconferencing center requires the following components:

ff Powered USB hub


ff USB keyboard
ff USB mouse
ff USB camera

USB devices that require power over the USB connection, such as multimedia keyboards, gamer
mice, cameras, printers, or external hard drives (including thumb drives), should be attached
indirectly via a powered USB hub instead of directly attaching them to either of the Raspberry
Pi's two USB ports. For greater reliability, the USB ports on the Raspberry Pi should typically be
connected to powered USB hubs instead of directly connecting them to USB devices.

Gaming requires the following components:

ff Powered USB hub


ff USB game controllers

The Raspberry Pi is an excellent gaming platform whether for creating games, for playing
single-player console games, or for playing multiplayer network games. Many of the older
text-based games can be played on the Raspberry Pi with just a keyboard or via a remote
login. However, USB game controllers can also be connected to the Raspberry Pi to further
enrich the gameplay of multimedia action games.

12

www.it-ebooks.info
Chapter 1

The preceding image shows a Raspberry Pi in the Punnet lying on a USB hub with
devices attached.

The initial setup requires the following:

ff Raspberry Pi
ff Class 4 SD card of 4 GB (or greater)
ff 5V micro USB power supply
ff Powered USB hub
ff Network cable
ff HDMI or DVI monitor
ff HDMI to DVI adapter (optional)
ff Speakers
ff Keyboard
ff Mouse

13

www.it-ebooks.info
Installation and Setup

A power supply, preformatted SD card, monitor, keyboard, and mouse are the bare minimum
components needed for an initial setup. A DVI monitor can be attached to the Raspberry
Pi using an HDMI-to-DVI adapter. Both the HDMI-to-DVI adapter and the speakers can be
replaced with a single HDMI cable connected directly to an HDMI television. When connected
with HDMI, the television will output audio as well as video. The yellow RCA connector also
provides video output for older televisions.

The preceding image is a schematic diagram of the Raspberry Pi from Raspberry Pi


Foundation (http://www.raspberrypi.org).

How to do it...
The following are the steps for booting the Raspberry Pi:

1. Build a case (optional).


2. Download the latest disk image.
3. Write the disk image to an SD card.
4. Insert the formatted SD card into the Raspberry Pi.
5. Attach a display to either the video connector or to the HDMI connector.
6. Attach a USB board and a USB mouse to the USB ports.
7. Attach a 5V micro USB power supply to the Raspberry Pi, and make sure it boots.
8. Finally, shut down the Raspberry Pi.

14

www.it-ebooks.info
Chapter 1

How it works…
The Raspberry Pi does not come with a case. While it is not necessary for experimenting, you'll
probably want a case for protecting the Raspberry Pi. The next recipe in this chapter shows
how to make a case from paper (see the Printing a case – the Punnet recipe given next).

Before you can boot the Raspberry Pi, you'll need an SD card with a bootable disk image
on it. The "official" Raspbian Linux image for the Raspberry Pi is downloadable from
http://www.raspberrypi.org/downloads.

Once the disk image has been downloaded, it needs to be written to an SD card (see the
Setting up new SD cards recipe given later).

After the SD card has been prepared and inserted into the Raspberry Pi, the display, keyboard,
and mouse can be connected to the Raspberry Pi; and it is ready for booting (see the Booting
the "official" Raspbian Linux distribution recipe given later).

When it is time to turn the Raspberry Pi off, the operating system must first be shut down—the
opposite of booting (see the Shutting down the Raspberry Pi (shutdown) recipe given later).

There's more…
The Raspberry Pi is a very low-cost, single-board computer ($35 for the current model). It is
sold "bare bones" and requires a power supply, a preformatted SD card to hold its operating
system, and a keyboard and a display before it can do anything useful. However, it does
have a number of standard I/O connections that will enable it to connect to a large variety
of devices.

The following is the list of interfaces:

ff Power (5V at 700mA): The Raspberry Pi has a micro USB power connector that
should be connected directly to a power supply, neither to the USB port on a
computer nor to a USB hub.
ff Preformatted SD card (class 4): The Raspberry Pi is designed to boot from a
preformatted SD Card (4 GB or greater is recommended).
ff GPIO: Analog and digital I/O connection for expansion and experimenting.
ff RCA video (composite video): The Raspberry Pi can be used with older televisions
that have a composite video input.
ff Audio output (3.5 mm jack and stereo): The Raspberry Pi does not have an audio
input connector; however, a USB mic or sound card can be added.
ff LEDs: These are disk, power, and network traffic indicators. When these LEDs are
flashing, the Raspberry Pi is actively processing.

15

www.it-ebooks.info
Installation and Setup

ff USB 2.0 (two ports): There is limited power available on these ports. Devices
connected to the Raspberry Pi via USB should have their own power supply or
they should be connected indirectly via a powered USB hub.
ff Network (10/100 wired Ethernet RJ45): The onboard networking competes for
bandwidth with the attached USB devices.
ff HDMI (1080p30): This may be used for both video and audio output. It cannot be
used at the same time as the RCA video.

The following is the list of onboard components:

ff System on chip
‰‰ Broadcom BCM2835 media processor
‰‰ CPU core – ARMv6 architecture; ARM11 core at 700MHz
‰‰ GPU core – 24 GFLOPS of compute power
‰‰ Memory – 512 MB SDRAM stacked on media processor

ff LAN9512
‰‰ 10/100 Mb Ethernet (Auto-MDIX)
‰‰ 2x USB 2.0

The recommended accessories include a powered USB hub as it has the following advantages:

ff It has its own power supply separate from the Raspberry Pi's power supply
ff It has enough power to support the attached devices

However, the Raspberry Pi has some power supply problems. It is difficult to say how much
power is actually needed by the Raspberry Pi, as it varies depending on how busy it is and
which peripherals are connected. However, there have been problems reported that seem
related to an inadequate supply of power. These problems are reduced or eliminated when the
power supply for the Raspberry Pi produces at least 700mA at 5V and when USB devices are
connected indirectly through a powered USB hub.

The following are the symptoms:

ff Unreliable network connection


ff Keyboard does not work after the GUI (X Window) is started
ff Intermittent SD card errors

16

www.it-ebooks.info
Chapter 1

The following are the causes:

ff Power supply is rated less than 700mA


ff Complex keyboard or keyboard with built-in USB hub (for example, Apple Macintosh
keyboards)
ff A USB hard disk (or thumb drive) is attached directly to the Raspberry Pi instead of
indirectly through a powered USB hub

The following are the solutions:

ff Use a good quality regulated power supply of at least 700mA at 5V


ff Only connect simple USB devices directly to the Raspberry Pi
ff Connect USB devices to a powered USB hub, and only connect the hub
directly to the Raspberry Pi

See also
ff Raspberry Pi
http://en.wikipedia.org/wiki/Raspberry_pi
A detailed Wikipedia article about the Raspberry Pi.

ff DesignSpark – Raspberry Pi
http://www.designspark.com/theme/raspberrypi.

ff element14 Raspberry PI Group


http://www.element14.com/community/groups/raspberry-pi
element14 is one of two distributors for the Raspberry Pi. The Raspberry Pi group
on the element14 website has over 7,000 members, over 600 topics in the forums,
technical documentations, and video tutorials.

ff The MagPi
http://www.themagpi.com
The MagPi is a magazine for Raspberry Pi users. Monthly issues are available online.

ff The Raspberry Pi website


http://www.raspberrypi.org
The official Raspberry Pi website contains history, news, and documentation for the
Raspberry Pi as well as a quick start guide, a forum, a wiki, and a download area.

17

www.it-ebooks.info
Installation and Setup

ff RPi Hub – eLinux.org


http://elinux.org/R-Pi_Hub
The RPi Hub is the Embedded Linux community's wiki page for Raspberry Pi users.
This wiki page has a buying guide, a beginners' guide, a list of verified peripherals,
and a list of Raspberry Pi distributions larger than what is found on the official
website. It is a wealth of well-organized, up-to-date information.

Printing a case – the Punnet


This recipe explains how to make a simple case out of paper.

The Raspberry Pi is a single-board computer without a case. Cases are available from
a number of retailers (see the See also section of this recipe for a few suggestions).
However, the Raspberry Pi is normally sold without a case.

For general experimentation and setup, the Raspberry Pi does not really need a case.
It will function perfectly well sitting on top of the box that it came in, or on top of a powered
USB hub. Although for regular use, as part of one of the solutions in this book, a case
is recommended.

Once you finish with this recipe, you will have a simple protective case for your Raspberry Pi.

The preceding image shows the Punnet printed and ready to use.

18

www.it-ebooks.info
Chapter 1

Getting ready
The Punnet is a printable card case for the Raspberry Pi. It requires less than an hour to
assemble; however, a couple of hours should be allowed for the glue to set firmly before use.

A printable PDF template of the Punnet can be found on the Raspberry Pi Foundation website
(http://www.raspberrypi.org/archives/1310).

You will need the following components:

ff A Raspberry Pi
ff The Punnet PDF file (see the link given in the See also section)
ff Heavy card stock paper
ff White glue
ff Cellophane tape
ff A straightedge or ruler
ff A hobby knife

How to do it...
The following are the steps for creating a Raspberry Pi case out of paper:

1. Print the PDF file on heavy card stock paper, or print the file on copy paper and then
glue the copy paper to the heavier paper.
2. Carefully cut out the Punnet. Use the hobby knife with the straightedge as a guide for
cutting straight lines.
3. Use the straightedge to score and crease the folds. This will make assembly easier.

19

www.it-ebooks.info
Installation and Setup

4. Fold the Punnet around the Raspberry Pi and glue it, as shown in the previous
screenshot. Apply the glue sparingly—too much glue causes the paper to warp.

The preceding image shows the Punnet in use. A printed Punnet was glued to pink card stock
before folding. The card stock added strength and stability to the case.

How it works…
The Punnet is a simple paper box made from a single sheet of paper with cutouts marked that
align with the Raspberry Pi's connectors. The 50-mm scale printed on the page can be used
to validate the dimensions of the printout. Turn off any Scale to fit feature of the printer to
ensure that the page is printed at 100 percent. Once the page is printed, the scale printed on
the page can be measured to see if it is 50-mm long. If it is not 50-mm long, adjust the scale
in the printer properties and try printing the page again.

The PDF page format is designed for A4 paper (used in Europe); however, it should print fine
on 8½ x 11" paper (used in the USA) if the page is printed with actual size. The printed side
of the page will become the outside of the Punnet.

20

www.it-ebooks.info
Chapter 1

There's more…
It is easier to assemble the Punnet around a Raspberry Pi than trying and putting a Raspberry
Pi in a pre-assembled Punnet. First score the dotted lines so that it is easier to fold them,
then set the Raspberry Pi on the Punnet. Fold up the tabs and spread a small amount of glue
on the outside of each tab. Finally, fold up the sides around the Raspberry Pi and glue them
together. Use cellophane tape to strengthen the corners.

A straightedge or ruler is a useful tool for cutting and folding on straight lines; and a hobby
knife works better than scissors. White glue works well, if used sparingly.

Decorating the Punnet is easier before it is assembled, while it is still uncut.

Don't forget to cut a hole in the top to let cool air in. The Raspberry Pi can overheat if it is
kept fully enclosed.

A number of commercial cases are available for the Raspberry Pi (see the links give next).

The preceding image shows three different Raspberry Pi cases.

21

www.it-ebooks.info
Installation and Setup

See also
ff The Punnet
http://www.raspberrypi.org/archives/1310
This is the original article featuring a home printable cardboard case for the
Raspberry Pi.

ff Raspberry box
http://www.amazon.com/shops/ATLOHWI71UDEX
This transparent acrylic box lets the inner beauty of the Raspberry Pi shine through.
From Spain, the retailer also makes classical guitars.

ff Pi Holder
http://www.piholder.com
The Pi Holder is a solid aluminium case with cooling pillars in the top half that attach
directly to the three heat-emitting IC chips on the Raspberry Pi. This case keeps the
Raspberry Pi cool and protected—a good choice for production use.

ff Other cases on the Raspberry Pi website


http://www.raspberrypi.org/archives/tag/cases
This article features a number of very creative cases for the Raspberry Pi. Some of
the cases on this site are very original.

ff Embedded Linux – RPi cases


http://www.elinux.org/RPi_Cases
The Embedded Linux community maintains a long list of Raspberry Pi cases. The list
features blueprints, photographs, and links to order forms.

Setting up new SD cards


The following recipes explain how to create bootable SD cards from downloaded disk images
using Win32DiskImager.exe, dd, and BerryBoot.

The Raspberry Pi does not come with an operating system. Before the Raspberry Pi can boot,
it needs an SD card with the operating system installed. Pre-installed SD cards are available
for purchase; however, downloading and installing an operating system's image is not difficult.

22

www.it-ebooks.info
Chapter 1

How to do it…
The following are the steps on how to write an image to the SD card:

1. Download the "official" Raspbian Linux image from


http://www.raspberrypi.org/downloads.
2. Write the image to an SD card.

How it works…
The "official" Raspbian Linux operating system image can be downloaded from the
Raspberry Pi Foundation website (http://www.raspberrypi.org/downloads).
Other operating system images can be found on the Embedded Linux community's wiki
page (http://elinux.org/RPi_Distributions).

Once the operating system is downloaded, you'll need to write it to an SD card.

If you are writing the SD card from a Windows computer, use Win32DiskImager.exe
(see the Image Writer for Windows cards (Win32DiskImager) recipe).

If you are using the Linux operating system or Mac OS to write the image to the SD card,
use the dd command-line utility (see the Convert and copy for Linux (dd) recipe).

If you'd like to try a simpler way of installing the Raspberry Pi that works on any computer
that can copy files to a formatted SD card, use BerryBoot (see the Creating SD cards with
BerryBoot recipe).

See also
ff The Raspberry Pi website – downloads
http://www.raspberrypi.org/downloads
This is the location of the "official" versions of Raspberry Pi optimized GNU Linux
distributions. Currently, Raspberry Pi Foundation recommends four distributions
of the Linux operating system, as follows:
‰‰ Raspbian "Wheezy"
‰‰ Soft-float Debian "Wheezy"
‰‰ Arch Linux ARM
‰‰ RISC OS

23

www.it-ebooks.info
Installation and Setup

The Soft-float Debian distribution is a slower distribution that has not been optimized
to use the Raspberry Pi's hardware-accelerated floating-point calculations. It has
been made available for use with software that has not been optimized yet (such
as Oracle's JVM). The other distributions are listed next with links to their original
maintainers' websites.

ff Raspbian
http://www.raspbian.org
Raspbian is a Linux operating system distribution based on Debian optimized for
the Raspberry Pi and comes with more than 35,000 packages pre-compiled for the
Raspberry Pi.

ff archlinux | ARM – Raspberry Pi


http://archlinuxarm.org/platforms/armv6/raspberry-pi
Arch Linux ARM is a simple, lightweight distribution for shaping your own system. This
distribution is built directly from source code and is optimized for the Raspberry Pi.
It offers rolling releases of bleeding edge software; however, it is a minimalist base
rather a complete desktop system.

ff RISC OS
http://www.riscosopen.org/
The RISC OS was designed in Cambridge, originating from the same
team that designed the ARM processor, and was originally released in 1987.

ff Embedded Linux – Rpi Distributions


http://elinux.org/RPi_Distributions
The Embedded Linux community maintains an excellent wiki page on Raspberry Pi
operating system distributions. The wiki page has a comparison table and links to
downloadable image files. Many of these distributions are specialized for specific
use – as a home theater, as firewall, as a development platform, or as a very
inexpensive desktop PC.

ff GNU
http://www.gnu.org
The homepage of the GNU operating system.

24

www.it-ebooks.info
Chapter 1

Image writer for Windows cards


(Win32DiskImager)
This recipe explains how to install a Raspberry Pi operating system image on an SD card using
the open source image writer for Windows – Win32DiskImager.exe.

Once you finish with this recipe, you will be able to write Raspberry Pi images to SD cards from
a Windows computer.

Getting ready
The following are the ingredients:

ff A computer running Windows with an SD card writer


ff A class 4 SD card of 4 GB (or greater)
ff A Raspberry Pi operating system's image file
ff A pre-compiled Win32DiskImager binary

The pre-compiled binary of Win32DiskImager is distributed as a ZIP file and can be


downloaded from https://launchpad.net/win32-image-writer.

How to do it...
The following are the steps for writing a disk image to an SD card on a Windows computer:

1. Download the Win32DiskImager ZIP file


(https://launchpad.net/win32-image-writer).
2. Expand the ZIP file to a folder on disk (for example, C:\Win32DiskImager).

The preceding screenshot shows the contents of the Win32DiskImager ZIP file.
25

www.it-ebooks.info
Installation and Setup

3. Download a Raspberry Pi distribution disk image


(http://www.raspberrypi.org/downloads).
4. Run Win32DiskImager.exe from the install folder.
5. Select the source image file and the target device, as shown in the
following screenshot:

The preceding screenshot shows Win32 Disk Imager being used to write the
recommended Raspbian GNU Linux distribution to an SD card.

6. Click on the Write button to copy the image to the SD card.

Writing an image to a disk takes about 5 minutes for a 2-GB image file. Once the
image is written to the SD card, the SD card may be ejected and used to boot the
Raspberry Pi.

How it works...
First, the image writer for Windows (Win32DiskImager) is downloaded and installed.

Win32DiskImager is a standalone application. Its install files can be expanded to a folder


located anywhere on the PC. Double-click on the Win32DiskImager executable file to start
the application.

Then, a Raspberry Pi disk image is downloaded.

Finally, Win32 Disk Imager is used to write the Raspberry Pi disk image to the SD card.

There's more...
The utility, Win32DiskImager, was originally written to read and write disk images for
a specific Linux distribution; since then, however, it has been generalized and is now a
popular tool for many development projects such as the Raspberry Pi.

Win32DiskImager is also an excellent backup tool! After booting and configuring the
Raspberry Pi, a backup can be made to preserve the image in case the SD card is
damaged or lost.

26

www.it-ebooks.info
Chapter 1

To make a backup perform the following steps:

1. Run Win32DiskImager.exe from the install folder.


2. Select the SD card device as the source and the image file as the target.
3. Click on the Read button to read the SD card in the form of an image on disk.

A new backup should be created after each update to the Raspberry Pi's operating system,
application software, or configuration.

See also
ff Image writer for Windows
https://launchpad.net/win32-image-writer
This utility that was originally written to read and write disk images for a specific Linux
distribution; however, since then it has been generalized and is now a popular tool for
many development projects such as the Raspberry Pi.

Convert and copy for Linux (dd)


This recipe explains how to install an operating system's image on an SD card using the
standard Linux utility, dd.

Most versions of Linux (and Mac OS) have the dd command installed. This powerful version of
the copy command (cp) can be used to write blocks of data to devices such as an SD card.

Once you finish with this recipe, you will be able to write an SD card from a Linux
(or Mac OS) computer.

Getting ready
The following are the ingredients:

ff A computer running Linux with an SD card writer


ff A class 4 SD card of 4 GB (or greater)
ff A Raspberry Pi operating system's image file

The dd utility is normally installed by default with most Linux distributions. If it is not installed,
use the appropriate Linux installation utility to install it.

All the commands in this example are executed as a privileged user (root).

27

www.it-ebooks.info
Installation and Setup

How to do it...
The following are the steps for writing a disk image to an SD card on a Linux computer:

1. Download a Raspberry Pi distribution disk image


(http://www.raspberrypi.org/downloads).
2. Excute the df command. Determine the name of the SD drive.
3. Execute the following command:
umount /dev/mmcblk0p1
Unmount the mounted disk partitions.

4. Execute the following command:


dd bs=1M if=2012-08-16-wheezy-rasbian.img of=/dev/mmcblk0
Use dd to copy the image to SD card, as shown in the following screenshot:

The preceding screenshot shows the df command being used to discover the name of the SD
card drive, the umount command being used to unmount the SD card, and the dd command
being used to write the recommended distribution to an SD card.

How it works...
First a Raspberry Pi disk image is downloaded.

Then, the name of the SD drive is discovered using the df command. The df command shows
how much disk is free on each of the mounted disk drives. The SD card was just inserted, and
its primary partition (p1) appears in this list as /dev/mmcblk0p1. The disk device is /dev/
mmcblk0.

28

www.it-ebooks.info
Chapter 1

Finally, the dd command is used to write the Raspberry Pi disk image to the SD card. The
following is the explanation for the command: dd bs=1M if=2012-08-16-wheezy-
rasbian.img of=/dev/mmcblk0:

ff Each disk block written is 1 MB (bs=1M)


ff The input file (if) is 2012-08-16-wheezy-raspbian.img
ff The output file (of) is the SD card disk device (/dev/mmcblk0)

There's more...
The utility dd is one of the core GNU utilities found in most Linux distributions. It is a low-level
utility that simply copies blocks of data from one file to another.

The previous screenshot shows an example of how the df command can be used to
determine the name of the SD drive. The first partition of the SD disk, /dev/mmcblk0p1, is
mounted at /media/A1B1-918F. Disk images cover a whole disk, not just one partition, so
the correct name of the disk drive in the previous example is /dev/mmcblk0 (notice that p1
is missing).

Before the image is copied to the SD card in the previous example, the disk partition is
unmounted (umount /dev/mmcblk0p1—notice there is no n in umount). It is a good
practice to unmount all disk partitions before formatting or overwriting a disk.

When the image is copied with the dd command:

ff if= specifies the input file (2012-08-16-wheezy-raspbian.img)


ff of= specifies the output file (/dev/mmcblk0)
ff bs= specifies the size of the blocks written to the disk

The dd utility can also be used as a backup tool. Just exchange the input file (if=) and output
file (of=).

Use the following command to create a backup using the disk from the previous example:
dd bs=1M if=/dev/mmcblk0 of=backup-2012-08-16.img

See also
ff dd (Unix)
http://en.wikipedia.org/wiki/Dd_(Unix)
This article from Wikipedia explains original application of the dd command.

29

www.it-ebooks.info
Installation and Setup

ff dd – convert and copy a file


http://manpages.debian.net/cgi-bin/man.cgi?query=dd
The Debian man page for dd.

ff dd (gnu – coreutils)
http://www.gnu.org/software/coreutils/manual/html_node/dd-
invocation.html
The GNU operating system manual reference for dd.

Creating SD cards with BerryBoot


The following recipe explains how to install an operating system on an SD card using
BerryBoot.

Unlike many Raspberry Pi distributions, BerryBoot is not a standalone disk image. It is a


bare minimum Linux operating system running as a single application that automates the
installation of the Raspberry Pi. It is by far the easiest way of selecting and installing an
operating system distribution.

BerryBoot supports the installation of multiple Linux distributions on a single SD card and is
by far the easiest way of installing an operating system for your Raspberry Pi. However, it does
require an Internet connection during setup and installation.

The installation takes place by booting the Raspberry Pi with an installer that can be easily
copied to a FAT-formatted SD card using drag-and-drop from any PC. When the Raspberry Pi
boots, the installer runs and uses the Raspberry Pi's network connection to download the
latest distribution of selected operating systems.

Getting ready
You will need the following:

ff An initial Raspberry Pi setup (see the Preparing for the initial boot recipe)
ff The latest berryboot.zip file (see the link given in the See also section
of this recipe)
ff A class 4 SD card of 4 GB (or greater)
ff A network connection

30

www.it-ebooks.info
Chapter 1

The Raspberry Pi needs to be connected to the Internet (via a home or office network) to
complete this recipe. During installation, the network connection is used to download the
selected distribution files. Without an Internet connection this recipe will not work.

The preceding screenshot shows the contents of the berryboot.zip file.

How to do it...
The following are the steps for creating a boot disk with BerryBoot:

1. Format the SD card as a bootable FAT disk. Use the normal disk formatting tools that
come with your PC's operating system.
2. Extract the contents of the berryboot.zip file to the newly formatted SD card.
Again, the normal archival tools that come with your PC will do the job.
3. Connect your Raspberry Pi to a network with access to the Internet.

31

www.it-ebooks.info
Installation and Setup

4. Insert the SD card in the Raspberry Pi and turn it on. This will start the BerryBoot
installation process.

The preceding screenshot shows BerryBoot's Welcome screen.

5. After the network interfaces have been detected, the Welcome dialog box
is displayed.
i. Set the appropriate video scan option (the example shows a green
overscan area indicating overscanning should be disabled).
ii. The time zone and keyboard layout are also set on the Welcome
dialog box.

The Welcome screen has video settings and locale


settings. If green bars are displayed at the top and bottom
of the screen (as in the preceding example), then the Video
mode should be set to Yes (disable overscan). This screen
also contains locale settings for choosing a time zone and
a keyboard layout. Click on the OK button to continue.

32

www.it-ebooks.info
Chapter 1

The preceding screenshot shows BerryBoot's Disk selection screen.

6. The Disk selection dialog box can be used to select an installation disk other than
the SD card. The target disk may be formatted in one of the following three ways:
‰‰ B-tree file system (BTRFS) for scalable storage
‰‰ ext4 – with discard flag set for SDD disks
‰‰ ext4 – no discard is the default

Even though the installation uses an external


disk, the SD card is still required to boot.

The preceding screenshot shows BerryBoot's Add OS screen.


33

www.it-ebooks.info
Installation and Setup

7. After the disk is formatted, BerryBoot downloads the list of available operating
system images. The Add OS dialog box is used to select which operating system
will be downloaded and installed next.

The preceding screenshot shows BerryBoot's BerryBoot menu editor screen.

8. The BerryBoot menu editor screen is used to add additional operating systems and
manage those that have already been installed. All the installed images will appear in
the BerryBoot boot menu.

‰‰ The Add OS button is used to add another operating system to the boot
menu (and repeat previous step)
‰‰ The Edit button is used to change the name of the image displayed on the
boot menu and to configure the memory split
‰‰ The Clone button duplicates the current image in the boot menu
‰‰ The Export button can be used to export the current disk image to an
external disk
‰‰ The Delete button deletes the current operating system from the boot menu
‰‰ The Make Default button can be used to select which image will boot
by default
‰‰ The Exit button is used to reboot the Raspberry Pi

34

www.it-ebooks.info
Chapter 1

How it works...
First an SD card is formatted as a bootable FAT disk (using the utility of your choice). Then the
BerryBoot installation files are copied to the disk. No special image writers are required! Just
drag-and-drop all the unarchived files onto the SD card.

Once all the installation files are copied to the newly formatted SD card, the disk can
be safely ejected and inserted into an unpowered Raspberry Pi. When the power cord is
connected to the Raspberry Pi, the Raspberry Pi will boot automatically into the BerryBoot
installation application.

After booting, the Raspberry Pi tries to detect all attached network cards. The installation
application can detect many modern wireless USB network cards; however, only a limited
number are actually configurable by the application. Once the network has been detected
(and selected), the Welcome screen is displayed.

The BerryBoot install application will then detect any attached USB disk devices (or network
storage). The installation application will permit the operating system to be installed on a disk
other than the SD card. However, the Raspberry Pi will still need the BerryBoot SD card to
boot. The Raspberry Pi will not boot from any other device. Choose mmcblk0 to format the SD
card. For most uses, the ext4 filesystem is the best choice. The B-tree file system (BTRFS)
has advanced features that are not covered in this book. Choose ext4 – with discard
flag set when formatting the SD card.

After the disk is formatted, the Add OS screen appears with a selection of Raspberry
Linux distributions. There are distributions for using the Raspberry Pi as a media center
(OpenELEC), as a classroom workstation (LTSP thin client BerryTerminal), and as a web
server (BerryWebserver). There are also alternative Linux distributions (Puppy Linux
and Sugar). And, of course, the "official" Raspbian Linux distribution is also included.

Once a Linux distribution has been chosen, it is downloaded and added to the boot menu.
Choosing Exit from the BerryBoot menu editor screen reboots the Raspberry Pi. After reboot,
the downloaded distributions are displayed on the boot menu and the user can select which
distribution to boot.

Application cartridges
Each of the recipes in this book could be used to create an "application cartridge".

An application cartridge is like a game cartridge that is plugged into a game console, ready
to play. The only difference is an application is stored on the cartridge instead of a game. So
when the application cartridge is plugged into the Raspberry Pi, an application is started and
is ready to use.

35

www.it-ebooks.info
Installation and Setup

Using application cartridges, the Raspberry Pi can easily be repurposed just by switching the
cartridge (the SD card). After shutting down and turning off the Raspberry Pi, the current SD
card in the Raspberry Pi could be replaced with another SD card that has a different image
installed on it – easily switching the Raspberry Pi from one purpose to another.

Write a multimedia home theatre distribution, for example OpenELEC or Raspbmc on one SD
card to create a home theatre application cartridge. Write an IPFire image on another SD card
to create a firewall application cartridge. A Berry Terminal image could be used to create an
application cartridge for client access to a terminal server; or recipes from this book could be
used to create application cartridges for a file server, a web server, or a wireless access point.

With a library of application cartridges, a Raspberry Pi can serve multiple purposes.

See also
ff BerryTerminal
http://www.berryterminal.com
This Linux distribution turns the Raspberry Pi into a low-cost thin client allowing users
to log in to a central Linux Terminal Server Project (LTSP) server. Thin clients can be
used to run applications from Linux and Windows servers. Thin clients are reliable,
cost-effective solutions for improving total cost of ownership (TCO) for organizations
that only require simple desktop features (schools, call centers, factories).

ff IPFire
http://en.wikipedia.org/wiki/IPFire
IPFire is a GNU Linux distribution that acts as a router and firewall. The Wikipedia
article describes the distribution in more detail. You can download IPFire from
http://www.ipfire.org/.

ff List of software based on XBMC


http://en.wikipedia.org/wiki/List_of_software_based_on_XBMC
You can find a list of software distributions that are derived from the XBMC
Media Center.

ff XMBC
http://en.wikipedia.org/wiki/XBMC
You can find a Wikipedia article describing the free and open source media player
application developed by the XBMC Foundation.

ff Installing OpenELEC on a Raspberry Pi


http://wiki.openelec.tv/index.php?title=Installing_OpenELEC_on_
Raspberry_Pi
You can find the installation instructions for putting OpenELEC on a Raspberry Pi.

36

www.it-ebooks.info
Another Random Scribd Document
with Unrelated Content
Charl. What, married to a man unable too?
O strange incontinence! Why, was thy blood
Increased to such a pleurisy of lust,[158]
That of necessity there must a vein
Be opened, though by one that had no skill
To do't?

Cast. Sir, I beseech you hear me.

Charl. Speak.

Cast. Heaven knows I am unguilty of this act.

Charl. Why? Wert thou forced to do't?

Cast. Heaven knows I was.

Charl. What villain did it?

Cast. Your uncle D'Amville.


And he that dispossessed my love of you
Hath disinherited you of possession.

Charl. Disinherited? wherein have I deserved


To be deprived of my dear father's love?

Cast. Both of his love and him. His soul's at rest;


But here your injured patience may behold
The signs of his lamented memory.
[Charlemont finds his Father's monument.
He's found it. When I took him for a ghost
I could endure the torment of my fear
More eas'ly than I can his sorrows hear. [Exit.

Charl. Of all men's griefs must mine be singular?


Without example? Here I met my grave.
And all men's woes are buried i' their graves
But mine. In mine my miseries are born,
I prithee, sorrow, leave a little room
In my confounded and tormented mind
For understanding to deliberate
The cause or author of this accident.—
A close advantage of my absence made
To dispossess me both of land and wife,
And all the profit does arise to him
By whom my absence was first moved and urged,
These circumstances, uncle, tell me you
Are the suspected author of those wrongs,
Whereof the lightest is more heavy than
The strongest patience can endure to bear. [Exit.

SCENE II.—An Apartment in D'Amville's Mansion.

Enter D'Amville, Sebastian and Languebeau.

D'Am. Now, sir, your business?


Sebas. My annuity.
D'Am. Not a denier.[159]
Sebas. How would you ha' me live?
D'Am. Why; turn crier. Cannot you turn crier?
Sebas. Yes.
D'Am. Then do so: y' have a good voice for't.
Y'are excellent at crying of a rape.[160]
Sebas. Sir, I confess in particular respect to yourself I was somewhat
forgetful. General honesty possessed me.
D'Am. Go, th'art the base corruption of my blood;
And, like a tetter, growest unto my flesh.
Sebas. Inflict any punishment upon me. The severity shall not
discourage me if it be not shameful, so you'll but put money i' my
purse. The want of money makes a free spirit more mad than the
possession does an usurer.
D'Am. Not a farthing.
Sebas. Would you ha' me turn purse-taker? 'Tis the next way to do't.
For want is like the rack: it draws a man to endanger himself to the
gallows rather than endure it.

Enter Charlemont. D'Amville counterfeits to take him for a Ghost.

D'Am. What art thou? Stay—Assist my troubled sense—


My apprehension will distract me—Stay.
[Languebeau Snuffe avoids him fearfully.
Sebas. What art thou? Speak.
Charl. The spirit of Charlemont.
D'Am. O! stay. Compose me. I dissolve.
Lang. No. 'Tis profane. Spirits are invisible. 'Tis the fiend i' the
likeness of Charlemont. I will have no conversation with Satan. [Exit.
Sebas. The spirit of Charlemont? I'll try that.
[He strikes, and the blow is returned.
'Fore God thou sayest true: th'art all spirit.
D'Am. Go, call the officers. [Exit.
Charl. Th'art a villain, and the son of a villain.
Sebas. You lie.
Charl. Have at thee. [They fight. Sebastian falls.

Enter the Ghost of Montferrers.

Revenge, to thee I'll dedicate this work.


Mont. Hold, Charlemont.
Let him revenge my murder and thy wrongs
To whom the justice of revenge belongs. [Exit.

Charl. You torture me between the passion of


My blood and the religion of my soul.
Sebas. [Rising.] A good honest fellow!

Re-enter D'Amville with Officers.

D'Am. What, wounded? Apprehend him. Sir, is this


Your salutation for the courtesy
I did you when we parted last? You have
Forgot I lent you a thousand crowns. First, let
Him answer for this riot. When the law
Is satisfied for that, an action for
His debt shall clap him up again. I took
You for a spirit and I'll conjure you
Before I ha' done.

Charl. No, I'll turn conjuror. Devil!


Within this circle, in the midst of all
Thy force and malice, I conjure thee do
Thy worst.

D'Am. Away with him!


[Exeunt Officers with Charlemont.

Sebas. Sir, I have got


A scratch or two here for your sake. I hope
You'll give me money to pay the surgeon.

D'Am. Borachio, fetch me a thousand crowns. I am


Content to countenance the freedom of
Your spirit when 'tis worthily employed.
'A God's name, give behaviour the full scope
Of generous liberty, but let it not
Disperse and spend itself in courses of
Unbounded licence. Here, pay for your hurts.
[Exit.
Sebas. I thank you, sir.—Generous liberty!—that is to say, freely to
bestow my abilities to honest purposes. Methinks I should not follow
that instruction now, if having the means to do an honest office for
an honest fellow, I should neglect it. Charlemont lies in prison for a
thousand crowns. Honesty tells me 'twere well done to release
Charlemont. But discretion says I had much ado to come by this,
and when this shall be gone I know not where to finger any more,
especially if I employ it to this use, which is like to endanger me into
my father's perpetual displeasure. And then I may go hang myself,
or be forced to do that will make another save me the labour. No
matter, Charlemont, thou gavest me my life, and that's somewhat of
a purer earth than gold, fine as it is. 'Tis no courtesy, I do thee but
thankfulness. I owe it thee, and I'll pay it. He fought bravely, but the
officers dragged him villanously. Arrant knaves! for using him so
discourteously; may the sins o' the poor people be so few that you
sha' not be able to spare so much out of your gettings as will pay for
the hire of a lame starved hackney to ride to an execution, but go a-
foot to the gallows and be hanged. May elder brothers turn good
husbands, and younger brothers get good wives, that there be no
need of debt books nor use of serjeants. May there be all peace, but
i' the war and all charity, but i' the devil, so that prisons may be
turned to hospitals, though the officers live o' the benevolence. If
this curse might come to pass, the world would say, "Blessed be he
that curseth." [Exit.

SCENE III.—Inside a Prison.

Charlemont discovered.
Charl. I grant thee, Heaven, thy goodness doth command
Our punishments, but yet no further than
The measure of our sins. How should they else
Be just? Or how should that good purpose of
Thy justice take effect by bounding men
Within the confines of humanity,
When our afflictions do exceed our crimes?
Then they do rather teach the barbarous world
Examples that extend her cruelties
Beyond their own dimensions, and instruct
Our actions to be much more barbarous.
O my afflicted soul! How torment swells
Thy apprehension with profane conceit,
Against the sacred justice of my God!
Our own constructions are the authors of
Our misery. We never measure our
Conditions but with men above us in
Estate. So while our spirits labour to
Be higher than our fortunes, they are more base.
Since all those attributes which make men seem
Superior to us, are man's subjects and
Were made to serve him. The repining man
Is of a servile spirit to deject
The value of himself below their estimation.

Enter Sebastian with the Keeper.

Sebas. Here. Take my sword.—How now, my wild swaggerer? Y'are


tame enough now, are you not? The penury of a prison is like a soft
consumption. 'Twill humble the pride o' your mortality, and arm your
soul in complete patience to endure the weight of affliction without
feeling it. What, hast no music in thee? Th' hast trebles and basses
enough. Treble injury and base usage. But trebles and basses make
poor music without means.[161] Thou wantest means, dost? What?
Dost droop? art dejected?
Charl. No, sir. I have a heart above the reach
Of thy most violent maliciousness;
A fortitude in scorn of thy contempt
(Since Fate is pleased to have me suffer it)
That can bear more than thou hast power t' inflict.
I was a baron. That thy father has
Deprived me of. Instead of that I am
Created king. I've lost a signiory[162]
That was confined within a piece of earth,
A wart upon the body of the world,
But now I am an emperor of a world,
This little world of man. My passions are
My subjects, and I can command them laugh,
Whilst thou dost tickle 'em to death with misery.
Sebas. 'Tis bravely spoken, and I love thee for't. Thou liest here for a
thousand crowns. Here are a thousand to redeem thee. Not for the
ransom o' my life thou gavest me,—that I value not at one crown
—'tis none o' my deed. Thank my father for't. 'Tis his goodness. Yet
he looks not for thanks. For he does it under hand, out of a reserved
disposition to do thee good without ostentation.—Out o' great heart
you'll refuse't now; will you?
Charl. No. Since I must submit myself to Fate,
I never will neglect the offer of
One benefit, but entertain them as
Her favours and the inductions to some end
Of better fortune. As whose instrument,
I thank thy courtesy.
Sebas. Well, come along. [Exeunt.

SCENE IV.—An Apartment in D'Amville's Mansion.

Enter D'Amville and Castabella.


D'Am. Daughter, you do not well to urge me. I
Ha' done no more than justice. Charlemont
Shall die and rot in prison, and 'tis just.

Cast. O father, mercy is an attribute


As high as justice, an essential part
Of his unbounded goodness, whose divine
Impression, form, and image man should bear!
And, methinks, man should love to imitate
His mercy, since the only countenance
Of justice were destruction, if the sweet
And loving favour of his mercy did
Not mediate between it and our weakness.

D'Am. Forbear. You will displease me. He shall rot.

Cast. Dear sir, since by your greatness you


Are nearer heaven in place, be nearer it
In goodness. Rich men should transcend the poor
As clouds the earth, raised by the comfort of
The sun to water dry and barren grounds.
If neither the impression in your soul
Of goodness, nor the duty of your place
As goodness' substitute can move you, then
Let nature, which in savages, in beasts,
Can stir to pity, tell you that he is
Your kinsman.—

D'Am. You expose your honesty


To strange construction. Why should you so urge
Release for Charlemont? Come, you profess
More nearness to him than your modesty
Can answer. You have tempted my suspicion.
I tell thee he shall starve, and die, and rot.

Enter Charlemont and Sebastian.


Charl. Uncle, I thank you.
D'Am. Much good do it you.—Who did release him?

Sebas. I. [Exit Castabella.

D'Am. You are a villain.

Sebas. Y'are my father. [Exit Sebastian.

D'Am. I must temporize.—[Aside.


Nephew, had not his open freedom made
My disposition known, I would ha' borne
The course and inclination of my love
According to the motion of the sun,
Invisibly enjoyed and understood.

Charl. That shows your good works are directed to


No other end than goodness. I was rash,
I must confess. But—

D'Am. I will excuse you.


To lose a father and, as you may think,
Be disinherited, it must be granted
Are motives to impatience. But for death,
Who can avoid it? And for his estate,
In the uncertainty of both your lives
'Twas done discreetly to confer't upon
A known successor being the next in blood.
And one, dear nephew, whom in time to come
You shall have cause to thank. I will not be
Your dispossessor but your guardian.
I will supply your father's vacant place
To guide your green improvidence of youth,
And make you ripe for your inheritance.
Charl. Sir, I embrace your generous promises.

Enter Rousard looking sickly, and Castabella.

Rous. Embracing! I behold the object that


Mine eye affects. Dear cousin Charlemont!

D'Am. My elder son! He meets you happily.


For with the hand of our whole family
We interchange the indenture[163] of our loves.

Charl. And I accept it. Yet not so joyfully


Because y'are sick.

D'Am. Sir, his affection's sound


Though he be sick in body.

Rous. Sick indeed.


A general weakness did surprise my health
The very day I married Castabella,
As if my sickness were a punishment
That did arrest me for some injury
I then committed. Credit me, my love,
I pity thy ill fortune to be matched
With such a weak, unpleasing bedfellow.

Cast. Believe me, sir, it never troubles me.


I am as much respectless to enjoy
Such pleasure, as ignorant what it is.

Charl. Thy sex's wonder. Unhappy Charlemont!

D'Am. Come, let's to supper. There we will confirm


The eternal bond of our concluded love. [Exeunt.
ACT THE FOURTH.

SCENE I.—A Room in Cataplasma's House.

Enter Cataplasma and Soquette with needlework.

Cata. Come, Soquette, your work! let's examine your work. What's
here? a medlar with a plum tree growing hard by it; the leaves o' the
plum tree falling off; the gum issuing out o' the perished joints; and
the branches some of 'em dead, and some rotten; and yet but a
young plum tree. In good sooth very pretty.
Soqu. The plum tree, forsooth, grows so near the medlar that the
medlar sucks and draws all the sap from it and the natural strength
o' the ground, so that it cannot prosper.
Cata. How conceited you are![164] But here th'ast made a tree to
bear no fruit. Why's that?
Soqu. There grows a savin tree next it, forsooth.[165]
Cata. Forsooth you are a little too witty in that.

Enter Sebastian.

Sebas. But this honeysuckle winds about this white thorn very
prettily and lovingly, sweet Mistress Cataplasma.
Cata. Monsieur Sebastian! in good sooth very uprightly welcome this
evening.
Sebas. What, moralizing upon this gentlewoman's needlework? Let's
see.
Cata. No, sir. Only examining whether it be done to the true nature
and life o' the thing.
Sebas. Here y' have set a medlar with a bachelor's button o' one side
and a snail o' the tother. The bachelor's button should have held his
head up more pertly towards the medlar: the snail o' the tother side
should ha' been wrought with an artificial laziness, doubling his tail
and putting out his horn but half the length. And then the medlar
falling (as it were) from the lazy snail and ending towards the pert
bachelor's button, their branches spreading and winding one within
another as if they did embrace. But here's a moral. A poppring[166]
pear tree growing upon the bank of a river seeming continually to
look downwards into the water as if it were enamoured of it, and
ever as the fruit ripens lets it fall for love (as it were) into her lap.
Which the wanton stream, like a strumpet, no sooner receives but
she carries it away and bestows it upon some other creature she
maintains, still seeming to play and dally under the poppring so long
that it has almost washed away the earth from the root, and now
the poor tree stands as if it were ready to fall and perish by that
whereon it spent all the substance it had.
Cata. Moral for you that love those wanton running waters.
Sebas. But is not my Lady Levidulcia come yet?
Cata. Her purpose promised us her company ere this. Sirrah, your
lute and your book.
Sebas. Well said. A lesson o' the lute, to entertain the time with till
she comes.
Cata. Sol, fa, mi, la.—Mi, mi, mi.—Precious! Dost not see mi between
the two crotchets? Strike me full there.—So—forward. This is a
sweet strain, and thou finger'st it beastly. Mi is a laerg[167] there,
and the prick that stands before mi a long; always halve your note.—
Now—Run your division pleasingly with these quavers. Observe all
your graces i' the touch.—Here's a sweet close—strike it full; it sets
off your music delicately.

Enter Languebeau Snuffe and Levidulcia.


Lang. Purity be in this house.
Cata. 'Tis now entered; and welcome with your good ladyship.
Sebas. Cease that music. Here's a sweeter instrument.
Lev. Restrain your liberty. See you not Snuffe?
Sebas. What does the stinkard here? put Snuffe out. He's offensive.
Lev. No. The credit of his company defends my being abroad from
the eye of suspicion.
Cata. Wilt please your ladyship go up into the closet? There are
those falls and tires[168] I told you of.
Lev. Monsieur Snuffe, I shall request your patience. My stay will not
be long. [Exit with Sebastian.
Lang. My duty, madam.—Falls and tires! I begin to suspect what falls
and tires you mean. My lady and Sebastian the fall and the tire, and
I the shadow. I perceive the purity of my conversation is used but
for a property to cover the uncleanness of their purposes. The very
contemplation o' the thing makes the spirit of the flesh begin to
wriggle in my blood. And here my desire has met with an object
already. This gentlewoman, methinks, should be swayed with the
motion, living in a house where moving example is so common.—
Mistress Cataplasma, my lady, it seems, has some business that
requires her stay. The fairness o' the evening invites me into the air.
Will it please you give this gentlewoman leave to leave her work and
walk a turn or two with me for honest recreation?
Cata. With all my heart, sir. Go, Soquette: give ear to his
instructions. You may get understanding by his company, I can tell
you.
Lang. In the way of holiness, Mistress Cataplasma.
Cata. Good Monsieur Snuffe!—I will attend your return.
Lang. Your hand, gentlewoman.—[To Soquette.]
The flesh is humble till the spirit move it.
But when 'tis raised it will command above it.
[Exeunt.

SCENE II.—An Apartment in D'Amville's Mansion.

Enter D'Amville, Charlemont, and Borachio.

D'Am. Your sadness and the sickness of my son


Have made our company and conference
Less free and pleasing than I purposed it.

Charl. Sir, for the present I am much unfit


For conversation or society.
With pardon I will rudely take my leave.

D'Am. Good night, dear nephew.


[Exit Charlemont.
Seest thou that same man?

Bor. Your meaning, sir?

D'Am. That fellow's life, Borachio,


Like a superfluous letter in the law,
Endangers our assurance.[169]

Bor. Scrape him out.

D'Am. Wilt do't?

Bor. Give me your purpose—I will do't.

D'Am. Sad melancholy has drawn Charlemont


With meditation on his father's death
Into the solitary walk behind the church.
Bor. The churchyard? 'Tis the fittest place for death.
Perhaps he's praying. Then he's fit to die.
We'll send him charitably to his grave.

D'Am. No matter how thou tak'st him. First take this—


[Gives him a pistol.
Thou knowest the place. Observe his passages,
And with the most advantage make a stand,
That, favoured by the darkness of the night,
His breast may fall upon thee at so near
A distance that he sha' not shun the blow.
The deed once done, thou may'st retire with safety.
The place is unfrequented, and his death
Will be imputed to the attempt of thieves.

Bor. Be careless. Let your mind be free and clear.


This pistol shall discharge you of your fear. [Exit.

D'Am. But let me call my projects to account


For what effect and end have I engaged
Myself in all this blood? To leave a state
To the succession of my proper blood.
But how shall that succession be continued?
Not in my elder son, I fear. Disease
And weakness have disabled him for issue.
For the other,—his loose humour will endure
No bond of marriage. And I doubt his life,
His spirit is so boldly dangerous.
O pity that the profitable end
Of such a prosperous murder should be lost!
Nature forbid! I hope I have a body
That will not suffer me to lose my labour
For want of issue yet. But then't must be
A bastard.—Tush! they only father bastards
That father other men's begettings. Daughter!
Be it mine own. Let it come whence it will,
I am resolved. Daughter!

Enter Servant.

Ser. My lord.
D'Am. I prithee call my daughter.

Enter Castabella.

Cast. Your pleasure, sir.


D'Am. Is thy husband i' bed?
Cast. Yes, my lord.
D'Am. The evening's fair. I prithee walk a turn or two.
Cast. Come, Jaspar.
D'Am. No.
We'll walk but to the corner o' the church;
And I have something to speak privately.
Cast. No matter; stay. [Exit Servant.
D'Am. This falls out happily. [Exeunt.

SCENE III.—The Churchyard.

Enter Charlemont.—Borachio dogging him. The clock strikes


twelve.

Charl. Twelve.
Bor. 'Tis a good hour: 'twill strike one anon.
Charl. How fit a place for contemplation is this dead of night, among
the dwellings of the dead.—This grave—Perhaps the inhabitant was
in his lifetime the possessor of his own desires. Yet in the midst of all
his greatness and his wealth he was less rich and less contented
than in this poor piece of earth lower and lesser than a cottage. For
here he neither wants nor cares. Now that his body savours of
corruption
He enjoys a sweeter rest than e'er he did
Amongst the sweetest pleasures of this life,
For here there's nothing troubles him.—And there
—In that grave lies another. He, perhaps,
Was in his life as full of misery
As this of happiness. And here's an end
Of both. Now both their states are equal. O
That man with so much labour should aspire
To worldly height, when in the humble earth
The world's condition's at the best, or scorn
Inferior men, since to be lower than
A worm is to be higher than a king.

Bor. Then fall and rise.


[Discharges the pistol, which misses fire.

Charl. What villain's hand was that?


Save thee, or thou shalt perish. [They fight.

Bor. Zounds! unsaved


I think. [Falls.

Charl. What? Have I killed him? Whatsoe'er thou beest,


I would thy hand had prospered. For I was
Unfit to live and well prepared to die.
What shall I do? Accuse myself? Submit
Me to the law? And that will quickly end
This violent increase of misery.
But 'tis a murder to be accessory
To mine own death. I will not. I will take
This opportunity to 'scape. It may
Be Heaven reserves me to some better end. [Exit.
Enter Languebeau Snuffe and Soquette.

Soqu. Nay, good sir, I dare not. In good sooth I come of a


generation both by father and mother that were all as fruitful as
costermongers' wives.
Lang. Tush! then a tympany[170] is the greatest danger can be
feared. Their fruitfulness turns but to a certain kind of phlegmatic
windy disease.
Soqu. I must put my understanding to your trust, sir. I would be loth
to be deceived.
Lang. No, conceive thou sha't not. Yet thou shalt profit by my
instruction too. My body is not every day drawn dry, wench.
Soqu. Yet methinks, sir, your want of use should rather make your
body like a well,—the lesser 'tis drawn, the sooner it grows dry.
Lang. Thou shalt try that instantly.
Soqu. But we want place and opportunity.
Lang. We have both. This is the back side of the house which the
superstitious call St. Winifred's church, and is verily a convenient
unfrequented place.—
Where under the close curtains of the night—

Soqu. You purpose i' the dark to make me light.


[Snuffe pulls out a sheet, a hair, and a beard.
But what ha' you there?
Lang. This disguise is for security's sake, wench. There's a talk, thou
know'st, that the ghost of old Montferrers walks. In this church he
was buried. Now if any stranger fall upon us before our business be
ended, in this disguise I shall be taken for that ghost, and never be
called to examination, I warrant thee. Thus we shall 'scape both
prevention and discovery. How do I look in this habit, wench?
Soqu. So like a ghost that notwithstanding I have some
foreknowledge of you, you make my hair stand almost on end.
Lang. I will try how I can kiss in this beard. O, fie, fie, fie! I will put
it off and then kiss, and then put it on. I can do the rest without
kissing.

Re-enter Charlemont doubtfully, with his sword drawn; he comes


upon them before they are aware. They run out different ways,
leaving the disguise behind.

Charl. What ha' we here? A sheet! a hair! a beard!


What end was this disguise intended for?
No matter what. I'll not expostulate
The purpose of a friendly accident.[171]
Perhaps it may accommodate my 'scape.
—I fear I am pursued. For more assurance,
I'll hide me here i' th' charnel house,
This convocation-house of dead men's skulls.
[In getting into the charnel house he takes hold of a death's head; it
slips, and he staggers.
Death's head, deceivest my hold?
Such is the trust to all mortality.
[Hides himself in the charnel house.

Enter D'Amville and Castabella.

Cast. My lord, the night grows late. Your lordship spake


Of something you desired to move in private.

D'Am. Yes. Now I'll speak it. The argument is love.


The smallest ornament of thy sweet form
(That abstract of all pleasure) can command
The senses into passion and thy entire
Perfection is my object, yet I love thee
With the freedom of my reason. I can give
Thee reason for my love.

Cast. Love me, my lord?


I do believe it, for I am the wife
Of him you love.

D'Am. 'Tis true. By my persuasion thou wert forced


To marry one unable to perform
The office of a husband. I was the author
Of the wrong.
My conscience suffers under't, and I would
Disburthen it by satisfaction.

Cast. How?

D'Am. I will supply that pleasure to thee which he cannot.

Cast. Are ye a devil or a man?

D'Am. A man, and such a man as can return


Thy entertainment with as prodigal
A body as the covetous desire,
Or woman ever was delighted with.
So that, besides the full performance of
Thy empty husband's duty, thou shalt have
The joy of children to continue the
Succession of thy blood. For the appetite
That steals her pleasure, draws the forces of
The body to an united strength, and puts 'em
Altogether into action, never fails
Of procreation. All the purposes
Of man aim but at one of these two ends—
Pleasure or profit; and in this one sweet
Conjunction of our loves they both will meet.
Would it not grieve thee that a stranger to
Thy blood should lay the first foundation of
His house upon the ruins of thy family?

Cast. Now Heaven defend me! May my memory


Be utterly extinguished, and the heir
Of him that was my father's enemy
Raise his eternal monument upon
Our ruins, ere the greatest pleasure or
The greatest profit ever tempt me to
Continue it by incest.

D'Am. Incest? Tush!


These distances affinity observes
Are articles of bondage cast upon
Our freedoms by our own objections.
Nature allows a general liberty
Of generation to all creatures else.
Shall man,
To whose command and use all creatures were
Made subject, be less free than they?

Cast. O God!
Is Thy unlimited and infinite
Omnipotence less free because thou doest
No ill?
Or if you argue merely out of nature,
Do you not degenerate from that, and are
You not unworthy the prerogative
Of Nature's masterpiece, when basely you
Prescribe yourself authority and law
From their examples whom you should command?
I could confute you, but the horror of
The argument confutes my understanding.—
Sir, I know you do but try me in
Your son's behalf, suspecting that
My strength
And youth of blood cannot contain themselves
With impotence.—Believe me, sir,
I never wronged him. If it be your lust,
O quench it on their prostituted flesh
Whose trade of sin can please desire with more
Delight and less offence.—The poison o' your breath,
Evaporated from so foul a soul,
Infects the air more than the damps that rise
From bodies but half rotten in their graves.

D'Am. Kiss me. I warrant thee my breath is sweet.


These dead men's bones lie here of purpose to
Invite us to supply the number of
The living. Come we'll get young bones, and do't.
I will enjoy thee. No? Nay then invoke
Your great supposed protector; I will do't.

Cast. Supposed protector! Are ye an atheist? Then


I know my prayers and tears are spent in vain.
O patient Heaven! Why dost thou not express
Thy wrath in thunderbolts to tear the frame
Of man in pieces? How can earth endure
The burthen of this wickedness without
An earthquake? Or the angry face of Heaven
Be not inflamed with lightning?

D'Am. Conjure up
The devil and his dam: cry to the graves:
The dead can hear thee: invocate their help.

Cast. O would this grave might open and my body


Were bound to the dead carcass of a man,
For ever, ere it entertain the lust
Of this detested villain!

D'Am. Tereus-like
Thus I will force my passage to—

Charl. The Devil!


[Charlemont rises in the disguise, and frightens D'Amville away.
Now, lady, with the hand of Charlemont
I thus redeem you from the arm of lust.
—My Castabella!

Cast. My dear Charlemont!

Charl. For all my wrongs I thank thee, gracious Heaven.


Th'ast made me satisfaction to reserve
Me for this blessed purpose. Now, sweet Death,
I'll bid thee welcome. Come, I'll guide thee home,
And then I'll cast myself into the arms
Of apprehension,[172] that the law may make
This worthy work the crown of all my actions,
Being the best and last.

Cast. The last? The law?


Now Heaven forbid! What ha' you done?

Charl. Why, I have


Killed a man; not murdered him, my Castabella.
He would ha' murdered me.

Cast. Then, Charlemont,


The hand of Heaven directed thy defence.
That wicked atheist! I suspect his plot.

Charl. My life he seeks. I would he had it, since


He has deprived me of those blessings that
Should make me love it. Come, I'll give it him.

Cast. You sha' not. I will first expose myself


To certain danger than for my defence
Destroy the man that saved me from destruction.

Charl. Thou canst not satisfy me better than


To be the instrument of my release
From misery.

Cast. Then work it by escape.


Leave me to this protection that still guards
The innocent. Or I will be a partner
In your destiny.

Charl. My soul is heavy. Come, lie down to rest;


These are the pillows whereon men sleep best.
[They lie down, each of them with a death's head for a pillow.

Re-enter Languebeau Snuffe, seeking Soquette.

Lang. Soquette, Soquette, Soquette! O art thou there? [He mistakes


the body of Borachio for Soquette.
Verily thou liest in a fine premeditated readiness for the purpose.
Come, kiss me, sweet Soquette.—Now purity defend me from the sin
of Sodom!—This is a creature of the masculine gender.—Verily the
man is blasted.—Yea, cold and stiff!—Murder, murder, murder! [Exit.

Re-enter D'Amville distractedly: he starts at the sight of a death's


head.

D'Am. Why dost thou stare upon me? Thou art not
The soul of him I murdered. What hast thou
To do to vex my conscience? Sure thou wert
The head of a most doggèd usurer,
Th'art so uncharitable. And that bawd,
The sky there: she could shut the windows and
The doors of this great chamber of the world,
And draw the curtains of the clouds between
Those lights and me, above this bed of earth,
When that same strumpet Murder and myself
Committed sin together. Then she could
Leave us i' the dark till the close deed was done.
But now that I begin to feel the loathsome horror of my sin, and, like
a lecher emptied of his lust, desire to bury face under my eye-brows,
and would steal from my shame unseen, she meets me
I' the face with all her light corrupted eyes
To challenge payment o' me. O behold!
Yonder's the ghost of old Montferrers, in
A long white sheet climbing yon lofty mountain
To complain to Heaven of me.—
Montferrers! pox o' fearfulness! 'Tis nothing
But a fair white cloud. Why, was I born a coward?
He lies that says so. Yet the countenance of
A bloodless worm might ha' the courage now
To turn my blood to water.
The trembling motion of an aspen leaf
Would make me, like the shadow of that leaf,
Lie shaking under 't. I could now commit
A murder were it but to drink the fresh
Warm blood of him I murdered to supply
The want and weakness o' mine own,
'Tis grown so cold and phlegmatic.

Lang. Murder, murder, murder! [Within.

D'Am. Mountains o'erwhelm me: the ghost of old Montferrers haunts


me.

Lang. Murder, murder, murder!

D'Am. O were my body circumvolved


Within that cloud, that when the thunder tears
His passage open, it might scatter me
To nothing in the air!

Re-enter Languebeau Snuffe with the Watch.


Lang. Here you shall find
The murdered body.

D'Am. Black Beelzebub,


And all his hell-hounds, come to apprehend me?

Lang. No, my good lord, we come to apprehend


The murderer.

D'Am. The ghost (great Pluto!) was


A fool unfit to be employed in
Any serious business for the state of hell.
Why could not he ha' suffered me to raise
The mountains o' my sins with one as damnable
As all the rest, and then ha' tumbled me
To ruin? But apprehend me e'en between
The purpose and the act before it was
Committed!
Watch. Is this the murderer? He speaks suspiciously.
Lang. No, verily. This is my Lord D'Amville. And his distraction, I
think, grows out of his grief for the loss of a faithful servant. For
surely I take him to be Borachio that is slain.
D'Am. Hah! Borachio slain? Thou look'st like Snuffe, dost not?
Lang. Yes, in sincerity, my lord.
D'Am. Hark thee—sawest thou not a ghost?
Lang. A ghost? Where, my lord?—I smell a fox.
D'Am. Here i' the churchyard.
Lang. Tush! tush! their walking spirits are mere imaginary fables.
There's no such thing in rerum natura. Here is a man slain. And with
the spirit of consideration I rather think him to be the murderer got
into that disguise than any such fantastic toy.
D'Am. My brains begin to put themselves in order. I apprehend thee
now.—'Tis e'en so.—Borachio, I will search the centre, but I'll find
the murderer.
Watch. Here, here, here.
D'Am. Stay. Asleep? so soundly,
So sweetly upon Death's heads? and in a place
So full of fear and horror? Sure there is
Some other happiness within the freedom
Of the conscience than my knowledge e'er attained to.—Ho, ho, ho!

Charl. Y'are welcome, uncle. Had you sooner come


You had been sooner welcome. I'm the man
You seek. You sha' not need examine me.

D'Am. My nephew and my daughter! O my dear


Lamented blood, what fate has cast you thus
Unhappily upon this accident?

Charl. You know, sir, she's as clear as chastity.

D'Am. As her own chastity. The time, the place


All circumstances argue that unclear.

Cast. Sir, I confess it; and repentantly


Will undergo the selfsame punishment
That justice shall inflict on Charlemont.

Charl. Unjustly she betrays her innocence.

Watch. But, sir, she's taken with you, and she must
To prison with you.

D'Am. There's no remedy.


Yet were it not my son's bed she abused,
My land should fly, but both should be excused.
[Exeunt.

SCENE IV.—An Apartment in Belforest's Mansion.

Enter Belforest and a Servant.

Bel. Is not my wife come in yet?


Ser. No, my lord.
Bel. Methinks she's very affectedly inclined
To young Sebastian's company o' late.
But jealousy is such a torment that
I am afraid to entertain it. Yet
The more I shun by circumstances to meet
Directly with it, the more ground I find
To circumvent my apprehension. First,
I know she has a perpetual appetite,
Which being so oft encountered with a man
Of such a bold luxurious freedom as
Sebastian is, and of so promising
A body, her own blood corrupted will
Betray her to temptation.

Enter Fresco closely.

Fres. Precious! I was sent by his lady to see if her lord were in bed. I
should ha' done't slily without discovery, and now I am blurted upon
'em before I was aware. [Exit.
Bel. Know not you the gentlewoman my wife brought home?
Ser. By sight, my lord. Her man was here but now.
Bel. Her man? I prithee, run and call him quickly. This villain! I
suspect him ever since I found him hid behind the tapestry.

Re-enter Fresco.
Fresco! th'art welcome, Fresco. Leave us. [Exit Servant.] Dost hear,
Fresco? Is not my wife at thy mistress's?
Fres. I know not, my lord.
Bel. I prithee tell me, Fresco—we are private—tell me:
Is not thy mistress a good wench?
Fres. How means your lordship that? A wench o' the trade?
Bel. Yes, faith, Fresco; e'en a wench o' the trade.
Fres. O no, my lord. Those falling diseases cause baldness, and my
mistress recovers the loss of hair, for she is a periwig maker.
Bel. And nothing else?
Fres. Sells falls, and tires, and bodies for ladies, or so.
Bel. So, sir; and she helps my lady to falls and bodies now and then,
does she not?
Fres. At her ladyship's pleasure, my lord.
Bel. Her pleasure, you rogue? You are the pander to her pleasure,
you varlet, are you not? You know the conveyances between
Sebastian and my wife? Tell me the truth, or by this hand I'll nail thy
bosom to the earth. Stir not, you dog, but quickly tell the truth.
Fres. O yes! [Speaks like a crier.
Bel. Is not thy mistress a bawd to my wife?
Fres. O yes!
Bel. And acquainted with her tricks, and her plots, and her devices?
Fres. O yes! If any man, o' court, city, or country, has found my Lady
Levidulcia in bed but my Lord Belforest, it is Sebastian.
Bel. What, dost thou proclaim it? Dost thou cry it, thou villain?
Fres. Can you laugh it, my lord? I thought you meant to proclaim
yourself cuckold.
Enter The Watch.

Bel. The watch met with my wish. I must request the assistance of
your offices.
[Fresco runs away.
'Sdeath, stay that villain; pursue him! [Exeunt.

SCENE V.—A Room, in Cataplasma's House.

Enter Languebeau Snuffe, importuning Soquette.

Soqu. Nay, if you get me any more into the churchyard!


Lang. Why, Soquette, I never got thee there yet.
Soqu. Got me there! No, not with child.
Lang. I promised thee I would not, and I was as good as my word.
Soqu. Yet your word was better than your deed. But steal up into
the little matted chamber o' the left hand.
Lang. I prithee let it be the right hand. Thou leftest me before, and I
did not like that.
Soqu. Precious quickly.—So soon as my mistress shall be in bed I'll
come to you. [Exit Snuffe.

Enter Sebastian, Levidulcia, and Cataplasma.

Cata. I wonder Fresco stays so long.


Sebas. Mistress Soquette, a word with you. [Whispers.
Lev. If he brings word my husband is i' bed
I will adventure one night's liberty
To be abroad.—
My strange affection to this man!—'Tis like
That natural sympathy which e'en among
The senseless creatures of the earth commands
A mutual inclination and consent.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like