100% found this document useful (1 vote)
35 views

Raspberry Pi Networking Cookbook Second Edition Golden - Download the ebook now for an unlimited reading experience

The document provides information about various Raspberry Pi ebooks available for instant download at ebookgate.com, including titles like 'Raspberry Pi Networking Cookbook' and 'Raspberry Pi Projects for Kids.' It highlights the capabilities of the Raspberry Pi as a network server and educational tool, offering recipes for setup, administration, maintenance, and advanced networking. The document also includes author credits, a preface, and a table of contents for the 'Raspberry Pi Networking Cookbook Second Edition' by Rick Golden.

Uploaded by

coskykokesej
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
35 views

Raspberry Pi Networking Cookbook Second Edition Golden - Download the ebook now for an unlimited reading experience

The document provides information about various Raspberry Pi ebooks available for instant download at ebookgate.com, including titles like 'Raspberry Pi Networking Cookbook' and 'Raspberry Pi Projects for Kids.' It highlights the capabilities of the Raspberry Pi as a network server and educational tool, offering recipes for setup, administration, maintenance, and advanced networking. The document also includes author credits, a preface, and a table of contents for the 'Raspberry Pi Networking Cookbook Second Edition' by Rick Golden.

Uploaded by

coskykokesej
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 73

Instant Ebook Access, One Click Away – Begin at ebookgate.

com

Raspberry Pi Networking Cookbook Second Edition


Golden

https://ebookgate.com/product/raspberry-pi-networking-
cookbook-second-edition-golden/

OR CLICK BUTTON

DOWLOAD EBOOK

Get Instant Ebook Downloads – Browse at https://ebookgate.com


Click here to visit ebookgate.com and download ebook now
Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Raspberry Pi Projects for Kids Second Edition Bates

https://ebookgate.com/product/raspberry-pi-projects-for-kids-second-
edition-bates/

ebookgate.com

Raspberry Pi Cookbook Software and Hardware Problems and


Solutions 2nd Edition Monk

https://ebookgate.com/product/raspberry-pi-cookbook-software-and-
hardware-problems-and-solutions-2nd-edition-monk/

ebookgate.com

Programming the Raspberry Pi Second Edition Getting


Started with Python Simon Monk

https://ebookgate.com/product/programming-the-raspberry-pi-second-
edition-getting-started-with-python-simon-monk/

ebookgate.com

Raspberry Pi user guide Fourth Edition / Halfacree

https://ebookgate.com/product/raspberry-pi-user-guide-fourth-edition-
halfacree/

ebookgate.com
Raspberry Pi Robotic Projects 3rd Edition Richard Grimmett

https://ebookgate.com/product/raspberry-pi-robotic-projects-3rd-
edition-richard-grimmett/

ebookgate.com

Raspberry Pi User Guide 2nd revised edition Edition Upton

https://ebookgate.com/product/raspberry-pi-user-guide-2nd-revised-
edition-edition-upton/

ebookgate.com

Raspberry Pi for Secret Agents 3rd Edition Matthew Poole

https://ebookgate.com/product/raspberry-pi-for-secret-agents-3rd-
edition-matthew-poole/

ebookgate.com

Teach Yourself VISUALLY Raspberry Pi 1st Edition Richard


Wentk

https://ebookgate.com/product/teach-yourself-visually-raspberry-
pi-1st-edition-richard-wentk/

ebookgate.com

Getting Started with Raspberry Pi 1st Edition Matt


Richardson

https://ebookgate.com/product/getting-started-with-raspberry-pi-1st-
edition-matt-richardson/

ebookgate.com
Raspberry Pi
Networking Cookbook
Second Edition

Connect your Raspberry Pi to the world with this essential


collection of recipes for basic administration and common
network services

Rick Golden

BIRMINGHAM - MUMBAI
Raspberry Pi Networking Cookbook
Second Edition

Copyright © 2015 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

Second edition: January 2016

Production reference: 1241215

Published by Packt Publishing Ltd.


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

ISBN 978-1-78528-021-4

www.packtpub.com
Credits

Author Project Coordinator


Rick Golden Shipra Chawhan

Reviewers Proofreader
Stefan Pietzonke Safis Editing
Werner Ziegelwanger
Indexer
Acquisition Editor Priya Sane
Vivek Anantharaman
Production Coordinator
Content Development Editor Shantanu N. Zagade
Arshiya Ayaz Umer
Cover Work
Technical Editors Shantanu N. Zagade
Mohit Hassija
Edwin Moses

Copy Editors
Vedangi Narvekar
Jonathan Todd
About the Author

Rick Golden, in the summer of 1972, sat in the computer lab at SUNY Fredonia and
completed his first CAI tutorial on programming in APL. He was 9 years old then.

He has been programming computers for over 40 years. He has designed and developed
a multitude of projects, from low-level graphics and database drivers to large-volume
e-commerce platforms.

At work, Rick is currently focused on developing software to improve healthcare by mining


petabytes of healthcare claims to find opportunities to improve healthcare coordination.
After work, Rick teaches 10-14 year olds how to program using Raspberry Pi computers.

I would like to thank my dad for giving me the opportunity to learn


programming at such a young age, which was unheard of in the 1970s. His
wisdom, patience, and faith in my programming abilities has encouraged me
to become the man that I am today.

I would also like to thank my wife and family for supporting me during the
many hours that I spent working on this book. Without their support, this
book would not have been written.

Finally, I would like to thank Packt Publishing for giving me the opportunity
to update this book and my editor, Arshiya Umer, for keeping me focused on
my deadlines. Without her help and encouragement, this book would not
have been published.
About the Reviewers

Stefan Pietzonke grew up in a village and wrote his first computer program at the age of
14. His first computer was an Amiga 500. He learned to program in Amiga BASIC. Now, he
mostly writes programs in the C/C++ language.

He developed his own virtual machine called "Nano". The bytecode for the Nano VM can be
created by using his assembler or compiler.

He also likes to conduct hardware projects. He built a robot from a computer mouse case.
This robot is autonomous, drives around, and seeks light.

He has a blog (http://midnight-koder.net/wordpress/) about his software and


hardware projects.

I want to thank my family for supporting me.

Werner Ziegelwanger studied game engineering and simulation and got his master's
degree in 2011. His master's thesis was published with Terrain Rendering with Geometry
Clipmaps for Games as the title. The publisher was Diplomica Verlag. His hobbies are
programming, games, and all kinds of technical gadgets.

He worked as a self-employed programmer for some years and mainly did web projects.
At that time, he started his own blog (http://developer-blog.net), which is about
the Raspberry Pi, Linux, and open source.

Since 2013, Werner has worked as a Magento developer and the head of programming at
mStage GmbH, an e-commerce company that is focused on Magento.
www.PacktPub.com

Support files, eBooks, discount offers, and more


For support files and downloads related to your book, please visit www.PacktPub.com.

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

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can search, access, and read 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 a 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 9 entirely free books. Simply use your login credentials for
immediate access.
Table of Contents
Preface v
Chapter 1: Installation and Setup 1
Introduction 1
Preparing for the initial boot 2
Downloading new SD cards 8
Booting with NOOBS 10
Mac OS X disk utilities – diskutil, dd 12
Image Writer for Windows – Win32DiskImager 15
Convert and copy for Linux – dd 17
Booting Raspbian Linux for the first time 20
Shutting down the Raspberry Pi 24
Chapter 2: Administration 27
Introduction 27
Executing commands with privileges (sudo) 28
Expanding the size of the filesystem (raspi-config) 32
Configuring memory usage (raspi-config) 36
Configuring remote access (raspi-config) 39
Obtaining remote access by using SSH 43
Obtaining remote access by using PuTTY 50
Changing the login password (passwd) 55
Adding a user (useradd) 57
Giving a user sudo privileges (id, and usermod) 59

i
Table of Contents

Chapter 3: Maintenance 63
Introduction 63
Updating the operating system (apt-get) 64
Upgrading Raspbian from wheezy to jessie using sources.list 68
Searching for software packages (apt-cache) 74
Installing a package (apt-get) 77
Package management (aptitude) 81
Reading the built-in documentation (man command) 88
Reading the built-in documentation (info command) 91
Chapter 4: File Sharing 97
Introduction 97
Mounting USB disks (pmount) 98
Accessing another computer's files (smbclient) 107
Sharing folders from other computers (mount.cifs) 116
Auto-mounting USB disks at boot (/etc/fstab) 120
Auto-mounting a shared folder at boot 128
Creating a file server (Samba) 133
Sharing an attached USB disk (Samba) 140
Chapter 5: Advanced Networking 145
Introduction 145
Configuring a static IP address 146
Creating a firewall with ufw 151
Remote access to a desktop session (xrdp) 157
Remote access to the monitor (x11vnc) 162
Installing a web server (Apache, lighttpd, Nginx) 167
Installing a wiki (mediawiki) 177
Creating a wireless access point with hostapd 191
Installing a network trace utility 205
Installing a network protocol analyzer 208
Enabling the IPv6 network protocol 214
Chapter 6: IoT – Internet of Things 221
Introduction 221
Easy access to hardware 222
Installing the GrovePi 230
Controlling devices from a web page 243
Connecting to an IoT platform 249
Creating an IoT gateway 259

ii
Table of Contents

Chapter 7: Clustering 271


Introduction 271
Installing a high-availability load balancer 272
Installing a distributed filesystem 289
Creating a supercomputer 306
Index 323

iii
Preface
A Raspberry Pi 2, with its 900MHz quad-core processor, has more processing power than
a network server from the late-1990s. Created as an educational tool to inspire the next
generation of programmers, the Raspberry Pi is also an excellent network server. It can be
used to share files, host websites, create Internet access points, and analyze network traffic.
Multiple Raspberry Pis can be clustered to create a single, highly available, and fault-tolerant
super computer. This book shows you how.

The Raspberry Pi Foundation recognized that computers had become so expensive and
arcane that programming experimentation on them had to be forbidden by parents. The
parental restrictions on using computers had created a year-on-year decline in the numbers
and skills levels of the A Level students applying to read Computer Science. So, the
Foundation set out to create a computer that was "affordable, and powerful enough to
provide excellent multimedia, a feature we felt would make the board desirable to kids
who wouldn't initially be interested in a purely programming-oriented device".

2 million Raspberry Pis were sold in the first two years of its release, which was not limited
to educators and school children. Hobbyists were also excited to use the inexpensive
Linux-based computer in their projects. In February 2015, the quad-core Raspberry Pi 2 was
released with significantly more power and memory than the original, which was more than
enough memory and power for many typical server applications.

In this cookbook, you'll find a collection of server-side recipes for the Raspberry Pi, including
recipes to set up file servers and web servers, create secure wireless access points,
and analyze network traffic. There is even a recipe to create a highly available
fault-tolerant supercomputer.

v
Preface

What this book covers


Chapter 1, Installation and Setup, has a number of beginner recipes to set up the Raspberry
Pi as a network server, which include instructions on how to download and install new
operating system images, boot for the first time, and the proper way to shut down the system.

Chapter 2, Administration, has more beginner recipes to configure the Raspberry Pi as


a network server, which includes instructions on how to execute privileged commands,
configure remote access, and manage user accounts.

Chapter 3, Maintenance, has intermediate and advanced recipes to maintain the Raspberry
Pi server. You'll learn how to update software, read the built-in documentation, and upgrade
the system.

Chapter 4, File Sharing, has a number of different intermediate recipes to share files.

Chapter 5, Advanced Networking, has a collection of advanced recipes to set up and monitor
network applications, including a firewall, web server, wireless access point, and network
protocol analyzer.

Chapter 6, IoT - The Internet of Things, has several intermediate recipes to connect your
Raspberry Pi to the Internet of Things.

Chapter 7, Clustering, has advanced recipes to create a highly available fault-tolerant


supercomputer from a cluster of Raspberry Pis.

What you need for this book


For most of the recipes in this book, you will need a little more than a basic Raspberry Pi
setup (Raspberry Pi and a power supply) that is connected to a local area network.

You may choose to use a display, keyboard, and a mouse with the Raspberry Pi. However,
most recipes have been written to remotely access the Raspberry Pi as a server.

Internet access is required to download software and connect to the Internet of Things.

Who this book is for


This book is for students, educators, hobbyists, and computer professionals who would like to
use the Raspberry Pi as a network server.

Previous experience with the Raspberry Pi is not required. After completing the beginner and
intermediate recipes in this book, you will gain the knowledge and experience that you will
need to complete even the advanced recipes.

vi
Preface

Sections
In this book, you will find several headings that appear frequently (Getting ready, How to do it,
How it works, There's more, and See also).

To give clear instructions on how to complete a recipe, we use these sections as follows:

Getting ready
This section tells you what to expect in the recipe, and describes how to set up any software or
any preliminary settings required for the recipe.

How to do it…
This section contains the steps required to follow the recipe.

How it works…
This section usually consists of a detailed explanation of what happened in the
previous section.

There's more…
This section consists of additional information about the recipe in order to make the reader
more knowledgeable about the recipe.

See also
This section provides helpful links to other useful information for the recipe.

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

Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Use the
chown command to give the user pi ownership of the directory (.) and all of the files in it (*)."

vii
Preface

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


pi@web1 /var/www/html $ sudo chown pi:www-data . *

New terms and important words are shown in bold. Words that you see on the screen, for
example, in menus or dialog boxes, appear in the text like this: "Press the Tab key to select
Finish and then press the Enter key:"

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 disliked. Reader feedback is important for us as it helps us
develop titles that you will really get the most out of.

To send us general feedback, simply e-mail feedback@packtpub.com, and mention the


book's title in 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 at 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.

Downloading the color images of this book


We also provide you with a PDF file that has color images of the screenshots/diagrams used
in this book. The color images will help you better understand the changes in the output.
You can download this file from http://www.packtpub.com/sites/default/files/
downloads/Raspberry_Pi_Networking_Cookbook_ColorImages.pdf.

viii
Preface

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 could 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 to our website or added to any list of existing errata under the Errata section of
that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/


content/support and enter the name of the book in the search field. The required
information will appear under the Errata section.

Piracy
Piracy of copyrighted 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
If you have a problem with any aspect of this book, you can contact us at questions@
packtpub.com, and we will do our best to address the problem.

ix
Installation and Setup
1
In this chapter, we will cover the following topics:

ff Preparing for the initial boot


ff Downloading new SD cards
ff Booting with NOOBS
ff Mac OS X disk utilities – diskutil and dd
ff Image Writer for Windows – Win32DiskImager.exe
ff Convert and copy for Linux – dd
ff Booting Raspbian Linux for the first time
ff Shutting down the Raspberry Pi

Introduction
This chapter introduces the Raspberry Pi. It begins by listing the components that you will
need, such as a power supply, in addition to the Raspberry Pi.

The core recipes of this chapter describe how to download, install, and configure a number of
common Raspberry Pi operating systems.

The last two recipes describe the initial boot of the official Raspbian Linux distribution and
how to safely power off the Raspberry Pi.

Once you've completed this chapter, you will have downloaded, installed, and configured an
operating system for your Raspberry Pi and booted your Raspberry Pi for the first time.

1
Installation and Setup

Preparing for the initial boot


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

The Raspberry Pi Foundation has released a number of versions of the Raspberry Pi since
it was first released in June 2012, which include Raspberry Pi B (April 2012), Raspberry Pi
A (February 2013), Raspberry Pi Compute Module (April 2014), Raspberry Pi Model B+ (July
2014), and the Raspberry Pi 2 Model B (February 2015).

The original Raspberry Pi Model B has a memory of only 512 MB, a single-core processor,
and two USB ports. The current model, the Raspberry Pi 2 Model B, has a memory of 1 GB,
a quad-core processor, and four USB ports.

The examples in this book feature the Raspberry Pi 2 Model B.

The Raspberry Pi is shipped without a case and power supply. There is no keyboard or
monitor. Depending on how you intend to use the Raspberry Pi, you will need additional
components. For the majority of the recipes in this book, you will only need a power supply,
an SD card, and a network cable.

You may wish to attach additional peripherals, depending on how you intend to use the
Raspberry Pi. An HDMI 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. This recipe lists a number of
different Raspberry Pi projects and the peripherals needed to complete them.

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

Getting ready
To get started with this recipe, there are a few prerequisites that you must be familiar with.

The basic components


These are some of the basic components:

ff The Raspberry Pi
ff An SD card
ff A 5V Micro USB Power Supply

The Raspberry Pi draws its power from a 5V micro USB power supply and needs an SD card
for its operating system. While no further components are required to boot the Raspberry Pi,
many of the networking solutions in this book will require additional components.

2
Chapter 1

A single 4 GB SD Class 10 card has more than enough room and speed to host the base
operating system as well as many useful applications. Because the SD card is where the
Raspberry Pi stores its operating system, the speed of the operating system is dependent on
the speed of the SD card. Class 10 cards will have better performance than Class 4 or Class
6 cards. The Embedded Linux Wiki maintains an SD Card compatibility table, which can be
viewed by visiting http://elinux.org/RPi_SD_cards.

In addition to an SD Card, the Raspberry Pi will need additional components for many
applications. For most of the recipes in this book, you will need only a network connection.
For some, you may also need a display as well as a keyboard and mouse.

The following are a few examples of networking applications and the components that they
will need.

Basic networking
By basic networking, we mean having a network connection. For the simplest networking
solutions, the only additional component that the Raspberry Pi needs is a network
connection—either a direct TCP cable connection, or a wireless network USB dongle.
Once the network is configured and remote logins to the Raspberry Pi are possible,
the Raspberry Pi can be remotely accessed, updated, and administered.

Media centers
As part of media centers, we will require an HDMI television or monitor.

For the simplest network media solutions, in addition to the basic networking 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. Furthermore, there
is enough room on an SD card to store a small collection of music and video files in addition
to the operating system.

Desktop computers
If you are using desktop computers, these will be required:

ff An HMDI television or monitor


ff A USB keyboard
ff A USB mouse

The Raspberry Pi 2 has four USB ports, with enough power to support low-power devices,
such as a USB keyboard or a USB mouse. With its quad-core processor, it is powerful
enough to browse the Web, send e-mails, and edit documents or images. Because it runs
the Linux operating system, the Raspberry Pi can also run hundreds of educational,
scientific, and business programs. In short, the Raspberry Pi can run many useful
open source desktop applications.

3
Installation and Setup

Network hubs
For network hubs, we will require these:

ff A powered USB hub


ff A USB LAN adapter
ff A USB WLAN adapter (a Wi-Fi dongle)
ff A USB hard drive
ff A USB printer

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

Game consoles
ff A powered USB hub
ff USB game controllers

The Raspberry Pi is an excellent gaming platform if you wish to create games, or play
single-player console games or multi-player 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.

The initial setup


ff The Raspberry Pi
ff An SD card
ff A 5V Micro USB power supply
ff A network connection
ff An HDMI TV or monitor
ff A USB keyboard
ff A USB mouse

A power supply, preformatted SD card, monitor, keyboard, and mouse are the bare minimum
components that are needed for an initial setup. When connected with an HDMI to a
television, the television will output audio as well as video.

4
Chapter 1

How to do it...
Perform the following steps to boot the Raspberry Pi:

1. Download the latest disk image.


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

How it works…
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 can be downloaded from
http://www.raspberrypi.org/downloads.

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

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. Then it is ready to be booted (refer to the
Booting Raspbian Linux recipe).

Connect the power supply in the end! There is no on-off switch for the Raspberry Pi. When the
power supply is connected, the Raspberry Pi immediately boots. Therefore, it is important to
have all the cables connected and the SD card inserted before connecting the power supply.

When it is time to turn off the Raspberry Pi, the operating system must first be shut down,
which is the opposite of booting (refer to the Shutting down the Raspberry Pi recipe).

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

5
Installation and Setup

Interfaces
The standard connectors and interfaces for the Raspberry Pi are as follows:

ff Power (5V at 800 mA (4.0 W)): The Raspberry Pi has a Micro USB power connector
that should be connected directly to a power supply that is neither the USB port on a
computer, nor a USB hub.
ff SD card: The Raspberry Pi is designed to be booted from a preformatted SD card
(4 GB or greater is recommended; Class 10 SD cards deliver the best performance).
ff GPIO: This is used in analog and digital I/O connection for expansion and
experimentation.
ff Audio output (3.5 mm jack—stereo): The Raspberry Pi does not have an audio input
connector. However, a USB microphone or sound card can be added. Audio output
includes the I2S protocol to connect to digital audio devices.
ff LEDs: These are disk, power, and network traffic indicators. When these LEDs are
flashing, the Raspberry Pi is actively processing. After shutting down, wait until the
LEDs stop flashing before unplugging the Raspberry Pi.
ff USB 2.0 (four ports): There is limited power available on these ports. The devices
connected to the Raspberry Pi via USB should either have their own power supply,
or should be connected via a powered USB hub.
ff Network (10/100 wired Ethernet RJ45): Be aware that the onboard networking
competes for bandwidth with attached USB devices.
ff HDMI (rev 1.3 and 1.4): This may be used for both video and audio output.
Resolutions from 640x350 to 1920x1200, including the PAL and NTSC
standards, are supported.

On-board components
The central on-board components for the Raspberry Pi are as follows:

ff SoC: This stands for System on Chip. The one we require is Broadcom BCM2836
media processor. Here are its features:
‰‰ CPU: quad-core ARM Cortex-A7 at 900MHz
‰‰ GPU: 24 GFLOPS of compute power
‰‰ Memory: 1GB SDRAM

ff LAN9512

‰‰ 10/100 MB Ethernet (Auto-MDIX)


‰‰ 4x USB 2.0

6
Chapter 1

Recommended accessories
In addition to a power supply, the following accessories are recommended:

ff A Case: This is a protective enclosure for the Raspberry Pi.


ff A powered USB hub: This has its own power supply that is separate from that of the
Raspberry Pi. This has enough power to support attached devices.

Power supply problems


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

Symptoms
Here are some of the symptoms:

ff A rainbow square glows in the upper-right corner of the display


ff The network connection is unreliable
ff The keyboard does not work after the Desktop GUI is started
ff Intermittent SD card errors occur

Causes
Here are the causes:

ff The power supply is rated less than 800mA


ff A complex keyboard or a keyboard with a built-in USB hub, such as Apple
Macintosh keyboards
ff A USB hard disk or an extra large thumb drive is attached directly to the Raspberry Pi
instead of indirectly through a powered USB hub

Solutions
Here are the solutions:

ff Use a 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

7
Installation and Setup

See also
ff Wikipedia—the Raspberry Pi (http://en.wikipedia.org/wiki/Raspberry_
Pi): This Wikipedia article about the Raspberry Pi includes a comparison of all the
Raspberry Pi models, detailed information about each Raspberry Pi component, and
an extended history of the Raspberry Pi.
ff The MagPi (http://www.raspberrypi.org/magpi): The MagPi is the official
Raspberry Pi magazine. 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.
ff R-Pi Hub— eLinux.org (http://elinux.org/R-Pi_Hub): The R-Pi Hub is an
Embedded Linux community's wiki page for Raspberry Pi users. This wiki page has a
buying guide, a beginner's guide, a list of verified peripherals, and a list of Raspberry
Pi distributions that is larger than what's found on the official website. It has a wealth
of well-organized, up-to-date information.
ff The hardware history of the Raspberry Pi (http://elinux.org/RPi_
HardwareHistory): The Embedded Linux community has chronicled the history
of the Raspberry Pi, including detailed specs and images for each version.

Downloading new SD cards


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

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. Preinstalled SD cards are available
for purchase. However, downloading and installing an operating system image is not difficult.

Once you've completed this recipe, you will know how to download a Raspberry Pi operating
system. The following recipes will show you how to write it to an SD card.

How to do it…
Perform the following steps to write an image to the SD card:

1. Download a Raspberry Pi image.


2. Write the image to an SD card.

8
Chapter 1

How it works…
The easiest way to get started with the Raspberry Pi is to download the NOOBS (New Out Of
Box Software) distribution from the Raspberry Pi Foundation website, which can be viewed by
visiting http://www.raspberrypi.org/downloads. The files from this distribution can
be copied directly to a formatted SD card. No additional disk utilities are required to create a
bootable image (refer to the Booting with NOOBS recipe).

Included with NOOBS is the Raspberry Pi Foundation's recommended operating system


distribution, Raspbian Linux. On the downloads page, you will also find a link to the Raspbian
Linux disk image. There are links to a number of other third-party operating systems too.
For more images for the Raspberry Pi, visit the Embedded Linux community's wiki page
(http://elinux.org/RPi_Distributions).

Unlike NOOBS, once one of these individual operating system images is downloaded,
you'll need to write it to an SD card using a special disk utility.

If you are using the Mac OS operating system, use diskutil and dd to write the operating
system image to an SD card (refer to the Mac OS Disk Utilities recipe). If you are writing the
SD card from a Windows computer, use Win32DiskImager.exe (refer to the Image Writer
for Windows recipe). If you are using the Linux operating system to write the image to the SD
card, use the dd command-line utility (refer to the Convert and Copy for Linux recipe).

See also
ff The Raspberry Pi website—downloads (http://www.raspberrypi.org/
downloads): The Raspberry Pi website's download page is where you can find
links to the recommended versions of Raspberry Pi to optimize operating system
distributions. Currently, the Raspberry Pi Foundation has links to the following
operating system distributions:
‰‰ NOOBS and NOOBS Lite
‰‰ Raspbian (Jessie and Wheezy)
‰‰ Ubuntu Mate (a Linux desktop)
‰‰ Snappy Ubuntu Core (a developer distribution)
‰‰ Windows 10 IoT Core (a developer distribution)
‰‰ Open Source Media Center (OSMC)
‰‰ Open Embedded Linux Entertainment Center (OpenELEC)
‰‰ PINET (a classroom distribution)
‰‰ RISC OS (a non-Linux distribution)

9
Installation and Setup

The Raspbian Linux distribution is recommended by the Raspberry Pi Foundation. It


also is the operating system distribution that is used throughout this book.

ff The Embedded Linux for the Raspberry Pi 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 a specific use, such as penetration testing; use as a home theater,
firewall, or an inexpensive desktop PC; or the development of software.
ff Windows 10IoT—Downloads (https://ms-iot.github.io/content/
Downloads.htm): Windows for IoT and the other tools that you will need to develop
for Windows IoT devices such as the Raspberry Pi are available at this website.

As of this revision, the Window 10 IoT distribution does not have a user interface. It is
labeled as Windows 10 IoT Core Insider Preview. The tools needed to interact with
the IoT Core are available from the downloads page of Windows 10 IoT.

Booting with NOOBS


This recipe explains how to use the Raspberry Pi Foundation's NOOBS to install a Raspberry Pi
operating system.

NOOBS is not an operating system distribution. It is a tool that is used to install operating
systems. By using NOOBS, you can select an operating system for your Raspberry Pi.

This is the easiest way to get started with the Raspberry Pi. No special disk utilities are
required. Therefore, this recipe works from any computer that has an SD card writer.

Once you've completed this recipe, you will be able to use NOOBS to select an operating
system for your Raspberry Pi.

Getting ready
Ingredients:

ff A computer with an SD card writer


ff An initial setup for the Raspberry Pi (refer to the Preparing for the initial boot recipe)
ff A formatted SD card—4 GB or greater (class 10 has the best speed)
ff The NOOBS ZIP file

The installation of NOOBS on an SD card is not operating system-specific.

Download the NOOBS ZIP file (NOOBS_v1_4_2.zip) from the Raspberry Pi website
(https://www.raspberrypi.org/downloads/noobs/).

10
Chapter 1

How to do it...
The following steps are required to copy NOOBS to an SD card:

1. Insert the formatted SD card into the computer.


2. Decompress the NOOBS ZIP file onto the SD card.
3. Eject the SD card.
4. Insert the SD card into the Raspberry Pi and power on the Raspberry Pi.
5. Select and install an operating system.

How it works...
The NOOBS installation process is not operating system-specific. The files in the NOOBS ZIP
file simply need to be expanded onto a newly formatted SD card.

Once the files have been expanded onto the SD card, the SD card can be safely ejected from
the computer and inserted into the Raspberry Pi.

After the SD card is firmly inserted into the Raspberry Pi and all of its other components are
connected (the HDMI monitor, network connection, USB keyboard, and USB mouse), you
can connect the power supply and boot the Raspberry Pi. Ensure that the power supply is
connected in the end. Otherwise, your Raspberry Pi will not boot properly.

When the Raspberry Pi is finished booting NOOBS, you will be presented with a choice of
operating systems. Select Raspbian [RECOMMENDED] from the top of the list by pressing the
Spacebar or clicking on it with the mouse. Click on Install (i) or press the I key to install the
Raspbian Linux operating system.

Raspbian Linux is the operating system that is used


throughout this book.

NOOBS will then extract the Raspbian Linux operating system and reboot the Raspberry Pi. As
NOOBS is extracting the operating system, you will be presented with a few tips on how to use
the Raspberry Pi, including the default username and password (the default username is pi
and the default password is raspberry).

After the Raspberry Pi is rebooted, you will be ready to use the raspi-config command to
complete the installation (refer to the Booting Raspbian Linux for the first time recipe).

11
Installation and Setup

There's more...
NOOBS is the easiest way to get started with the Raspberry Pi. It is an installation tool and not
a complete operating system.

In this recipe, you used NOOBS to install the Raspbian Linux operating system. NOOBS can
also be used to install a number of other operating systems, including Arch, OpenELEC,
Pidora, and RaspBMC.

By using NOOBS, Raspbian Linux can be configured so that it boots directly into an easy-to-
use programming environment called Scratch. NOOBS also has a built-in configuration editor
that can be used by experts to apply additional tweaks to the boot configuration.

See also
ff NOOBS (the New Out of Box Software) at https://github.com/raspberrypi/
noobs

NOOBS is designed to make it easier to select and install operating systems for the Raspberry
Pi without having to worry about manually imaging an SD card.

Mac OS X disk utilities – diskutil and dd


This recipe explains how to use the diskutil and dd disk utilities that are found on a Mac
OS X computer to install a Raspberry Pi operating system image on an SD card.

You should have already downloaded a Raspberry Pi disk image and you should be ready to
write the disk image onto an SD card.

Once you've completed this recipe, you will be able to write an SD card from a
Mac OS X computer.

Getting ready
Ingredients:

ff A computer running Mac OS X with an SD card writer


ff An SD card of 4 GB or greater (class 10 has the best performance)
ff A Raspberry Pi operating system image file

Both the diskutil and dd disk utility commands are installed by default with the Mac OS X
operating system. The diskutil command is used to administer disk devices, and the dd
command is used to copy data to and from a disk device.

12
Chapter 1

The dd command requires administrative privileges. Use the sudo command to temporarily
give the user administrative privileges.

How to do it...
The following steps need to be performed to write a disk image to an SD card on a
Linux computer:

1. Open a Terminal.
2. Determine the name of the SD drive by using the following command:
diskutil list

3. Unmount the mounted SD card by using the following command:


diskutil unmountdisk /dev/disk2

4. Use dd to copy the disk image to the SD card (this requires sudo), as follows:
sudo dd bs=1M if=raspbian.img of=/dev/rdisk2

Choose the disk carefully! Ensure that you do not erase the
wrong disk!

Here is an example of a Terminal session that shows the diskutil and dd commands
being used to discover the name of the SD card's disk drive, unmount the SD card, and
write a Raspberry Pi disk image to the SD card:
macosx:~ $ diskutil list

/dev/disk0
#: TYPE NAME SIZEIDENTIFIER
0: GUID_partition_scheme*500.3 GB disk0
1: EFI EFI209.7 MB disk0s1
2: Apple_CoreStorage499.4 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Macintosh HD *499.1 GB disk1
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme NO_NAME *4.0 GB disk2

13
Installation and Setup
1: DOS_FAT_32 NO_NAME 4.0 GB disk2s1

macosx:~ $ diskutilumountdisk /dev/disk2

macosx:~ $ cd Downloads

macosx:Downloads $ dd bs=1M if=raspbian.img of=/dev/rdisk2

How it works...
The diskutil command is used to find the name of the SD card and unmount the disk.

The command is first used with the list subcommand to show information about each
mounted disk drive.

After the SD card is inserted, the SD card appears in this list as /dev/disk2.

Now that we know that the SD card disk device is /dev/disk2, the SD card is unmounted by
using the unmountdisk subcommand.

Finally, the dd command is used to write the Raspberry Pi disk image to the SD card:

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


ff The input file (if) is raspbian.img
ff The output file (of) is the SD card disk device (/dev/rdisk2)

Note that the output file is named /dev/rdisk2 and not /dev/disk2. The extra r asks Mac
OS X to use the raw mode when writing to the disk. The raw mode is much faster, if you want
to write, than the default mode.

There's more...
The diskutil command utility is a feature-rich tool that is used to modify, verify, and repair
disks on Mac OS X. More information about the diskutil command can be found by using
the built-in man pages (man diskutil).

Before the image is copied to the SD card in the preceding example, the disk partition
is unmounted (diskutil unmountdisk). It is important to unmount the disk before
formatting or overwriting it.

14
Chapter 1

When the image is copied with the dd command,

ff if= specifies the input file (raspbian.img)


ff of= specifies the output file (/dev/rdisk2)
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 preceding example:
dd bs=1M if=/dev/rdisk2 of=backup-2015-06-20.img

Pressing Ctrl + T while the dd command is running will cause the command to report
its progress.

More information about the dd command can be found in its man pages (man dd).

See also
ff Disk Utility (http://en.wikipedia.org/wiki/Disk_Utility): The diskutil
command can be used to unmount disks from a system. This Wikipedia article
explains in detail all the features of the diskutil command.
ff diskutil – modify, verify, and repair local disks (https://developer.apple.
com/library/mac/documentation/Darwin/Reference/ManPages/man8/
diskutil.8.html): The diskutil command is part of the Mac OS X operating
system. The Apple man page for diskutil describes the command and its options.
ff dd – convert and copy a file (https://developer.apple.com/library/mac/
documentation/Darwin/Reference/ManPages/man1/dd.1.html): The dd
command can be used to copy images to and from disks. The Apple man page for dd
gives details about the command and its options.

Image Writer for Windows –


Win32DiskImager.exe
This recipe shows how to install a Raspberry Pi operating system image on an SD card using
the open source Image Writer for Windows, Win32DiskImager.exe.

You should have already downloaded a Raspberry Pi disk image, and you should be ready to
write the disk image onto an SD card using a Windows PC.

To complete this recipe, you will also need an Internet connection to download Image Writer
for Windows.

15
Installation and Setup

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

Getting ready
Here are the ingredients:

ff A computer running Windows with an SD card writer


ff An SD card of 4 GB or greater (class 10 has the best performance)
ff A Raspberry Pi operating system image file
ff A precompiled Win32DiskImager binary

The precompiled 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 steps are required to write a disk image to an SD card on a Windows computer:

1. Download the Win32DiskImager ZIP file from https://launchpad.net/


win32-image-writer.
2. Expand the ZIP file to a folder on disk, such as C:\Win32DiskImager.
3. Run Win32DiskImager.exe from the install folder.
4. Select the downloaded Raspberry Pi disk image as the source image file and the
location of your SD card writer as the target device.
5. Click on the Write button to copy the image to the SD card.

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

How it works...
First, you will need to download and install Image Writer for Windows (Win32DiskImager).
The Win32DiskImager is a single standalone executable and can be installed to a folder
that is located anywhere on your PC.

Double-click on the expanded Win32DiskImager executable to start the application.

Once the application has started, select the downloaded Raspberry Pi disk image as the
source Image File and then select the location of the SD card writer as the target device.
When you click on the Write button, the Win32DiskImager writes the Raspberry Pi disk
image to the SD card.

16
Chapter 1

There's more...
The 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.

To create a backup, perform the following steps:

1. Run Win32DiskImager.exe.
2. Select SD card as the source and a new image file as the target.
3. Click on the Read button to read the SD card in a new image on the disk.

The steps needed to back up a Raspberry Pi disk image from an SD card are similar to those
required to write the image. The only difference is that during a backup, the SD card is the
source of the copy, and a new image on the disk is the target.

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 was originally written to read and write disk images for a specific Linux
distribution. However, it has now been generalized and is now a popular tool for
many development projects, such as the Raspberry Pi. The Image Writer for Windows
homepage has details about this disk image utility.

Convert and copy for Linux – dd


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

You should have already downloaded a Raspberry Pi disk image, and you should now be ready
to write the disk image onto an SD card using a Linux PC.

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've completed this recipe, you will be able to write an SD card from a Linux computer.

17
Installation and Setup

Getting ready
Here are the ingredients:

ff A computer running Linux with an SD card writer


ff An SD card with a capacity of 4 GB or greater (class 10 has the best performance)
ff A Raspberry Pi operating system 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).

How to do it...
Perform the following steps to write a disk image to an SD card on a Linux computer:

1. Determine the name of the SD drive by using the df command.


df

2. Unmount the mounted disk partitions with umount, as follows:


umount /dev/mmcblk0p1

3. Use dd to copy the disk image to the SD card, as follows:


dd bs=1M if=rasbian.img of=/dev/mmcblk0

Here is an example of a Terminal session that 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 a Raspberry Pi disk image to an SD card:
user@host ~ $ df –vh

Filesystem Size Used Avail Use% Mounted on


/dev/sda1 9.1G 7.3G 1.4G 85% /
udev 992M 0 992M 0% /dev
/dev/sda3 9.1G 4.9G 3.8G 57% /sys1
/dev/sda4 9.1G 4.2G 4.4G 49% /sys2
/dev/mmcblk0p 3.8G 1.2G 2.6G 32% /media/A181-918F

user@host ~ $ umount /dev/mmcblk0p1

user@host ~ $ dd bs=1M if=raspbian.img of=/dev/mmcblk0

18
Chapter 1

How it works...
The name of the SD drive is discovered using the df command.

The df command shows how much disk space is free on each mounted disk drive. After the
SD card is inserted, the primary partition (p1) of the SD card appears in this list as /dev/
mmcblk0p1. Therefore, the SD card disk device is /dev/mmcblk0 (note that p1 is missing).

Now that we know that the SD card disk device is /dev/mmcblk0, the SD card is unmounted
using the umount command (note that there is no n in umount).

Finally, the dd command is used to write the Raspberry Pi disk image to the SD card:

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


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

Pressing Ctrl + T while the dd command is running will cause the command to report
its progress.

There's more...
The dd utility 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 preceding example shows how the df command can be used to determine the name of
the SD card disk drive. The first partition of the SD disk, /dev/mmcblk0p1, is mounted at
/media/A1B1-918F. Disk images cover a whole disk and not just one partition. Therefore,
the correct name of the disk drive in the preceding example is /dev/mmcblk0 (note the
missing p1).

Before the image is copied to the SD card in the preceding example, the disk partition
is unmounted. It is 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 (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 preceding example:
dd bs=1M if=/dev/mmcblk0 of=backup-2015-06-20.img

19
Installation and Setup

See also
ff dd (Unix) (http://en.wikipedia.org/wiki/Dd_(Unix)): This Wikipedia article
explains the original application of the dd command.
ff dd – convert and copy a file (http://manpages.debian.net/cgi-bin/man.
cgi?query=dd): The Debian man page for dd describes the command and
its options.
ff dd (gnu - coreutils) (http://www.gnu.org/software/coreutils/manual/
html_node/dd-invocation.html): The GNU Operating System manual reference
for dd has a detailed description.

Booting Raspbian Linux for the first time


This recipe explains how to boot the official Raspbian Jessie Linux distribution and use the
raspi-config command to complete the installation of the Raspberry Pi remotely.

When the Raspberry Pi boots for the first time, it automatically boots into the graphical user
interface (GUI) mode—the Raspberry Pi Desktop. The Raspberry Pi also starts a secure shell
server on the initial boot. Therefore, the installation can be completed without a display
attached to the Raspberry Pi.

In this recipe, the raspi-config command is run from a remote shell (SSH or PuTTY) to
complete the installation of the Raspberry Pi. Details of the use of raspi-config can be
found in Chapter 2, Administration.

The installation of the Raspberry Pi can also be completed from the GUI using
the Raspberry Pi Configuration tool, which is found in the Preferences menu.

Once this recipe is complete, you will have booted the Raspberry Pi for the first time.

Getting ready
Here are the ingredients:

ff A basic networking setup for the Raspberry Pi (refer to the Preparing for the initial
boot recipe)
ff An SD card formatted with a Raspbian Linux image
ff A network connection

20
Chapter 1

For this recipe, the SD card should already be formatted with a Raspbian Jessie disk image, or
the Raspbian operating system should have been selected using NOOBS and the Raspberry Pi
should be connected to the local network, where another computer is being used to connect
to the Raspberry Pi remotely.

How to do it...
Perform the following steps to boot the Raspberry Pi for the first time:

1. Insert the SD card into the Raspberry Pi and plug in the power supply. The Raspberry
Pi should start booting.
2. After a short initial boot, the Raspberry Pi will announce itself on the local network
using the raspberrypi.local hostname.
3. Log in to the Raspberry Pi using a secure shell. The default password for the user
with a username of pi is raspberry (Chapter 2, Administration, has two remote
access recipes).
golden-macbook:~ rick$ ssh pi@raspberrypi.local

The authenticity of host 'raspberrypi.local (fe80::ba27:ebff:fe57:796d%


en5)' can't be established.
RSA key fingerprint is da:2a:c1:d4:93:f8:02:2c:36:71:ae:6b:9e:83:a6:d4.

Are you sure you want to continue connecting (yes/no)? yes

pi@raspberrypi.local's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent


permitted by applicable law.
Last login: Thu Sep 24 15:33:00 2015

pi@raspberrypi ~ $

21
Installation and Setup

4. Use the raspi-config command to update the operating system. This is a


privileged command, and it requires the sudo prefix to run. More information on
Executing commands with privileges can be found in Chapter 2, Administration.
pi@raspberrypi ~ $ sudo raspi-config

5. Note that the raspi-config main menu has several options to update the
Raspberry Pi operating system:
┌─────────┤ Raspberry Pi Software Configuration Tool (raspi-config) ├──────────┐
│ │
│ 1 Expand Filesystem Ensures that all of the SD card s │
│ 2 Change User Password Change password for the default u │
│ 3 Boot Options Choose whether to boot into a des │
│ 4 Internationalisation Options Set up language and regional sett │
│ 5 Enable Camera Enable this Pi to work with the R │
│ 6 Add to Rastrack Add this Pi to the online Raspber │
│ 7 Overclock Configure overclocking for your P │
│ 8 Advanced Options Configure advanced settings │
│ 9 About raspi-config Information about this configurat │
│ │
│ │
│ │
│ <Select> <Finish> │
│ │
└──────────────────────────────────────────────────────────────────────────────┘

6. The following are the primary configuration options:


‰‰ Expand Filesystem: This resizes the root partition to fill the SD card
(not necessary if you used NOOBS)
‰‰ Change User Password: This changes the default password (should be the
first thing that you do).
‰‰ Boot Options: Choose to boot the Raspberry Pi in the text mode or the
desktop GUI (this book exclusively uses the text mode).
‰‰ Internationalisation Options: This changes the display language and the
default keyboard layout (the default language is British English and UK is
the default keyboard layout)
‰‰ Enable Camera: This enables the use of the Raspberry Pi camera
‰‰ Add to Rastrack: This includes the Raspberry Pi in the Raspberry Pi
Foundation's usage statistics
‰‰ Overclock: This puts the Raspberry Pi into the Turbo mode (the newest
model, Raspberry Pi 2, only has one speed to choose from)

22
Chapter 1

‰‰ Advanced Options: This is for additional configuration options for advanced


users (such as overscan, SSH, memory split, and audio)
‰‰ About raspi-config: This provides information about raspi-config

7. Select 1 Expand Filesystem to expand the filesystem on the SD card to use all
the available space on the SD Card. Chapter 2, Administration, has a recipe for
Expanding the size of the filesystem.
8. Select 2 Change User Password to change the default password.
9. Select Finish to complete the configuration and reboot the system.

How it works...
Upon booting, the Raspberry Pi registers its hostname (raspberrypi.local) with the local
Multicast Domain Name Server (mDNS). Most home gateways and local area networks
include an mDNS that provides domain name registration services for mobile devices and
computers that dynamically connect to the network.

Once the Raspberry Pi has booted and registered its hostname, a secure shell client is used to
connect to the Raspberry Pi using the raspberrypi.local hostname, the username as pi
and the password as raspberry. Chapter 2, Administration, has two remote access recipes,
one for Windows (PuTTY), and one for Mac OS X and Linux (SSH).

The Raspbian Linux operating system distribution includes the raspi-config utility. This
configuration utility should be run once upon the first boot of the operating system to expand
the filesystem and change the default password.

The raspi-config command is privileged and requires the sudo prefix to be run.
More information on Executing commands with privileges can be found in Chapter 2,
Administration.

When the raspi-config main menu appears, you can use the keyboard arrow keys, the Tab
key, the Spacebar, or the Return key to navigate the menus.

Chapter 2, Administration, has a number of recipes that use the raspi-config command
to configure the Raspberry Pi. For now, just use the Expand Filesystem and Change User
Password menu items and the Expand the size of the filesystem and Changing the login
password recipes.

If you have used NOOBS, it is not necessary to expand the filesystem.


NOOBS has already expanded the filesystem.

Selecting Finish from the main menu will cause the Raspberry Pi to reboot.

Once rebooted, the Raspberry Pi is ready for use!

23
Installation and Setup

See also
ff Multicast DNS (https://en.wikipedia.org/wiki/Multicast_DNS): This
Wikipedia article describes how mDNS is used to resolve host names to IP address
with small local area networks.

Shutting down the Raspberry Pi


This recipe shows how the Raspberry Pi can be powered off safely.

Before powering off the Raspberry Pi, it is important to first shut down the operating system
so that all of the applications and services on the Raspberry Pi have a chance to complete
any disk writing that may be in progress and to prepare for the next boot.

External devices, such as hard disks, also need time to shut down and flush their buffers.
The shutdown command also gives the devices attached to the Raspberry Pi an opportunity
to clean up and prepare for the next boot.

After completing this recipe, you will be able to power off the Raspberry Pi safely.

Getting ready
Here are my ingredients:

ff An Initial Setup for the Raspberry Pi (refer to the Preparing for initiating the
boot recipe)
ff An SD card formatted with the official Raspbian Linux image

The Raspberry Pi should already be powered on and booted before implementing this recipe.

How to do it...
Perform the following steps to shut down the Raspberry Pi:

1. If you have not already done so, log in to the Raspberry Pi as the user pi (the default
password is raspberry):
Raspbian GNU/Linux 7raspberrypi tty1

Raspberrypi login: pi
Password:

24
Chapter 1
Last Login: Sun Jun 21 19:45:35 UTC 2015 on tty1
Linux raspberrypi 3.18.11-v7+ #781SMP PREEEMPT Tue Apr 21 18:07:59 BST
2015armv7l

The programs included with the Debian GNU/Linux system are free
software;The exact distribution terms for each program are described in
the individual files in /user/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent


permitted by applicable law.

pi@raspberrypi ~ $

2. Shut down and halt (-h) the operating system. This command is privileged. Use the
sudo prefix to run the shutdown command as a privileged user, as follows:
pi@raspberrypi ~ $ sudo shutdown –h now

Broadcast message from root@raspberrypi (pts/0) (Sun Jun 21 19:53:03


2015):
The system is going down for system halt NOW!

3. After the shutdown command is executed, the Raspberry Pi will begin its shutdown
process, displaying messages from applications, devices, and services, as they clean
up and prepare for the next boot.
4. Once the operating system has shut down, the Raspberry Pi will halt, leaving only a
single red LED lit on the Raspberry Pi (as long as the LEDs are flashing, the Raspberry
Pi is still busy shutting down).
5. The power supply can now be unplugged from the Raspberry Pi.

How it works...
If you have not already logged into the Raspberry Pi, you will need to log in to the Raspberry Pi
before shutting it down.

The default user is pi. You should have already changed the default user's password during
the first boot (refer to the Booting Raspbian Linux for the first time recipe). In case you have
not changed it, the default password is raspberry.

After logging in, the shutdown command is executed with the –h option, which tells the
Raspberry Pi to halt after the operating system is shut down.

The shutdown command is privileged. Therefore, the sudo command is used as a prefix to
temporarily grant privileges. More information on Executing commands with privileges can be
found in Chapter 2, Administration.

25
Installation and Setup

There's more...
The shutdown command can also be used to reboot the system. Just use the –r reboot
option instead of the –h halt option.

Rebooting the system when you're logged in as the user pi can be done with the help of the
following command:
pi@raspberrypi ~ $ sudo shutdown –r now

Synonyms exist for the shutdown command, which include poweroff and reboot.

To power off the system instead of using shutdown –h, you can also use the
following command:
pi@raspberrypi ~ $ sudo poweroff

Instead of shutdown –r, you can also use the following command:
pi@raspberrypi ~ $ sudo reboot

More information about these commands can be found in their man pages.

See also
ff halt, reboot, poweroff – stop the system (http://manpages.debian.net/cgi-
bin/man.cgi?query=halt): There are alternatives to the shutdown command.
The Debian man page for halt, poweroff, and reboot describes these commands
in detail.
ff shutdown – bring the system down (http://manpages.debian.net/cgi-bin/
man.cgi?query=shutdown): The shutdown command can be used to halt (-h) or
reboot (-r) the system. The Debian man page for shutdown describes the command
and all of its options in detail.

26
Chapter 2

Administration
2
In this chapter, we will cover the following topics:

ff Executing commands with privileges (sudo)


ff Expanding the size of a filesystem (raspi-config)
ff Configuring memory usage (raspi-config)
ff Configuring remote access (raspi-config)
ff Obtaining remote access by using SSH
ff Obtaining remote access by using PuTTY
ff Changing the login password (passwd)
ff Adding a user (adduser)
ff Giving a user sudo privileges (id and usermod)

Introduction
The recipes in this chapter are for the basic administration of the Raspberry Pi. This chapter
starts with a recipe that shows how you can use the sudo command to execute other
commands that require superuser privileges. The next three recipes use the raspi-config
command-line tool to complete the following three initial configuration tasks:

ff Expanding the filesystem to use all the space on an SD card


ff Changing the memory allocation for better performance
ff Enabling remote access to the Raspberry Pi

27
Administration

The following two recipes show how the Raspberry Pi can be accessed remotely:

ff Using the SSH command-line client from Linux or Mac OS X computers


ff Using the PuTTY client from Windows computers

The final three recipes in this chapter, which are as follows, are for user administration:

ff How to change the password of the default user whose username is pi


ff How to create a new user login
ff How to add a user to the privileged sudo user group

Once you've completed this chapter, you will be able to administer the Raspberry Pi remotely
via a network connection without a keyboard or display.

Executing commands with privileges (sudo)


This recipe shows how you can execute privileged commands using sudo.

The default Raspberry Pi user (pi) is an ordinary user and not a super-user. The sudo
command is used to temporarily grant an ordinary user the privileges of a super-user.

After you've completed this recipe, you will be able to execute commands with super-user
privileges by using sudo as a command prefix.

Getting ready
The following ingredients are required for this recipe:

ff You need an initial setup or a basic networking setup for the Raspberry Pi that has
been powered on. You also need to be logged in as the user whose username is pi
(refer to the recipes in Chapter 1, Installation and Setup, for instructions on how to
boot and log in and the recipes given later in this chapter for instructions on how to
log in remotely).
ff A network connection is an optional requirement.

If the Raspberry Pi has remote access enabled, this recipe can be completed remotely using
SSH or PuTTY (refer to the Remote access (SSH) and Remote access (PuTTY) recipes that are
given later in this chapter).

28
Discovering Diverse Content Through
Random Scribd Documents
recognising them as lords of some of the Greek islands. Even as it
was, John the Good did much to arrest decay.
Manuel I., 1143– Manuel I. Comnenus (1143–1180), John’s
1180. son and successor, was a worthy heir to the
military talents of his father. But his violent passions sullied his
private life, and his extravagance, ostentation, and vanity took away
from the lustre of his domestic administration. He was one of the
most Western in temperament of all the Greek sovereigns. He was
proud of his prodigious personal strength, of his handsome person,
and of his skill in all chivalrous exercises. He was the only Greek
Emperor who could surpass the most famous knights of the West in
the mimic war of the tournament. He had the spirit of a knight-
errant, suggesting Richard Cœur de Lion rather than the sly and
demure Oriental. When he had safely extricated himself from the
perils of the Second Crusade [see page 192], he plunged into a series
of wars in which he sought personal glory rather than the welfare of
his Empire. There were strange tales of his wonderful personal
adventures and hairbreadth escapes from Patzinaks and Turks. He
introduced Western tournaments into Constantinople, had a truly
Frankish ardour for crusading, re-armed his troops after the Western
fashion with ponderous shields and heavy lances, and eagerly sought
to connect himself by marriage with the great royal houses of the
West. His first wife Bertha—called Irene to satisfy Greek
susceptibilities—was a sister-in-law of the Emperor Conrad III., and
his second wife was a princess of Antioch. His daughter married in
succession the brother of the King of Hungary and the son of the
Marquis of Montferrat. His son, Alexius, was wedded to the daughter
of Louis VII. of France. His influence extended over all the Danubian
states as far as the German frontier. His wars, if not always politic,
were often successful. He defeated the strenuous attempts of King
Roger of Sicily and his son William the Bad [see page 236] to invade
his Empire. He waged a long and not inglorious war with Venice, and
even when unable to destroy her privileges did something to
counterbalance them by calling in rival Italian traders, such as the
Genoese. When beaten by the Seljuks, he was able to negotiate an
honourable peace. But his wastefulness brought the financial
disorders to a crisis, and his utter neglect of routine threw the
obsolete administrative system into confusion. Yet with all his faults
he was a brilliant personality, and with his death the good fortune of
the Comnenian dynasty came to an end.
Alexius II., 1180– Alexius II. (1180–1183), the son of
1183. Manuel, was a boy twelve years old, and his
mother, Mary of Antioch, strove to carry on the government in his
name. Her incapacity gave an opening for intrigues of the members
of the royal house, and, two years later, Andronicus Comnenus,
cousin of Manuel, displaced the Empress and became the guardian of
Usurpation of Alexius with the title of Cæsar. As soon as
Andronicus, 1183– he was secure of power, Andronicus
1185. murdered his ward, married his widow,
Agnes of France, and made himself sole Basileus. Andronicus was a
strong and brave soldier, but overweeningly ambitious, wantonly
cruel, and already infamous by a long career of brutality and
treachery. His success in gaining power was greater than his success
in retaining it. Rebellions broke out in the provinces. Cyprus shook
itself free from his rule under the local Emperor Isaac Comnenus,
who finally succumbed to Richard of England [see page 301]. Even
the reign of terror which marked his rule did not check the plots of
the angry nobles. The Normans again invaded Macedonia, and
captured Thessalonica. So hateful did Andronicus become that a very
small incident sufficed to bring his power to an end. During his
absence from Constantinople, one of his ministers ordered the arrest
of an incapable and cowardly noble named Isaac Angelus. Driven to
despair at the prospect of the torments meted out for Andronicus’
victims, Isaac plucked up courage to resist, and took refuge in St.
Sophia’s. The mob of Constantinople arose in revolt, declaring that it
would have ‘no more old men or men with forked beards as
End of the Emperors.’ Andronicus hurried back, but all
Comneni. classes deserted him. He was tortured to
death by the mob, and Isaac Angelus was declared his successor.
With him the glorious house of Comnenus ingloriously expired
(1185).
Isaac II., 1185–1195. The reign of Isaac Angelus ushered in a
worse period of degradation. Even the
brutality of Andronicus had been in some measure redeemed by its
strength, but under his weak and contemptible successor the Empire
suffered from the worst results of incompetence. The Emperor
lavished his revenues in building churches and palaces, in collecting
relics and sacred icons, in ministering to the luxury and vanity of a
crowd of parasites and dependants. He put the administrative offices
up for sale, and allowed their purchasers to recoup themselves by
oppressing the provincials. His ten years’ rule was full of military
disasters. The imposition of a new tax was followed by the revolt of
the Bulgarians, who had lived as peaceful subjects of the Empire
since their conquest, two hundred years previously, by Basil II. [see
pages 163–165]. In a short time the whole of Bulgaria had shaken off
the yoke of Constantinople, and the mercenary arms of Conrad of
Montferrat. The efforts of Isaac, who took the field in person against
the rebels, were powerless to win back a warlike and united people.
The loss of Bulgaria was not the only humiliation of Isaac’s reign. We
have already seen how the Third Crusade dealt roughly with his
power, how Frederick Barbarossa, provoked by his treachery, forced
him to make an abject submission, and how Richard of England
permanently turned Cyprus into a feudal Frankish kingdom, utterly
unconnected with the Empire. Isaac had also to buy off the attacks of
the Sultan of Roum by the payment of tribute. In the midst of all
these disasters his wretched government was abruptly ended by a
palace conspiracy, formed against him by his elder brother Alexius,
while he was absent engaged in the Bulgarian war. Isaac hurried
back to Constantinople, only to be deposed, blinded, and immured in
a monastery (1195).
Alexius III., 1195– Alexius III. Angelus (1195–1203), was as
1203. wasteful, as profligate, and as incompetent
as his brother, pillaging his subjects to reward the conspirators who
had helped him to the throne. Rebellions broke out in the provinces,
and the Venetians and Pisans fought out their feuds in the streets of
the capital. The efforts to reconquer Bulgaria proved abortive, and
the Turks of Roum again threatened the heart of the Empire. The
utter feebleness of the Byzantine power tempted the Emperor Henry
VI. to re-enact the part of Robert Guiscard and Roger. His death
postponed, without averting, the danger of Western conquest. Philip
of Swabia was the brother-in-law of the deposed Isaac, and
welcomed his son Alexius, when he escaped in a Pisan ship from his
ill-guarded prison. The Venetians, though loaded with privileges,
clamoured for more. It was just at the moment when the anarchy of
Constantinople had reached its height that the army of Crusaders,
collected from all Europe by the zeal of Innocent III. and the
preaching of Fulk of Neuilly, appeared at Venice, waiting to take ship
thence in the vessels of the republic for the Holy Land.
The golden age of the Crusades was now over. The difficulties that
limited the success of the Third Crusade now prevented even the
undertaking of a new one on the same grand lines. The long efforts of
Celestine III. to start a new Crusade had borne little fruit. Fulk of
The mustering of Neuilly began his preaching very soon after
the Fourth Crusade, Innocent III.’s accession to the Papacy, and
1198–1202. the new Pope warmly supported him. But
none of the great princes of Europe responded to his call. It was not
until 1201 that the beginnings of a crusading army was gathered
together under leaders more of the status of the heroes of the First
Crusade than of those of the Second or Third. Theobald III., Count of
Champagne, was not deterred by his brother Henry’s death from
striving to redeem his brother’s lost kingdom. Among the lords of
Champagne that attended him was his marshal, Geoffrey of
Villehardouin, who has left us a famous account of the expedition.
Among Theobald’s companions of high rank were his kinsman Louis,
Count of Blois, and his sister Mary, who accompanied her husband,
Baldwin IX., Count of Flanders, Baldwin’s brothers Eustace and
Henry, and Simon of Montfort, soon to become famous as the leader
of the Albigensian Crusade. Theobald of Champagne was appointed
general-in-chief, and it was resolved to attack Egypt, as the real
centre of the Ayoubite power. Early in 1201, ambassadors of the
Crusaders, conspicuous among whom was Villehardouin, appeared
at Venice to negotiate with the Republic as to their means of
transport. After lengthened negotiations a treaty was concluded
between them and Henry Dandolo, the blind and aged, but still
ardent, subtle, and active Doge. It was agreed that the Venetians
should provide the necessary transports, with provisions for a year,
and a convoy of fifty galleys. But in return, the Frankish Crusaders
agreed to pay Venice the vast sum of 85,000 marks of silver, and to
divide all conquests and booty equally between themselves and the
Venetians. It was characteristic of the Italian seafaring republics to
drive hard bargains with the Crusaders, and Dandolo had little
concern for the Holy War, though he had infinite zeal for the
interests of Venice. As soon as the Crusaders began to collect by the
lagoons to embark for Egypt, he aspired to use them as soldiers of
the Republic rather than of the Church. The appearance of the
fugitive Alexius in Italy already suggested the idea of diverting the
expedition against Constantinople.
There were still long delays. The death of the Count of Champagne
left vacant the supreme command, and, after several attempts to fill
it up, the Crusaders appointed as their chief the North Italian
Boniface of Montferrat, brother of Conrad of Montferrat, and a
scheming and unscrupulous adventurer. He was soon approached by
King Philip of Swabia, who urged upon him the claims of the young
Alexius, his kinsman. The Hohenstaufen monarch and the Doge of
Venice now combined to recommend the Crusaders to undertake the
restoration of Isaac Comnenus, as a preliminary to their attack on
the infidels. Even at this early stage it is more than likely that the
Venetians had formed a deliberate design to divert the Crusade, and
had perhaps even an understanding with the Saracens to that effect.
The capture of Zara, When the spring of 1202 came, the
1202. passage from Venice was still
unaccountably delayed. Many of the Crusaders had spent all their
resources during their long stay, and the leaders were quite unable to
pay the Venetians the huge sum they had promised. Dandolo now
proposed that they should acquit themselves of part of their debt by
helping Venice to conquer the maritime town of Zara, an old enemy
of the Republic, and the haunt of pirates that preyed on its trade.
Zara belonged to the King of Hungary, who had also taken the cross.
But the spirit of adventure and love of booty was stronger among the
Franks than zeal for the Holy War. Despite the protests of Simon of
Montfort against the turning aside of a crusading army to fight a
Catholic and crusading prince, it was agreed to accept Dandolo’s
suggestion. In October, the Crusaders at last left the Lido. In
November Zara fell, after a short siege, into the hands of the united
Venetian and Frankish host. The Pope vigorously denounced the
forsworn soldiers of the Cross. But the Venetians paid no heed, and
the Franks very little, to his fulminations. The season was now too
late to make a start, and the army took up winter quarters in
Dalmatia. Alexius now appeared in person in the crusading camp,
and his glittering offers were greedily accepted. Boniface of
The Crusade turned Montferrat thought more of his own
against advantage than of the sacred cause. The
Constantinople, pious scruples of the Count of Flanders
1203. were finally allayed. In the early summer of
1203, the Crusaders made sail for the Ægean. The fatal results of the
decay of the Greek marine now made themselves clearly manifest.
Alexius III. was the first ruler of Constantinople who had to defend
his capital, without having the command of the sea. With next to no
resistance, the Venetians and Franks passed through the
Dardanelles, and encamped at Scutari. The land-attack on
Constantinople was beaten off, but the Venetians, headed by the
blind old Doge, stormed the sea-wall, and burnt the adjacent ports of
the city. The incapable and cowardly Emperor fled in alarm to
Thrace, whereupon the army took the blind Isaac out of prison, and
restored him to his throne, but invited his son Alexius to share it
with him (July 1203).
First capture of The Crusaders had made an easy
Constantinople. conquest, but their main feeling was one of
Restoration of Isaac disgust that the premature surrender of the
Angelus and Alexius
IV., July 1203.
city had deprived them of a chance of a
richer plunder than their imaginations had
ever conceived before they saw the wonders of the New Rome. They
settled down for the next winter in the suburbs of the capital, while
Isaac and Alexius IV. left no stone unturned to satisfy their clamour
for their pay. When the Emperors were reduced, in their efforts to
appease the Latins, to plunder the churches of their jewels and
reliquaries, and impose odious taxes on their subjects, the mob of
Constantinople, taught by the success of recent revolutions to regard
itself as all-powerful, rose in revolt against them, and murdered all
the Latins within reach. Isaac, unnerved by captivity, died suddenly,
Revolution in it was said, of fright. Alexius IV. was
Constantinople. strangled. A strong and daring adventurer,
Alexius V., Feb. Alexius Ducas, surnamed Murzuphlus from
1204.
his shaggy eyebrows, was proclaimed the
Emperor Alexius V. (February 1204). The house of Angelus thus
quitted history even less gloriously than the house of Comnenus.
Second capture and It was but a revolution in the capital, and
sack of the provinces hardly recognised the
Constantinople, usurper. But Alexius V. threw a new energy
April 1204.
into the defences of Constantinople, and the
Crusaders found that they must either retire discomfited, or capture
the city for a second time. After two months of preparations, they
advanced in April to the final assault. This time they limited their
attack to the sea-wall. The first effort was a failure, but a few days
later a second onslaught admitted them into a corner of the city.
There was still a chance for the Greeks, if they had had courage to
stubbornly defend the city street by street. But the mercenary
soldiers would not fight, and Alexius V., despairing of further
resistance, fled from the capital, though he soon fell into the hands of
the Crusaders, who put him to death. Constantinople now belonged
to the Franks, and a hideous three days of plunder, murder, lust, and
sacrilege, at last satisfied them for the moderation they had been
forced to show upon the occasion of the first conquest. The priceless
relics of ancient art were barbarously destroyed: the very churches
were ruthlessly pillaged, and the city of Constantine was robbed for
ever of that unique splendour that had made it for ages the wonder of
the world.

The cry of indignation, that had already broken out when the
Crusaders turned aside to besiege Zara, was renewed on their
abandoning their campaign against the infidel to conquer a Christian
city. But the feebleness of the opposition showed that the crusading
spirit was dying, and even Innocent III., who was bitterly grieved at
the failure of the Crusade, found consolation in the hoped-for
collapse of the Greek schism, and made his peace with the Latin
The partition and conquerors of Constantinople. The
organisation of the victorious Westerns now proceeded to the
Latin Empire, division of the spoil. The Venetians and the
1204–1261.
Franks still stood apart, jealously watching
over their respective interests. There was no longer any talk of
appointing a new Greek Emperor. It was agreed to elect from the
crusading host a Latin Emperor and Patriarch, and it was further
determined that the party that furnished the Emperor should yield to
the other the choice of the Patriarch. A college of six French prelates
and six Venetian nobles was set up to elect the Emperor. There was
keen rivalry for the post. Boniface of Montferrat, as general, seemed
to have an obvious claim, but the Venetians were unwilling to
support the candidature of an Italian prince, an ally of the
Hohenstaufen. Refusing the dangerous honour for their own duke,
the Venetians declared for Count Baldwin of Flanders, who was duly
elected Emperor in May. The papal legate crowned him in St.
Sophia’s, and he was invested with the purple buskins and all the
other trappings of the Basileus of the Romans. Thomas Morosini, a
Venetian, was chosen Patriarch. But the election of the heads of the
Church and State was an easier business than the division of the
spoils amidst a whole swarm of greedy claimants.
Like the conquerors of Jerusalem after the First Crusade, the
conquerors of Constantinople set up a feudal state on the ruins of the
Oriental system that they had destroyed. The Emperor Baldwin was
to be overlord of all the Crusading chieftains, and was moreover to
have as his domains the capital, saving the Venetian quarter, the
greater part of Thrace with Adrianople, and the eastern islands of the
Ægean, Samothrace, Cos, Lesbos, Samos and Chios. Boniface of
Montferrat was consoled for his disappointment with the title of King
of Thessalonica. He was still strong enough to reject the offer of a
patrimony in Asia which the Latins had still to conquer, and to
profess that he held Thessalonica in his own right, independently of
the Emperor of Romania. He established himself in Macedonia and
Thessaly. The Venetians had the lion’s share of the plunder. They
had henceforth a large slice of Constantinople with the practical
monopoly of the trade of the Empire. They also were recognised as
lords of most of the islands and coast lands, including the Ionian
islands, Eubœa, most of the Cyclades and some of the Sporades,
numerous settlements on the coasts of the Peloponnesus, and a large
domain north of the Corinthian Gulf, along Acarnania, Ætolia,
Epirus and Albania, where, however, they were not strong enough to
penetrate far into the interior. Crete they purchased from Boniface of
Montferrat. Dandolo, who assumed the title of Despotes, now styled
himself ‘lord of a quarter and half-a-quarter’ of the Empire. The
minor Frankish chiefs also received great fiefs. Louis of Blois became
Duke of Nicæa and of Nicomedia: Villehardouin became Prince of
Achaia: Odo of La Roche Lord of Athens, and there were counts of
Thebes, dukes of Philippopolis, and marquises of Corinth. Each
feudatory had still his fief to conquer as best he could, and the lords,
to whom lands in Asia were assigned, never obtained effective
possession of their territories. The more fortunate European barons
could only enjoy their grants by calling in the help of vassal
chieftains, whose immunities left them little more than a show of
power outside their own domains. No feudal state was ever strong,
but no feudal state was ever so weak as the Latin Empire in the East.
It had to contend against all the characteristic evils of feudalism, the
infinite multiplication of the sovereign power, the constant feuds of
rival chieftains, the permanent jealousy of every vassal of the power
of his overlord. But it had special difficulties of its own of a kind
impossible to be got over. The magnates of the expedition had
cleverly manipulated the division of the spoils to their own
advantage, and the poorer Crusaders were bitterly discontented. A
comparison of the famous history of Villehardouin with the less well
known account of the Crusade by the simple Picard knight, Robert of
Clari, shows how bitterly the ‘poor knights’ resented the overbearing
conduct of the ‘great men,’ whose standpoint is represented by the
Marshal of Champagne. Moreover, Germans fought with
Champenois and Burgundians, North Italians with Flemings, and all
with the Venetians. Even if the Crusaders had been united, they were
a mere handful of adventurers. The Venetians, who had got for
themselves the richest and most accessible parts of the Empire,
thought little of colonisation and much of trade. Yet even the
Venetians drew wealth from the richly cultivated islands which now
became the appanage, and were soon a chief source of wealth, to the
noblest houses of the island city. The Ionian islands and Crete
remained Venetian for many centuries; the interior uplands were
hardly Latin for two generations. It speaks well for the prowess of the
Frankish lords that they held their position so long as this.
There was no attempt at mixing between Latins and Greeks. The
quick sympathy that had made the Normans Italians in Sicily,
English in England, and Irish in Ireland, no longer remained with
the Frankish hosts. Their civilisation was too stereotyped, their ideas
too stiff, their contempt for their conquered subjects too profound. It
was even less possible for the Greeks to assimilate themselves with
their conquerors. The old-world civilisation of the Byzantine realm
was infinitely more hide-bound than the feudal system of the Franks.
It was impossible to combine French feudalism with Byzantine
officialism. The Greek despised the rude and uncultivated
‘barbarians’ who now ruled the heritage of Rome. The Latin scorned
the cunning and effeminate Eastern who had succumbed so readily
to his sword. It had been hard enough for the Comneni to keep
together the decaying fortunes of the Eastern Empire. It was quite
impossible for the French and Flemings to succeed where they had
failed.
The Greek revival. The barrier of religion would have kept
the Latins and Greeks asunder, even if
differences of nationality and civilisation had not proved effective
causes of separation. Despite the rejoicings of Innocent III., Orthodox
and Catholic were more divided than ever, when the Filioque was
chanted by azymites in the choir of St. Sophia, and beardless Latins,
who regarded the Pope as the source of all ecclesiastical power, took
into their hands every Church dignity and possession, and branded
their rightful owners as schismatics. Orthodoxy and the pressure of
the Latin invaders united Greek national feeling as it had never been
united before. In the mountains of Albania and Epirus, the bolder
Greeks fled from the yoke of the conqueror, and maintained their
independence against any force that the Latins could bring to bear
against them. A bastard of the house of Angelus became Despot of
Epirus. Even in Thrace and in the Peloponnesus there were
independent Greek States. Into Asia the Crusaders hardly penetrated
at all. Two brothers of the house of Comnenus established the
independence of distant Trebizond, and dignified themselves, like
Theodore I. Isaac in Cyprus, with the title of Emperor.
Lascaris, 1204– Theodore Lascaris, a brave soldier who
1222. escaped from the sack of Constantinople,
proclaimed himself Emperor at Nicæa, and ruled over the western
parts of Asia Minor. It was well for Greeks and Latins alike that the
dissension and decay of the Seljukians of Roum, and the pressure of
Tartar invasion, deprived Islam of its power of aggression. In Europe
the Wallachio-Bulgarian kingdom easily maintained its
independence and enlarged its boundaries at the expense of the
crusading state. Nothing but the secure possession of the great
military position of Constantinople, and the command of the sea,
which the Venetian galleys still kept open for them, allowed the Latin
Empire to keep up a feeble existence for nearly sixty years.
Rivalry of From the very beginning the Latin
Constantinople and settlers had to contend against dissension
Thessalonica. within and invasion from without. Boniface
of Thessalonica married the widow of Isaac Angelus, Margaret of
Hungary (called by the Greeks Irene), and posed as an independent
prince and the protector of the Greek population. He refused homage
to the Emperor, and war broke out between the Flemings of
Constantinople and the Lombards of Thessalonica. No sooner were
his pretensions rudely shattered than the Emperor was called away
to meet the danger of Bulgarian invasion. Johanitsa, the tsar of the
Bulgarians, turned his arms against the Crusaders, and invaded
Thrace. In April 1205, a decisive battle was fought at Adrianople,
when the simulated flight of the wild Bulgar hordes drew the chivalry
Baldwin I., 1204– of the West to break up their solid ranks.
1205. Thereupon the Bulgarians rallied, and took
advantage of the enemy’s disorder to inflict on them a complete
defeat. Louis of Blois was among the slain. Baldwin was taken
prisoner and murdered. The Marshal of Champagne, and Henry of
Flanders, Baldwin’s brother, almost alone survived of the Latin
chieftains.
Henry, 1206–1216. Henry of Flanders had already made
some progress in the conquest of Greek
Asia, when the news of the Bulgarian invasion called him to defend
his brother’s throne. He was now recognised as Emperor. He was
politic as well as brave, and the Greeks themselves admitted that he
‘treated the Romans as if they were his own people.’ But he could
neither conquer Asia, defeat the Bulgarians, nor even permanently
conciliate his Greek subjects; though his zeal for shielding them from
Catholic persecution drew upon him the thunders of the Vatican. He
made a treaty with Theodore Lascaris, which gave him at least a little
corner of Asia. He was the strongest of the Latin Emperors. But he
profited by the even greater weakness of the kingdom of
Thessalonica. In 1207, Boniface of Montferrat perished, like Baldwin,
at the hands of the Bulgarians. The Despot of Epirus took advantage
of the minority of his infant son, Demetrius, to extend his conquests.
The Frankish lords of the kingdom called in the Emperor Henry, who
found some consolation for his disappointments in the North, when
he gave the law to the Peloponnesus and the islands in a great Diet
held in 1210, compelled the regent of the young king to do him
homage, and received the submission even of the Venetian lords of
the Archipelago, conferring on the great house of Sanudo the Duchy
of the Archipelago or the Cyclades. Even the Despot of Epirus
formally acknowledged his sovereignty. Henry died in 1216, and with
him perished the best hopes of the Latins in Greece.
Peter of Courtenay, Peter of Courtenay, Count of Auxerre, a
1216–1219. grandson of Louis VI. of France, and the
husband of Iolande, sister of Baldwin and Henry, was now chosen
Emperor. He was in Europe at the time of his election, and hastened
to Constantinople to take possession of the Empire. He rashly chose
to disembark at Durazzo and follow the ancient Via Egnatia over the
hills to Macedonia and Thrace. When amongst the mountains, his
little army was overwhelmed by the Despot of Epirus, and he himself
was captured, and died in captivity. His wife, who had more
prudently proceeded to Constantinople by sea, now acted as regent
for her young son Robert, the next Emperor.
Robert, 1219–1228. The reign of Robert of Courtenay marked
the rapid decline of the Eastern Empire. It
witnessed the complete destruction of the Kingdom of Thessalonica.
In 1223, when King Demetrius was abroad, seeking in vain Western
help, Theodore Angelus took possession of his capital, and
henceforth ruled without a rival from the Adriatic to the Ægean; and,
like the lords of Nicæa and Trebizond, assumed the pompous style of
Fall of Emperor of the Romans. John Vatatzes, the
Thessalonica, 1223. successor of Theodore Lascaris at Nicæa,
renewed the war with the Latins of Constantinople. It seemed almost
a race between the two Theodores, as to which should first drive out
the Latins. The domain of Robert was reduced to Constantinople and
its suburbs. He went to implore help from the West, and died during
his journey in 1228.
Baldwin II., 1228– Baldwin II. (1228–1261), the youngest of
1261. Peter of Courtenay’s sons, a boy of eleven,
was now proclaimed Emperor. John de Brienne, the ex-king of
Jerusalem [see chapter xix], was soon called in to hold the regency.
He married his daughter to Baldwin, was crowned joint-Emperor,
and saved his ward’s throne from the Greeks and Bulgarians. On
John’s death in 1237, new perils beset the young Baldwin. The Latin
state had had a few years of breathing time through the rivalry of the
Angeli of Thessalonica and the house of Ducas, to which, after the
death of Theodore Lascaris, had passed the Empire of Nicæa. John
Union of III. Ducas ended the strife in his own favour
Thessalonica and by the conquest of Thessalonica in 1241.
Nicæa. Henceforth, the Angeli had to be contented
with the title of Despot of Epirus, and were confined to the uplands
of the west. A single strong Greek power now threatened
Constantinople, both from the side of Asia and the side of Europe.
John III. Ducas, Moreover, John III. was a competent
1222–1254. administrator, a good warrior, and an able
financier. Nothing but the mighty walls of Constantinople, which the
Greeks had vainly attempted to assault, and the Venetian command
of the sea, now saved the Latin Empire from immediate extinction.
Baldwin II. spent most of his long reign in the vain quest of Frankish
assistance. He left his son as a pledge to Western bankers, and sold
the most precious relics of Constantinople to St. Louis. He had to sell
the lead of his palace-roof to buy food, and warm himself by burning
the wood of his outhouses. But the death of John III. in 1254
prolonged the long agony of the Latin Empire. Michael Palæologus,
an ambitious and unscrupulous soldier, became regent for the infant
grandson of John III., and soon associated himself with his ward as
Michael VIII. joint ruler. In 1259 Michael was crowned
Palæologus, 1259– Emperor at Nicæa, and the rights of his
1282. little colleague were soon forgotten. But
Michael VIII. showed vigour and military capacity which went some
way to justify his usurpation. In 1261, he profited by the absence of
the Venetian fleet to make a sudden attack on Constantinople. The
Conquest of unlucky Baldwin could offer no effective
Constantinople, resistance. On 15th August, Michael entered
1261. in triumph the ancient capital, and the
Latin Empire perished, unwept and unhonoured.
The revived Greek The Venetians, alarmed to find that
Empire, 1261–1453. Michael had transferred their privileges to
their Genoese rivals, joined with the Franks of the Peloponnesus in
raising a cry for a Crusade against the victorious Greeks, which was
further preached by Pope Urban IV. Charles of Anjou, who became
King of Naples and Sicily in 1265, was willing, and seemed eminently
fitted, to carry out the old aggressive policy of the Guiscards. But,
though the proposal that he should lead a new Crusade against the
Orthodox frightened Michael into insincere proposals to buy off
Western opposition by ending the Greek schism, his submission had
no permanent result when the fear of a Crusade was removed.
Michael never ruled with the authority of the Macedonians or the
Comneni, but his careful measures of reforms, and his warlike
capacity, started the Greek Empire on the last stage of its career,
which gave it nearly two centuries more of existence before it
succumbed to the Ottoman Turks.
The Latins in The Latin power still partly continued in
Peloponnesus. the islands and in the Peloponnesus. Not
only did the Venetians retain their grip on the Archipelago and the
coast, but the proximity of the sea enabled some of the Franks of
Southern Greece to continue to rule their principalities, after
Baldwin II. had been driven from his throne. They had as their code
of law the Assizes of Romania, a free adaptation of the famous
Assizes of Jerusalem. They even effected some sort of partial
amalgamation with their native subjects. Their churches and
fortresses long remained, as in Cyprus and Syria, the strongest
witnesses of their power. It was not till 1310 that the Dukes of
Athens, of the house of Brienne, succumbed, not to the Greeks, but to
their own Catalan mercenaries. The Princes of Achaia reigned even
longer. The Venetians saved both the Ionian islands and Crete alike
from the Greeks and from the Turks. To the end of the Middle Ages,
titular dukes, princes, and emperors of the Eastern world kept up the
memory of one of the strangest and most daring of Western
conquests, but one which was useless to the West, and only
weakened the Christian East, at a time when the rise of the Ottoman
Turks required every effort to be made to stem the tide of that
barbarian conquest which was soon to prove fatal to Latin and Greek
alike.
GENEALOGY OF THE COMNENI AND
ANGELI.
GENEALOGY OF THE LATIN EMPERORS OF
CONSTANTINOPLE.
CHAPTER XVI
[28]
FREDERICK II. AND THE PAPACY (1216–
1250)

Character and Policy of Frederick II.—His Work in Naples and


Sicily—Frederick and Honorius III.—The Early Struggles of
Frederick and Gregory IX.—Frederick’s Crusade and its
Consequences—Peace of San Germano—Germany under
Frederick—St. Engelbert and Henry VII.—German Civilisation
under the Later Hohenstaufen—The Eastward Expansion of
Germany—Livonia and Prussia—Frederick and the Lombard
League—Battle of Cortenuova—Renewed Struggle with Gregory
IX.—The Tartars—Innocent IV. and the Council of Lyons—Henry
Raspe and William of Holland—The Italian Struggle—Frederick’s
Plans for Ecclesiastical Revolution—Frederick’s Death.

Character of Frederick II. was nearly twenty-two years


Frederick II. old when the death of Innocent III. allowed
him to govern as well as to reign. He was of middle height, and well
proportioned, though becoming somewhat corpulent as he advanced
in age. He had good features and a pleasant appearance. His light
hair, like that of his father and grandfather, inclined towards
redness, but he ultimately became very bald. Despite his troubled
childhood, passed in solitude and gloom at the palace of Palermo, he
had been carefully educated. He became familiar with many tongues,
and versed in many literatures. The half-Greek, half-Arabic
cultivation of Sicily had thoroughly permeated a spirit in which keen
rationalism and dreamy mysticism were curiously interwoven. He
had a true mediæval love for dialectic. He delighted in geometry and
in astronomy. He regulated his public and private life by the
predictions of his astrologers, among whom Michael Scot held the
first place. He was curious in natural history, collecting a great
menagerie of strange animals and studying their habits and
structure. The camels and dromedaries, employed in carrying his
baggage train, excited the wonder of the Italians, and his elephant, a
present from the Sultan of Egypt, was almost as famous as the
elephant of Charlemagne. In his concern for his own health he busied
himself with surgery and medicine, while his care for his animals
turned his interests towards veterinary science. He enjoyed hunting
and hawking, not only as a sportsman, but as a naturalist. He wrote a
treatise on falconry that attests his zoological and anatomical
knowledge. Yet with all his love of fresh air and exercise, he was a
valetudinarian who depended upon his physicians almost as much as
upon his astrologers, regulating his life and diet very carefully, and
indulging so frequently in baths that his enemies reproached him
with bathing on Sundays.
With advancing life Frederick’s personal habits grew more and
more oriental. He secluded his wives from the public gaze, keeping
them under the custody of eunuchs after the Eastern fashion, and
maintaining at Lucera a regular harem of concubines, the expenses
of which were duly entered in the public accounts of the realm.
Though a respectable strategist, Frederick was no warrior, taking
small delight in feats of physical skill, and having little of the rough
vigour and determination of his chivalrous contemporaries. But he
was a subtle and almost a great statesman, who sought to gain his
ends by craft, duplicity, and dexterity. Courteous, polished, and
seductive in manner, he seemed to belong to a different race from
that of his rude Swabian and Norman ancestors. His many-sided
character, so full of contradictions, has nothing of the homogeneity
and simplicity of the warriors and statesmen of the Middle Ages, but
at one time reflects the astute and effeminate oriental, and at another
anticipates the accomplished and brilliant despots of the Italian
Renascence. His want of sympathy for the ideals of his time comes
out strongly in his dealings with the Church. He was believed to have
imbibed from his Arab and Jewish masters an utter scepticism as to
all religion. Moses, Mohammed, and Christ, he is reported to have
said, were three impostors who had deluded the world in turn; and
he is also alleged to have maintained that the soul perished with the
body. But if Frederick upheld these views before a select circle, he
was careful to submit himself to all the obligations of the Church,
and to prove his orthodoxy not only by the most formal and positive
denials of these charges, but also by a most sanguinary persecution
of heresy.
Frederick’s policy in Frederick’s character and policy can best
Naples and Sicily. be studied in his favourite Sicilian and
South Italian homes. Despite the protection of Innocent III., he had
had, as we have seen, the greatest difficulties in maintaining his
position both against the untamed descendants of the old Arab lords
of Sicily, and against the fierce and turbulent feudal aristocracy that
had come in with the Normans. The first years after Innocent’s death
were taken up with renewed struggles against the Saracens in Sicily.
It was not till after an almost constant fight between 1221–1225 that
Frederick succeeded in entirely effecting their subjection. He then
strove to divide his Arab subjects by transporting a large number of
them to the desolate town of Lucera on the mainland. The ruined city
was rebuilt on a magnificent scale for its infidel inhabitants. Workers
in steel and weavers of silk made Lucera wealthy and prosperous,
and the grateful Arabs showed unwavering fidelity to their
sympathetic conqueror. Frederick frequently visited Lucera, where
he delighted to live the very life of his oriental subjects. Frederick
looked upon the Arabs as most kings looked on the Jews. They were
his personal slaves and dependants, whom he protected the more
since, besides the commercial gifts, which they shared with the
Hebrews, they were doughty warriors, who were ever willing to fight
for him in his Italian wars. Moreover, their loyalty was superior to
the terrors of the papal ban, and their arms proved an admirable
counterpoise to the fierce Norman aristocracy, which, allying itself
with the Papacy, sought to break down the fabric of centralisation
which the Sicilian kings had established at its expense, and which
Frederick now strove to elaborate into a strong despotism. The
constant feudal revolts were suppressed with firm deliberation and
cold-blooded cruelty. Hardly less formidable to Frederick than the
feudalists were the great cities such as Messina, Syracuse, and
Catania, whose liberties were also menaced by a policy that
concentrated all power in the monarch, and whose frequent
rebellions were another continued source of trouble. The same firm
hand that checked the nobles ultimately managed to triumph over
the disaffection of the citizens.
Victorious over Saracens, nobles, and townsmen alike, Frederick
skilfully played off one class or race against the others, and banished
from his court the turbulent leaders of the lay and spiritual
aristocracy. With the help of a handful of faithful prelates and
barons, and of a wider circle of lawyers, notaries, and royal
dependants, Frederick issued a series of laws for the government of
Sicily and Naples that frankly strove to abolish the feudal state in the
interests of autocracy. He resumed possession of the estates that had
been carved from the royal domain in the days of confusion. Like
another Henry of Anjou, he either destroyed the unauthorised
castles, erected by the feudal lords, or at least garrisoned them with
royal troops under trusty commanders. Private wars were forbidden
under pain of death, and even the judicial duel was only allowed in
specified cases and under careful precautions. Criminal jurisdiction
was withdrawn from the nobles’ courts and put in the hands of royal
judges. Frederick even made it a merit that he suffered the feudal
tribunals to continue to exercise civil justice. The towns were
deprived of the right of choosing their magistrates, and put under the
rule of royal officials, while councils of notables, chosen by the
inhabitants, gave the magistrates some insight into public opinion,
or at least proved a convenient channel for receiving the royal
commands. The feudal prelates shared in the ruin of their lay
colleagues, and every churchman was forced to pay taxes, and to
abandon civil office. The Church courts saw their jurisdiction limited
and their privileges curtailed. The further growth of ecclesiastical
property was prevented by a severe law of mortmain.
A great administrative system grew up on the ruins of seignorial,
ecclesiastical, and municipal independence. All laws emanated
directly from the monarch. The Magna Curia, sitting at Capua, took
supreme cognisance of all judicial business, while the Magna Curia
Rationum occupied the position of the Angevin Exchequer.
Chamberlains looked after the finance and the administration of the
provinces, while Justices, strangers to the districts in which they
bore rule, tried criminals and upheld peace and good order. Local
bailiffs cared for the royal interests in the villages, and acted as
judges in the first instance, while the Grand Justiciar, the head of
the Court of Capua, made yearly perambulations of the provinces to
control the local machinery. Representative General Courts
anticipated by a generation or more the system of estates of Northern
Europe, and brought the autocrat in touch with the needs of the chief
orders of the community.
The arts and sciences flourished at the court of the brilliant and
enlightened young despot. In 1224 Frederick established the
University of Naples, and provided it with every faculty, ‘in order
that those who have hunger for knowledge may find within the
kingdom the food for which they are yearning, and may not be forced
to go into exile and beg the bread of learning in strange lands.’ It was
the first university in Europe established by royal charter, and, all
through its history, the rigid dependence of its teachers and students
on the State deprived it of that freedom which was necessary to play
a real part in the history of thought, though the fostering care of its
master, which prohibited his subjects from studying elsewhere, made
it an efficient educational instrument, and it had the honour of
numbering among its earliest disciples Thomas of Aquino. The more
ancient school of medicine at Salerno was revived through
Frederick’s bounty, and no one was allowed to practise the
physician’s art within the realm without the licence of the Salerno
doctors. At Frederick’s accession, we are told, there were few men of
letters in Sicily. His largesse soon attracted to his court doctors from
every part of the world. The palace itself became a centre of
intellectual activity. Michael Scot translated for Frederick many of
the works of Aristotle. The famous mathematician, Leonard of Pisa,
who introduced Arabic numerals and Arabic algebra into the West,
enjoyed the sovereign’s patronage. Learned Jews and Arabs were as
sure of Frederick’s favour as the best of Catholics. Nor were the
lighter and more elegant arts forgotten. It is possible that Frederick
himself wrote Latin poetry. It is certain that his compositions in the
vulgar tongue mark the starting-point of the vernacular literature of
Italy, and for the first time gave a currency among the great and
learned to the songs of the Sicilian dialect that had hitherto only
enjoyed the favour of the poor and humble. Dante regarded
Frederick as the father of Italian poetry, and the example of the king
and his court gave such vogue to the Sicilian idiom that it was nearly
a century before the vernacular poets forsook it for the Tuscan.
Frederick also loved the poets of Provence, even if he did not also
write verses in the tongue of the Troubadours. He also favoured the
speech of Northern France, and recognised its general prevalence as
the common language of knights and soldiers. His ministers, headed
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookgate.com

You might also like