Setting up a Raspbian image for RPi2

Dear all,

First of all: take my dearest apologies, as this will be a text heavy blog post with really little image count. 😉

I was fiddling around a long time to get into the Raspberry Pi world. I read tons of stuff on different sites and I had some difficulties to put it all together (even if not being a complete Linux noob). There are so many different images floating through the net and so many instructions, that I figured I’d do my own. 😉

I recently bought a Raspberry Pi 2 (Model B) and want to use it as a Plex Server (not as a client as we do own an Amazon Fire stick and an Apple TV and different tablets for the Plex app here in the cave). I do not want to have my desktop PC running all the time just so that I can watch some movies. And I don’t want to wait until my desktop PC has booted to watch some movies. The RPi2 seemed to be a good choice, even though it lacks the Gigabit ethernet the Banana Pi has (I only found that information after I purchased the RPi2).

So this blogpost is mostly for those people who use Windows as their main system and are not that fond with Linux in the first place. I will try to give as much info as needed and as little as to be not confusing.

Most of this blog post is „not reinventing the wheel“ as all this information is spread over lots of different web pages. So I stole shamelessly from everyone and no-one, as most of this is an open secret. 😉

As I use a german keyboard and live in Germany, I want my system to be set up in german. In the setup process everywhere, where there is localization, just use your own locales you want and need. 🙂

The distribution (operating system)

First things first: We need an operating system. I will stick with Raspbian (I tried Miniban, but had more problems then enlightning moments with it).

Prerequisites

Software

  1. Download the Raspbian image as a Zip-file and save it to your harddisk:
    https://www.raspberrypi.org/downloads/raspbian/
  2. Download the Win32 Disk Imager as a Binary Zip-file:
    http://sourceforge.net/projects/win32diskimager/files/Archive/

Hardware

  • Raspberry Pi (whatever model – as you only switch the (micro) SD card the model does only matter for the further work you want to do with it)
  • A 5 V power adapter for the RPi with micro usb plug.
  • A (micro) SD card of the following:
    • A SD card for a Pi first generation (model A, B).
    • A micro SD card for a Pi second generation (model 2).
    • Additional info: The higher the class of the (micro) SD card the better. A class 10 card increases the read / write for the Pi, meaning the operating system runs more smoothly than with a class 4 card.
  • Card reader for SD / micro SD cards (connected to your PC).
  • Optional: HDMI cable and HDMI ready monitor. You can always SSH to the RPi but I find it easier with a monitor when doing the first steps in the Linux world.
  • USB Mouse
  • USB Keyboard
  • Ethernet cable (and the internet)

Work to be done on Windows

  1. Unpack the raspbian image.
  2. Unpack the Win32 disk imager.
  3. Insert the (micro) SD card into your card reader. Find the drive letter, under which the (micro) SD card is mounted.
  4. Start the Wind32DiskImager.exe from the unpacked folder.
    • Field Image file should be filled with the unpacked raspbian image.
    • Field Device is the mounted drive letter of the (micro) SD card.

    2015-08-19 16_07_29-Win32 Disk Imager

  5. When everything is set up (and you are sure that the device is set correctly), hit the Write button.
    Be aware that every data on the device is deleted, so check twice before doing this!
  6. When finished, the Win32 Disk Imager will tell you so:
    2015-08-19 16_14_13-Complete
  7. Remove the (micro) SD card and insert it into the RPi.

Setting up the Pi

  1. Insert SD card into the RPi.
  2. Connect mouse, keyboard, ethernet and HDMI to the RPi.
  3. Give it the power it deserves. 😉 Plug it in and watch the monitor as the Pi boots up.
  4. The first setup will be done in the menu with the blue background:
    raspi-config
    You can get back to it later with typing sudo raspi-config into the console.
    If you want further info about that screen, you can get it here: https://www.raspberrypi.org/documentation/configuration/raspi-config.md

    1. Choose Expand Filesystem.
      Press Enter to OK the next screen.
      The expansion will be done after reboot, but we don’t reboot just yet.
    2. Choose Internationalisation Options.
      Choose Change Keyboard Layout.
      You are now in the Keyboard model screen.
      Choose Classmate PC by hitting Enter.
      You are now in the Keyboard layout screen.
      Choose Other by hitting Enter.
      You are now in the Country of origin screen.
      Choose German by hitting Enter.
      You are now in the Keyboard layout screen.
      Choose German by hitting Enter.
      You are now in the Key to function as AltGr screen.
      Choose The default for the keyboard layout by hitting Enter.
      You are now in the Compose key screen.
      Choose No compose key by hitting Enter.
      You are now in the Use Control+Alt+Backspace to terminate the X server screen.
      Choose No by hitting Enter.
    3. Choose Internationalisation Options.
      Choose Change Locale.
      You are now in the Locales to be generated screen.
      Choose de_DE.UTF-8 UTF-8 by hitting the Space bar.
      Hit Tab to move to the Ok button. Hit Enter.
      You are now in the Default locale for the system environment screen.
      Choose en_GB.UTF-8.
      Hit Tab to move to the Ok button. Hit Enter.
    4. Choose Internationalisation Options.
      Choose Change Timezone.
      You are now in the Geographic area screen.
      Choose Europe by hitting Enter.
      You are now in the Time zone screen.
      Choose Berlin by hitting Enter.
    5. You are back in the config overview screen.
      Hit Tab to move to the Finish button. Hit Enter.
    6. You are now in the Would you like to reboot now? screen.
      Choose Yes. Hit Enter.

Updating the system

  1. After the reboot you can log into the shell with the credentials:
    login: pi
    password: raspberry
  2. First things first: update to the really latest version of all the stuff in the raspbian operating system:
    sudo apt-get update &&Y sudo apt-get upgrade
    If Raspbian asks After this operation kB of additional disk space will be used. Do you want to continue [Y/n] type Y and hit Enter.
    This can take some time! See it as the Windows updates after you did a fresh install of Windows. That also takes ages to load and install (and Raspbian will be a lot faster ;-)).
  3. Setting the SWAP partition before doing anything else. I chose to use 2048 MB instead of the everywhere proclaimed 1024 MB. Just out of curiosity if this might help with transcoding and working smoother for the Plex server. You need to write the following three commands into the shell and hit Enter after every line. This creates, sets up and activates the new SWAP size.
    1. sudo su -c 'echo "CONF_SWAPSIZE=2048" & /etc/dphys-swapfile'
    2. sudo dphys-swapfile setup
    3. sudo dphys-swapfile swapon

Next blog post will be about changing username, password and hostname to specialize the Pi more. Also the setup of a static IP (I want my Plex server not to jump around with DHCP because I need to visit its website) and mounting harddisks will be covered with it.

petra Verfasst von:

Ein Kommentar

  1. 20. August 2015
    Antworten

    Nice read; might help a lot of beginners on the arm arch.
    One issue you will encounter tho is the lack of cpu power for the transcode processes. That will be a non-issue for quality as-is, but if you down/upscale -say by a mobile client- your cpus might choke.

    Especially the limited arm architecture.
    And thanks for using sudo.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.