As noted in a previous post, echo4golf.com and this blog are self-hosted. They run on a Raspberry Pi Linux based computer. If you’re not familiar with the Raspberry PI, check out the history of the Raspberry Pi foundation at the Raspberry Pi Foundation web site. Basically, it’s a complete linux-based computer system on a card about the size of a Altoids tin. A new Pi runs less than $50 shipped, and all the user needs to do is add an SD card, hook it up to an HDMI capable TV, plug it in to a cell phone charger and go! OK, it might be a bit more complicated than that. New users or those unfamiliar with Linux will want to read up on the process from the numerous sources available. But the Pi is a very useful little device. Furthermore, the latest version, the Raspberry Pi V2.0 has twice the memory and runs about six time faster than the original. The author has procured a v2 Pi, and this article is the first in a series describing the migration of the e4g servers from the original to the new PI, as well as some basic changes to stabilize the server configuration prior to the migration.
The author’s new Pi came from eBay seller PhotoDeals, who were not only offering the best price from a US based vendor, but had the unit in stock. The RPi2 is still new enough that it can be challenging to find. The vendor shipped quickly, and the unit arrived within three days. Not bad considering it was ordered on a Friday! The unit cost $49.99 with free shipping. As of this writing, the price has been reduced to $44.99.
As a bit of a side note, careful shopping on eBay will yield some great buys on the original RPi. Be careful though. It appears that a lot of vendors aren’t clear on the differences and are selling the original as RPi V2. The difference between the two is significant and the older slower ones should be dropping in price, one would think. PhotoDeals has the older model for about $35.
The new unit is pretty much the same form factor as the original Model B Pi. It won’t use the same case, however as there are four USB ports instead of two. Additionally, migrating the system is not as simple as moving a drive and installing new drivers. The original Raspberry Pi uses a standard SD card as a boot drive and for storage. The new Pi v2 uses a micro-SD. Although the card-based system is acceptable for many users, those who intend to utilize databases (by installing WordPress or OwnCloud, for example) would do well to migrate the operating system to an external drive before discovering how easily they can be corrupted on an SD card. Yes, that’s the voice of experience! Before we get that far, however, some basic configuration is in order.
You’ll want to get your Pi out of the box and remove packing materials. For this stage of the operation a keyboard and monitor or TV with an HDMI port is necessary. Once the system is set up, you’ll be able to run it remotely via an SSH connection.
The first step in configuring a Raspberry Pi is the creation of the bootable SD card. There are all sorts of instructions online but, following the KISS principle, the author chose to install NOOBS (New Out of Box Software).
The alternative is not all that challenging, and merely involves getting the image for a chosen operating system and writing it the the card. “Official” Images are available at http://www.raspberrypi.org/downloads/. There is the Debian based “Raspian,” a Fedora based “Pidora,” a couple of media center setups, and RISC OS (about which your author knows nothing except it’s not Linux, Windows, or Mac-based). Should you choose to go that route, instructions are freely available from many sites. Basically though: get the image, unzip it, use SDFormatter from the SD Association (https://www.sdcard.org/downloads/formatter_4/ as of this writing) to format your card, write the image with Disk Imager (http://sourceforge.net/projects/win32diskimager/) from Source Forge, insert the card, and start the Pi by plugging it in…
Setting up NOOBS is simpler. Download it from http://www.raspberrypi.org/downloads/. Unzip it. Copy the files to the root of the card. Start the Pi. Done. If you have problems, run the SD Fomatter above, with the size correction setting enabled. Then restart the card again.
Once you’ve start the Pi, you’ll see a list of the operating systems available. The author uses the Debian-based Raspian. In any case, check the box for the operating system of your choice and grab a cup of coffee or a beer while the OS installs.
As the install completes, the system will run the Raspi-Config utility. There’s not a lot that you have to do here but you should set all three of the “Internationalisation Options.” Among other things, this will avoid issues with your keyboard and, later on, with the SSSL Certificate system.
- Select number 4. “Internationalisation Options.” and then I1, “Change Locale.” Select as appropriate. The author selected all three “en_us” options with utf-8 as the default.
- Select 4 again and this time choose I2 “Change Timezone.” The list is alphabetical and US is at the bottom. After that you’ll be able to select the specific timezone appropriate to your locale.
- Once more, select 4 and, last but not least, choose I3 to change the keyboard layout. There are specific keyboards listed but the author uses “Generic 101-key PC.”
A couple of other things that you might want to consider, while you’re in Raspi-Config, are enabling the SSH server for remote or “headless” access, if you don’t leave the Pi attached to a monitor and keyboard, and setting a network host name.
To enable the SSH server, select 8, “Advanced Options,” and then A4 “SSH.” You’ll see a screen asking if you wish to enable the server. Select yes and hit return. You’ll see another screen telling you that the server is enabled. Select OK and you will be taken back to the menu.
To set a host name instead of the default, select 8 again, and then A2 “Host Name.” Pay attention to the naming requirements as the utility will not tell you if you use an incorrect name. Underscores (_), for example, are not valid, however dashes (-) are.
Once you’ve completed the configuration, select “Finish” and allow the system to reboot. Don’t disconnect it from the monitor and keyboard just yet, however, as the next step is to set up the Pi to run from an external hard drive, rather than the SD card.
Reboot the system and then we’ll look at moving the root to a hard drive.