This is a howto document created as a basis for all my other Raspberry Pi Progjects. Here, I list the basic hardware needed as well as the steps necessary to create your own basic Raspberry Pi setup.
This is just the beginning of several Raspberry Pi Projects.
My general setup consists of:
Raspberry Pi 2
- Raspberry Pi 3
- microUSB Power adapter
- 8Gb SD card or larger
- RJ45 network cable*
- 802.11b/g/n wireless USB adapter*
- HDMI-to-VGA adapter*
- USB Mouse*
- USB Keyboard*
- …and a monitor.*
* these are optional expenses because you may already have access to these.
- Raspbian has been my OS of choice for the Raspi, for no particular reason
- Win32DiskImager has been a great tool for getting the OS image loaded on the SD card.
- The first step is to download the latest OS image. I’ll be using Raspbian as noted above.
- With the SD card connected to your PC, open Win32DiskImager. On the right, select the drive letter of your SD casd. On the left, select the Raspbian .img file you downloaded previously. Click Write.
- When the image copy process is complete, you may exit Win32DiskImager and remove the SD. Place the SD card in your Raspberry Pi.
- Connect the monitor adapter, mouse, keyboard, a network cable (for now) and then power. The lights on the Raspberry Pi should blink. PWR will turn red and ACT will blink green when the Raspberry Pi is booting from the SD card. (It will appear solid during boot.)
- If the monitor does not receive a signal, your Pi may not be connecting with the HDMI adapter. To correct this, disconnect power and put the SD card back in your PC. With a text editor (I use vim – see below) open the config.txt file and removed the # from the line HDMI_SAFE=1. Save the file and boot the Pi with the updated change. (This is a common problem with VGA adapters.)
- After a successful boot, you should see the raspi-config screen.
- From the raspi-config screen, the first menu option is the “Expand Filesystem”. This will “unpack” the condensed OS to take full advantage of the SD card’s size.
- The next step (Option 2) is to set the user password. By default, the password for the user account “pi” is “raspberry”. Many users keep the default password, but this is inadvisable if it will be externally available to the internet. (You can change your password in the future by running sudo raspi-config or simply typing passwd at the command line.
- Option 4 in the raspi-config allows you to set your local Time Zone.
Also under Option 4, I also select my keyboard layout. I have a standard, generic 104 key US keyboard attached to my Pi and selecting this ensures the keys perform as expected. (If you get weird characters out of your keyboard, you might recheck which keyboard is selected in this menu.)
- Option 8 opens an menu to change additional settings. The steps below will be found in the Advanced Options menu.
- A2 allows you to set a hostname. This is important if you have more than one Pi to work with. I try to give my Pis descriptive hostnames.
- A3 is useful if you know you will not be using the GUI with your setup. The Memory Split feature allows you to set the amount of memory available to the Graphics Processing Unit. If, like many of my projects, you will only be using the command line, it could be beneficial to give the system more RAM and the GPU less RAM. (The minimum is 16Mb RAM.)
- A4 enables the SSH server. This is vital to my uses since most of my Pis do not remain connected to a monitor, mouse and keyboard. SSH allows me to remotely connect to the Pis command line from any other host on my network and even when I’m away from home.
- The other options Advanced Options are up to the user if those settings are right for them. They are only needed if the user knows they need those features. I generally do not so I go back to the Main menu at this point.
- The last setting I change from the main menu is Option 3. In this menu I select if I will be using the text-based console or the graphical desktop. Almost all of my Pis run “headless” (no monitor) from the command line, so I generally boot to the console. This is because if I’m not going to be using the GUI, there’s no need to have it running all the time and tying up system resources (processor power and RAM).
- After all the settings have been set how you want (for now) it’s time to choose Finish at the bottom. You may need to reboot your Pi at this point for all your changes to take effect.
- After rebooting, the first thing I do is ensure I have the latest software packages installed. This ensures I do not have any faulty software running and I’m not vulnerable to any malicious exploits. To update to the latest software, ensure your Pi is connected to the internet (still through our network cable) and then type the following command sudo apt-get update. This command will update the list of all available softare for your pi. Several dozen repositories are contacted to find all the necessary software packages available.
- Once the sudo apt-get update process is complete, the next step is to tell the pi to update all of those newly discovered packages.
This can take a while. To issue this command, type sudo apt-get upgrade.
- At this point your Raspberry Pi is configured and usable. What you do now is entirely up to you. Below I’ll offer a couple of extra configuration steps I do.
vim Text Editor
- I prefer to use the vim text editor for Linux. Yes, it’s got a learning curve to it, but once you know how to use vim (or vi) you’ll rarely be lost without a text editor in Linux. (nano and pico are fine for newbies 😉
- To get the latest version of vim installed on your Pi, grab it with sudo apt-get install vim.
- Once vim is installed, you’ll want to link to it rather than the original vi editor with ln /usr/bin/vim vi
…Oh and O’Reilly Books has a great book to help you get started with vi/vim.
Most of my Raspberry Pi projects run from my ham radio shack/workshop, behind my house. Until Fall 2015, I did not have any wired networking in the building so I relied on wifi. The connection was spotty at times and so I opted to run fiber through an underground conduit to my shop. My projects now connect through a multiport switch to the fiber and to my home network. Because of this particular setup, I do not need a wireless adapter for most of my setups.
For those that do need wifi, here’s a quick, easy way to setup wifi from the command line.