O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Raspberry Pi 2 Server Essentials

Book Description

Transform your Raspberry Pi into a multi-purpose web server that supports your entire multimedia world with this practical and accessible tutorial!

About This Book
  • Host websites, games, and even stream HD videos with the impressive power of Raspberry Pi 2
  • Get to grips with embedded programming by turning your Pi into the cloud server that can be used to power Internet of Things projects
  • Make the Raspberry Pi 2 the center of your latest tech experiments and discover how it can manage and host resources
Who This Book Is For

Seeking inspiration for some new tech projects? Want to get more from your Raspberry Pi? This book has been created especially for you!

What You Will Learn
  • Host your Raspberry Pi as a web server using the minimum power resources
  • Connect your Pi to the Internet and perform network benchmarking
  • Explore the cross-platform features of the Pi as you run Python, Node.JS, ASP.NET, and PHP all in one place
  • Share files over the Internet using your Pi as a file server
  • Turn your Pi into a game server, host and engage into playing
  • Enjoy live HD video streaming and exclusive real-time text overlays
In Detail

There’s no end to what you can do with a Raspberry Pi – it makes a huge range of tech projects possible. This book shows you how to transform it into a multipurpose web server, able to store and manage resources that lets you build some truly innovative and impressive computing creations. You’ll learn how to use your Raspberry Pi 2 to host a website using a range of different languages, host a game server, store files, and run everything from a media center to a cloud network. If you want to take control of your technological world, start building your own server and find out what’s possible with the Raspberry Pi microcomputer.

Begin by getting your Pi set up – follow each step as the book shows you how to prepare a network and configure the additional features that you’ll need to build your projects. Once you’ve done this you’ll dig a little deeper and set up your pi as a file server, making sure it’s built for speed using a range of different tools, including Python, Node.js and ASP.NET. Following this the book shows you how to extend your server to allow you to host games, and stream live HD video before customizing it even further to create a fully-fledged media center.

It doesn’t stop there however – the book then dives into the exciting world of the Internet of Things (IoT). You’ll learn how to install Windows IoT onto your Raspberry Pi, the operating system that’s driving embedded software projects all around the world. Once you’ve done this you’ll be ready to explore IoT further, as the book shows you how to use your device to host a cloud network that can form the basis of a wider IoT project.

Style and approach

Packed with plenty of practical examples that walk you through a number of Raspberry Pi projects, this book is an accessible journey into embedded computing and Internet of Things.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Raspberry Pi 2 Server Essentials
    1. Table of Contents
    2. Raspberry Pi 2 Server Essentials
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Getting Started with the Raspberry Pi
      1. Hardware requirements
        1. Power supply
        2. USB hub
        3. SD cards
      2. Extra peripherals
        1. Essential peripherals
        2. Useful peripherals
          1. Internet 3G dongles
          2. Audio recording
          3. Other media add-ons
        3. Fun peripherals
      3. Installing Raspbian on the Raspberry Pi
      4. Understanding the design of the Raspberry Pi
        1. Boot process
        2. Other capabilities
        3. Hardware limitations
          1. Network speeds
          2. USB bottlenecks
          3. Time
      5. References
      6. Summary
    9. 2. Preparing a Network
      1. Local Area Network (LAN)
        1. The eth0 port
        2. The wlan0 interface
        3. The loopback (LO) interface
      2. A wireless configuration (Wi-Fi)
        1. Recommended wireless adapters
        2. Setting up from a desktop
        3. Setting up from a console
        4. Using wicd-curses
      3. A static network address
      4. Testing and benchmarking your network
        1. Basic tests
        2. Advanced benchmarking tools
          1. A speedtest application
          2. iPerf
        3. Recommended bandwidth
      5. Internet configurations
        1. Home packages
        2. Business packages
      6. Dynamic DNS
        1. Installing a client
        2. The free Dynamic DNS domain workaround
      7. Summary
    10. 3. Configuring Extra Features
      1. Updating Raspberry Pi
        1. Updating the firmware
        2. Updating packages
        3. Updating distribution
        4. Outcomes
      2. Hardware watchdog
        1. Enabling the watchdog and daemon
        2. Testing the watchdog
      3. Enabling extra decoders
        1. Buying licenses
        2. MPEG-2
        3. VC-1
      4. Hardware monitoring
      5. Summary
    11. 4. Using Fast Web Servers and Databases
      1. Apache versus nginx versus Kestrel
        1. Installing nginx
        2. Configuring the nginx virtual hosts
      2. Extra frameworks for nginx
        1. Python API
          1. Executing Python
        2. Node.js
          1. Installing Node.js
          2. What is NPM
          3. The Node.js server
        3. .NET and ASP.MVC
          1. Prerequisites for .NET 5
          2. Installing DNVM, DNU and DNX
          3. Installing DNX
          4. Running the MVC website
          5. MVC and nginx
          6. Other .NET applications
        4. Installing PHP
      3. Installing a database
        1. Installing MySQL
        2. Installing phpMyAdmin
        3. Installing SQLite
      4. Summary
    12. 5. Setting Up the Raspberry Pi as a File Server
      1. Connecting the external storage
      2. Preparing the storage medium
      3. Listing the available drives
      4. Formatting a drive
        1. Creating a EXT4 partition
        2. Mounting the drives
        3. Remounting a disk after reboot
      5. Accessing files
        1. The FTP service
          1. Connecting with FileZilla
          2. Connecting with WinSCP
      6. The Samba service
        1. Installing and configuring Samba
        2. Network shares
      7. AFP for Macintosh
        1. Installing and configuring Netatalk
        2. Shares and Time Machine
      8. BitTorrent Sync
        1. Installing BTSync 2
      9. The hardware RAID
        1. Configuration
        2. Massive storage
        3. Redundant storage
      10. Summary
    13. 6. Setting Up Game Servers
      1. Updating to Jessie
      2. Selective settings
      3. Game servers
      4. OpenTTD
        1. Installing OpenTTD
        2. Configuring OpenTTD
        3. Playing OpenTTD
      5. Freeciv
        1. Installing Freeciv
        2. Configuring Freeciv
        3. Playing Freeciv
      6. OpenArena
        1. Installing OpenArena
        2. Configuring OpenArena
          1. Playing OpenArena
      7. Minecraft
        1. Installing the Java Hard-Float
        2. Installing the Minecraft server
        3. Configuring Minecraft
        4. Playing Minecraft
      8. Summary
    14. 7. Streaming Live HD Video
      1. Installing UV4L
      2. Configuring the UV4L-RaspiCAM
      3. Installing WebRTC
        1. WebRTC streaming
      4. Real time HTTP streaming
        1. Web conferencing
        2. Streaming the X desktop
        3. Text overlay
        4. Object detection and tracking
        5. Removing the overlay watermark
      5. The HUD sample
        1. Using the overlay binary
        2. Inline variables
        3. Compiling the overlay code yourself
      6. Summary
    15. 8. Setting Up the Pi as a Media Center Server
      1. Slideshows
        1. Using fbi
      2. Playing videos
        1. OMXPlayer for video playback
      3. Playing audio
        1. Aplay for audio playback
        2. OMXPlayer for audio playback
        3. Using AirPlayer
        4. Using alsamixer
      4. Installing OSMC
        1. Configuring OSMC
        2. Enabling other codecs
        3. Wireless configuration
        4. Media sources
        5. Using add-ons
        6. AirPlay
        7. Enabling CEC and remotes
        8. Performance optimization
        9. Overclocking
      5. Summary
    16. 9. Running Your Pi from a Battery's Power Source
      1. Hardware requirements
        1. Charging stations
        2. Battery packs
        3. Voltage regulator
          1. Ohm's Law
          2. Discharge curves
          3. Discharge characteristics
      2. Putting it all together
      3. How long will it last?
      4. Summary
    17. 10. Windows IoT Core
      1. Getting started
        1. Flashing IoT
          1. Python for Linux or Windows 7 and 8
        2. The first boot
        3. Remote connections
      2. Visual Studio (VS)
        1. Installing Visual Studio 2015
        2. The Hello World application
        3. Deploying the application
        4. Debugging
          1. Breakpoints
          2. Unhandled exceptions
        5. Samples
      3. Windows 10 IoT WebGUI
        1. Setting up the startup app
      4. Peripherals
        1. Bluetooth
        2. Wireless
      5. Summary
    18. 11. Running Your ownCloud
      1. Installation
        1. Requirements
        2. MySQL
        3. nginx and PHP
          1. Permissions
      2. The first configuration
      3. The admin configuration
        1. The server admin
        2. Installing apps
          1. Calendar
          2. Other apps
      4. Daily functionality
        1. The World Wide Access
      5. Summary
    19. 12. The Internet of Things – Sensors in the Cloud
      1. What is IoT?
      2. Ohm's law
        1. How much power?
      3. Choosing sensors
        1. Resistors, fuses, and diodes
        2. Transistors
        3. Integrated Circuit Packages
        4. Putting it all together
      4. Accurate data using Arduino
      5. Building a weather station
        1. Real-time embedded devices
        2. The data communication
        3. Real-time events
        4. Analog inputs
        5. Parts required
      6. Storing data on the Cloud
        1. Phant
      7. Summary
    20. Index