Raspberry Pi first steps and basic network configuration on a Mac
First of all. Mine have been bought on ebay, from resellers. And were delivered a while ago. Main purpose of this purchase war to attach a headless server to my router. I have 2 external HDD's and would like to have torrents, Time Mashine fro my macs and so on. So buying a handheld computer like this would be a bargain for me.
As for built in decisions like some kinds of NAT devices and different routers with external HDD features... They are either cost a lot or lack some kinds of desired functionality. So the goal is to make some kind http/api manageable server in my local network with Time Mashine and file storage/backup. Just for fun. And to have only laptop on my work table.
SO back to the Pi. If you are buying "device only" configuration, like I did. First of all you'll need some different kind of things many computer fans usually have for backup purposes, or just in case... Those are device with HDMI port or either a TV set with AV input, e.g. SCART or Video in port. A keyboard (USB, of course) and SD card usually bigger then 2 Gigabytes.
I had this all. So I've connected my PI and tried to flash a card, having problems doing it. I'll try to cover most of them here.
1. Install a system. Usually it is a simple "burning an SD card" with Raspbian Linux distribution. To do this you need to download it from: HERE and do actions from official manual here with looking further note first.
Problem: "dd" does not work like intended, because volume is bisy.
Solution: We need to unmount volume, using diskutil command with "force" flag for e.g.:
sudo diskutil umount force /Volumes/my_flash_drive
Problem: Doing "dd" command under mac environment did write the card, but took ages on my mac's config. So the...
Solution: Is modified dd command call with manually specifying block size. This will speed up sd card write tremendously.
dd bs=1m if=~/Downloads/debian6-19-04-2012/debian6-19-04-2012.img of=/dev/rdisk1
Note "bs=1m" here. It helped my SD card burning not to hang out to infinite time.
After SD card was written and you are good to go...
2. Pi initial config. Appears after first boot and looks like so:
Tools you will use here are similar to bios config on a PC. So to get started:
Here you need to expand rootfs (to use entire SD card space) I doubt you have original Pi Raspbian card. But you may skip this step in case you do. This will be executed on next start. So feel free to do it first thing.
Next important option is change pass and you need it no-mater what. It will change your default user's with username pi password. It is similar to user with root permissions... So be sure to do it. Note password symbols are not displayed during entry.
change timezone goes next. If you do not leave in other timezone, like I do, change it. ;) Note pi does not have an internal "bios" clock so you would need to do it. Because time is used from internet atomic clocks...
memory split is also important option that help you to manage precious pi's RAM. I've used 16 because I will not need GUI and will run "headless", using it via ssh/network services. To use GUI consider 32+ Mb or RAM for video memory. But note RAM is really in lack for most modern services. and you may need every Kb of it in future.
ssh is our main goal. To access it/configure it in future. Hit it to enable ssh connections.
and you can run update if you have already connected network somehow :).
That's it with basic config for our needs. Here goes...
3. Static network configuration.
I think this is the most important part. Because I have googled a lot to find a proper solution for my needs.
Pi is connected via dhcp IP address, usually given randomly by your router. And you need to make it static to know you will always have pi under certain network address.
You may know your Pi's ip address by entring route command into prompt. Yo will see something like this.
pi@raspberrypi ~ $ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
Here you can see your network is in range 192.168.1.x. Biut if you are configuring your Pi without actual network config, like I did, you will need to do something like this:
You need to know it from your router config. And you can simply connect it via network, if you did it properly in past. Or either connect, like you did for initial router config. You need something like this, saying about your LAN network address. I have a wired mix of different network decisions in my router. So note your typical network router address here:
Anyway this tells me that I have a wire (LAN) IP network with adress range 192.168.1.x where x is between 1 and 254. Your DHCP in router may work in another way and have different interface. So you may have other IP range set. E.g. Mine had a 100-199 range by default:
This are data required for our Pi network config. We need to manually change this in our Pi's config files.
Try to do this:
cd /etc/network sudo nano interfaces
This will start default Pi's text editor, called "nano", pointing to networks configuration file. Here is how it might look like:
iface eth0 inet dhcp with lines.
iface eth0 inet static address 192.168.1.140 netmask 255.255.255.0 gateway 192.168.1.1
This will create a static address for our Pi. Now to make sure we have a proper DNS. Go to editing /etc/resolv.conf. E.g. type:
sudo nano /etc/resolv.conf
Mine had a a line:
Pointing to google's DNS. And I've left it, adding my router as a first DNS. So my resolv.conf became looking like:
nameserver 192.168.1.1 nameserver 22.214.171.124
And that's it. After doing this you would have to restart network interfaces. Or better do "sudo reboot" to make sure everything is configured. At this point you are OK to go running headless already. You can now do ssh connections to static ip at your pi.
So to use it you would need only to type in your terminal:
This will connect you to your pi. And you are ready to go ahead.
you may see something like this:
And to finish here is how my Pi looks like in a "printable case" The Punnet from user "E". Thanks to him.