This is Good Pi, Part 1
Good Pie!
The Raspberry Pi 4 came to market just a few weeks ago. For $35 to $55, plus some peripherals, you can run a desktop computer nearly as powerful. If youāre in the market and have the opportunity, I recommend you pick up the Raspberry Pi 4. For this project I am going to use a Raspberry Pi 3 B+. Itās not hearty enough for serving up steady HD video, but it should be fine for some of the projects that I have been working on at Flatiron.
Raspberry Pi 3 B+
So, wait, what is a Raspberry Pi? If youāre not yet aware, the Pi is a palm-sized computer originally built for young student learners. It is low cost and low power. It comes with no software preinstalled. A flavor of the Debian Linux operating system, called Raspbian, can be installed on an inexpensive microSD card and plugged into the available slot on the Pi board. Some versions come with USB and HDMI ports. All come equipped for Wireless and Bluetooth. It is built with the novice in mind and comes ready with most of the software you might need to use the Pi like any other home computer.
Raspberry Pi Zero W
What can you do with a Raspberry Pi? A lot. Iāve talked about using a Raspberry Pi to build (but not yet completely documented) my TNYGLXY project, started here: TNYGLX ā Raspberry Pi Hardware & Software. A host for a TinyMux server. I hope to build a audio server and home automation interface, replacing commercial hardware by companies that donāt have a stellar relationship with privacy. And, of course, a development server for Rails and React applications.1
Letās get going on our low-power server build.
Hardware
Raspberry Pi 3 B+
5v Power Source with Micro USB connection
A case (optional, but recommended)
16GB MicroSD card (at least)
MicroSD card reader (if not built into your computer
A Computer (Windows/Mac/Linux)
A Wired Network Connection
Software
Copy of a Raspbian Image (As of this writing, the Buster release; Iām using Buster Lite)
Some way to write the Raspbian Image File. Iām using balenaEtcher, which is available for all Operating Systems.
Some space on your local hard drive to keep the Raspbian Image
A zip utility
An SSH utility, like PuTTY
There is a version of Raspbian with a Window or Mac-like User Interface. For this project, by using the Lite image, I am omitting the UI and much of the standard packages (or software) that come with the larger installations. This gives me more control over whatās on my device, with the goal of navigating over potential conflicts. This system will also run āheadlessā (that is, without a monitor, keyboard, or mouse). Iām can SSH directly into my Pi from any one of the computers that I keep around me at all times (including my phone).
Write the ISO to the SD Card
The first step is to get ISO written to the SD card. Place a formatted SD Card (FAT32 for cards smaller than 32GB; exFAT for anything larger. Iām using 16GB which is more than enough) in the card reader attached to your computer. When the drive is ready, you can start writing the ISO Image of Raspbian to the card.
balenaEtcher is dead simple to use. Simply click through the prompts until you get to the finished product. Follow along in the gallery below.
Select an Disk Image
ā Back
Next āŗ
Picture 1 of 8
jQuery(function($) new NggPaginatedGallery('e9ecbb10f4019f34a6abdd60a3df281d', '.ngg-imagebrowser'); );
Add SSH file to boot Partition
boot(H:) and USB Drive (I:) are two partitions on the SD Card. I: contains the Raspbian OS; boot is for configuration
Once balenaEtcher is done her magic, you will find that your SD card now has two partitions.
no extension on the ssh file
In the ābootā partition, add an empty file named āsshā. This will let the Pi know to configure itself to accept an SSH connection from an external sources, ie: you.
Connect it Up
Carefully, remove the SD card from your computer, and insert it into the SD card slot on your Pi. Connect your network cable to the Ethernet port2 and then attach the power cable. Do this the other way around and you might not get assigned an IP address and nothing else will work.
There is a red LED on the front of the Pi. You can tell by the number and frequency of flashes how the boot is progressing. Once itās solid red, youāre good to go. Any other pattern, there are problems. Consult the Raspberry Pi documentation as thatās not in scope for this tutorial.
Here is where things could get sticky. You need to find the IP Address for the Pi. The way thatās easiest for me in this headless scenario is to see what my Internet Router has assigned to the little computer.
Note the IP Address for your Pi
To do that, I logged in to my router and looked for connected devices. The one labelled āraspberrypiā is, obviously, the one I want.
If you donāt have access to your router (say, you were accessing your device on a public or work network), it would be best to connect a keyboard and monitor to the Pi and complete the steps *after* the bit with PuTTY.
Configure PuTTY
Putty Terminal. Create a āStored Sessionā to login to the Pi in the future
PuTTY is an Terminal SSH/Telnet utility that Iāve used for years. Iām sure you have, too, if youāve had to remove connect to a network, especially before things like VPN utilities became so widely used. This is less user friendly than those, but certainly more powerful.
When you open PuTTY (or any other SSH utility) you will need to create a session. Enter the IP address of your Pi in the Host Name field.3 Select a connection type of āSSH.ā The port should set to ā22.ā If it does not, you can fix it.
I like to save my session so I can quickly access the Pi later. Give it a name and click āSave.ā
For now, you can leave all other settings as they are.
Login
In PuTTY, click the button āOpen.ā The configuration screen will close and a terminal window will open.
Click āYesā to store the ssh key
First, you may have to confirm the ssh key fingerprint. Clicking āYesā will add the key to PuTTYās cache and save it for future connections. Click āYes.ā
The login is āpiā and the default password is āraspberry.ā You donāt have to but probably should change the password.
The default login for the Raspbian is āpiā with a password of āraspberry.ā When you log in, you should be see the prompt:
pi@raspberrypi:~ $
At that prompt, type āpasswdā to change your, you know, password. You will have to confirm the existing password, choose a new one, and then confirm the new one.
Once thatās done and dusted, itās time to update and upgrade your Pi.
Update and Upgrade
Why upgrade? When you downloaded your copy of the Raspbian Image, the date/time stamp on the release was likely in the past. Linux-based systems are updated constantly. So, between the time the release was published and now, there were likely updates made to packages by the great opensource community.
Type in the following:
sudo apt-get update
This will download to your Pi a catalogue of all packages with changes. This will help the next process we run determine what packages need updating.
Type:
sudo apt-get upgrade
This will likely take a while, so go get a Diet Mt. Dew.4. What this command does is go through that list of updates, pulls down, and upgrades the packages currently on your pie. When itās done you can be sure you have the latest and greatest available to you.
To run these two commands on a regular basis is good practice. Unless you have very specific requirements for your machine that requires a targeted or customized updates, this is the way forward.
Whatās Next
Now that the Raspberry Pi is powered up and running Raspbian, you can start to load up on the other pieces of software you may need for a purpose built staging server. For the stack I work with, in the next blog post, I will install the following, along with any dependencies:
Git
Ruby
Ruby on Rails
React.js
Bootstrap/React Bootstrap for UI
Until next timeā¦
Currently Raspberry Pi 3 B+ is $24 at your favorite computer super center, Microcenter. The Raspberry Pi Zero W is $5. Not as much power, and no wired Ethernet access, but a good place to start with a low barrier to entry. Amazon does *not* have the best prices. If youāre looking to buy in bulk, for whatever reason, try going right to the US Distributors. As for peripherals, including power and cases, bad is cheap; best is not that much more expensive. Better to buy the official branded or nearly anything they carry at Microcenter. Here, again, Amazon power supplies for the Pi have failed me. ā©
New Raspberry Pis come with Wireless built in. Once your device is up and running you can turn on the wireless, if you choose. ā©
In the future, you may want to point a domain name or subdomain at the dynamic IP address assigned by your service provider to your home internet connection, and then route that traffic to the local IP of your Pi. I will write a future blog on this topic. ā©
Official Drink of Extreme Developers and Night Nurses. ā©
First Published Here http://tiwygwymw.us/ii
by Robert Pedersen














