1
Fork 0
blog/_posts/2012-07-05-raspberry-pia-guick-guide-to-a-successfull-start.markdown

5.3 KiB

layout title date
post Raspberry Pi - A guick guide to a successfull start 05.07.2012 00:27

Today my Raspberry Pi arrived and I quickly got it up and running.

Want to see some pictures?

Unboxing picture after basic setup

Now that you've seen one in action, here is some info how I successfully setup the Raspberry Pi.

This won't be a full howto. This won't be a complete tutorial. It's more a collection of the things I done. If you follow any of the commands here I'm not responsible. It might kill your kitten, destroy your house and start the mayan apocalypse. Use it at your own risk. Have Fun! :) (Shamelessly taken from the description of VLC Beta)

Prepare for boot

Before I could use my Raspberry I had to prepare my tools:

  • Get a mini-usb cable (the one from my smartphone works perfect)
  • Get a HDMI cable (got one for ~6€ at Amazon)
  • Get a SD Card (again: Amazon, a Transcend 16 GB thing)
  • A USB keyboard (and mouse). Got that.
  • A LAN cable, I have several.

Next I needed an image to boot. I use the archlinux image. Get it from the download section.

Copying the image to the SD Card was easy:

dd bs=1M if=archlinuxarm-29-04-2012.img of=/dev/mmcblk0

The image is prepared for a 2 GB card, so I had to expand the partitions. I failed with parted, re-did the dd-commando and used gParted instead (see the wiki for instructions)

Putting the SD Card in the slot, adding the cables and it booted up! Yey! I even got video output, atleast on my TV.

Not so on the other display. It always switched to standby without any chance to get an output.

So again back to the laptop and edit /boot/config.txt (Thanks, @bl2nk, more info about the file):

# Force HDMI (including audio output)
hdmi_drive=2

# Use "safe mode" settings to try to boot with maximum hdmi compatibility.
# This does:
#   hdmi_force_hotplug=1
#   config_hdmi_boost=4
#   hdmi_group=1
#   hdmi_mode=1
#   disable_overscan=0
hdmi_safe=1

Self-explaining, right?

Ok, so it boots up again, now with video output on the display here. To bad there's no LAN port in my room.

Network forwarding

This has nothing to do with the Raspberry Pi itself but with simple network forwarding. I connected the Pi via LAN to my laptop which got it's internet connection via WLAN.

On my laptop I did these things to forward:

ip addr del 192.168.10.1/24 dev eth0

sysctl net.ipv4.ip_forward=1

iptables -A FORWARD -o wlan0 -i eth0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

On the Pi:

ip addr del 192.168.10.24/24 dev eth0
ip route add default via 192.168.10.1
echo "nameserver 8.8.8.8" > /etc/resolv.conf'

Now it works like a charm (I added this config to rc.conf so it works after boot).

More installing on the Pi

All the previous steps were done as the root user. But for daily use we want an own user:

adduser

(See the arch wiki for more info on that)

Now switch the user (or just re-login):

su username

Audio

To enable sound via alsa I installed the required libs and load the module:

pacman -S alsa-lib alsa-utils
modprobe snd-bcm2835

Then added snd-bcm2835 to the MODULES section in rc.conf so it gets loaded after boot.

GUI / X-Server

I know, I know: Hardcore Linux users don't need it, but it gets quite handy, so I installed a GUI environment:

# X server and i3 window manager
pacman -S xorg-server xorg-xinit xorg-server-utils xf86-video-fbdev i3-wm i3lock i3status
echo 'exec i3' > ~/.xinitrc
# Terminal emulator
pacman -S rxvt-unicode urxvt-url-select
# Oh yeah, some fonts would be great
pacman -S ttf-bitstream-vera ttf-dejavu ttf-freefont ttf-liberation terminus-font

Everything in place, let's start X:

startx

I won't show my basic i3 and i3status configuration here. Feel free to ask if you've got any questions.

What's needed now? Right, everything for daily usage:

pacman -S git mplayer tree scrot feh

Ok, what's left? A browser.

pacman -S luakit

That's it for now. The basic setup of my Pi is done.

shutdown -h now

What's next?

Oh, that's easy.

  • I need to check out rpi-update, for updating the firmware.
  • Get video playing done right. I did not fully test it, but the video in the second image above was quiet slow.
  • I want xbmc to run on my Raspberry Pi, because that's what I bought it for: it should become my media computer in the living room.