Installing and setting up a Raspberry Pi
Posted by davidnewcomb on 15 Jul 2013 in Raspberry Pi
I’m doing this on the Mac this time because it comes with loads of tools pre-installed to help. I’m also assuming that the Raspberry Pi has a keyboard and an active network connection (wired or wireless) with a DHCP server floating about somewhere.
- We need to install the operating system on the SD card. For this we will need to be the root user. You could prefix all the commands with
sudo
, but I find it easier just tosudo bash
which will run another shell with elevated privileges.MrN-host:RaspberryPi mrn$ sudo bash Password: bash-3.2#
- Insert the SD card. The Mac will put an icon on the desktop representing the SD cards filesystem. Before anything we need to take control of the SD card.
- On the command line type: mount
/dev/disk0s2 on / (hfs, local, journaled) devfs on /dev (devfs, local, nobrowse) map -hosts on /net (autofs, nosuid, automounted, nobrowse) map auto_home on /home (autofs, automounted, nobrowse) /dev/disk1s1 on /Volumes/NO NAME (msdos, local, nodev, nosuid, noowners)
- The name of the icon on the Desktop was “NO NAME", but it could be different for you if you have renamed the volume. Look for the device with the same name. In my case
/dev/disk1s1
. - We unmount the SD card:
diskutil umount /dev/disk1s1
- Type mount again and the “NO NAME” device should have disappeared.
- The
/dev/disk1s1
is the name of the partition so/dev/disk1
is the name of the SD card’s device. We’ll need that later. - Now, go to the Raspberry Pi download page and get a copy of the Raspberry Pi operating system. For this example I’ll use the recommended operating system Raspbian “wheezy” (2013-05-25-wheezy-raspbian). If it is possible, get the torrent version; there was 200 in my swarm and it downloaded in a few seconds.
- Unzip the download:
unzip 2013-05-25-wheezy-raspbian.zip
- Now the fun bit. We’re going to lay the downloaded file on to the SD card, well on to its block device. It took 15 minutes to copy the 1.8GB disk image on to the SD card.
# dd if=2013-05-25-wheezy-raspbian.img of=/dev/disk1 bs=1m 1850+0 records in 1850+0 records out 1939865600 bytes transferred in 1128.683885 secs (1718697 bytes/sec)
- The disk image that has been laid down on the SD card contained a single partition which when completely written was recognised by the Mac and automatically mounted. A boot disk icon should appear on the Desktop.
- Drag the boot disk icon to the Trash.
- Pull the card out of the Mac and place into the Raspberry Pi and switch it on.
- Boot up the Raspberry Pi and it should drop you off at a menu screen where we set up a few things.
- First up we will check and install the latest version of the menu screen or raspi-config. Use the up/down keys to go down to 8 Advanced Options and hit return. Now go down to A5 Update. The menu will restart running the latest version.
- Now we’ll configure a few things to help us along the way.
- Most important is to change the default password. Not for any security concerns but because the default password is “raspberry” which is not only too long but also plays havoc with my dyslexia. I can never remember if it’s “bp” or “pb", anyway I digress. I usually just use “pipi". Go into 1. Change User Password and follow the instructions.
- During the course of our installations and set up we may need to reboot a few times so we don’t want it going in to the windows environment each time we do. Switch it off with 3 Enable Boot to Desktop.
- As we are good to the world also consider using 6 Add to Rastrack. It just tells a magic server that you have installed a Raspberry Pi so they can do stats and things. There’s no registration.
- Penultimately go to 8 Advanced Options and then A2 Hostname. The current hostname is raspberrypi which is a bit long. You could end up writing this everywhere. So I’ll just name it after the owner drswifty.
- And finally select 1 Expand Filesystem. This takes the 1.8GB disk image you installed and expands it to fill the whole SD card giving you access to the other 14GB!. This can take a while, about 20 minutes for a 16GB card.
- When you exit with Finish, it will ask you if you want to reboot. Select No. We still need to find out what its IP address is so we can continue remotely from our favourite laptop using PuTTY.
- You will be dropped at the command prompt so issue the command
ifconfig
. Your external address will be listed in either the eth0 or wlan0 interfaces.eth0 Link encap:Ethernet HWaddr b8:27:eb:9b:6b:84 inet addr:192.168.0.13 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:170 errors:0 dropped:0 overruns:0 frame:0 TX packets:113 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:15605 (15.2 KiB) TX bytes:14637 (14.2 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) wlan0 Link encap:Ethernet HWaddr 4c:60:de:61:61:04 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
- Finally, reboot the machine so the hostname change comes into effect.
sudo reboot
- When the machine reboots login as pi with whatever password you selected.
No feedback yet
Form is loading...