Wednesday, December 5, 2018

Headless Raspberry Pi - Initial Baseline Configuration

Prerequisites/Assumptions

Making the assumption that you can follow the instructions on the Raspberry Pi web site to download and install the Raspbian Lite image on a Micro SD card.  Installing Raspberry Pi Operating System Images

Setup the Raspberry Pi

From the PC used to install Raspbian on the Micro SD card, configure the Pi to allow SSH access by creating an empty file named 'ssh' in the /boot directory on the Micro SD (may need to mount it first).  This will enable running the Pi without a monitor, keyboard and mouse (i.e. headless).

If you need to run your Raspberry Pi via WiFi (i.e. You have the Pi 3 A+ wireless only version) you will need to mount the  rootfs partition on the Micro SD card from your PC and edit the /etc/wpa_supplicant/wpa_supplicant.conf file and add your Wi-Fi network settings at the bottom, then save and unmount the Micro SD card.  Note: the double-quote marks are required.
network={
    ssid="Your SSID goes here"
    psk="Your Wi-Fi password goes here"
}
Insert the Micro SD into the Raspberry Pi and connect the Pi to your network via CAT5/6 Ethernet cable (or not if you are using Wi-Fi).  Then connect the power cable to the Pi.  

After a few minutes the Pi should boot and receive an IP address from your router and register itself to your local internal DNS.  

Try SSH'ng to pi@raspberrypi, if unsuccessful try pi@raspberrypi.local.  If that still doesn't work, you will need to login to your router and figure out what IP address was assigned to your Raspberry Pi.  If you are connecting from a Windows PC I recommend using the PuTTY SSH client.  (PuTTY SSH Client Download)  The default password for the pi user is "raspberry".

Initial Raspbian Configuration


You should see something similar the first time you SSH to the Pi:

Next we will run the raspi-config command as root:

sudo raspi-config
1st thing to do is change the "pi" user's password, by selecting Change User Password.
Under Network Options select Hostname and we'll change the hostname to mhag and select <Ok>.

You can substitute whatever you like for mhagI chose this name because this How To is a prerequisite for installing a program I have developed named the Multi Host Availability Grapher.


Under Localization Options
select  Change Locale and enable en_US.UTF-8 UTF-8, select <Ok> and then set the Default locale to C.UTF-8 and select <Ok> again.


Go back into Localization Options and select Change Timezone and set it to your timezone and select <Ok>.


Again go back into Localization Options and select Change Wi-fi Country and set it to your country and select <Ok>.

Under Advanced Options choose Expand Filesystem then select <Ok>.


Select <Finish> and then select <Yes>  to reboot now.


After a few minutes you should be able to SSH back into the Raspberry Pi as pi@mhag 


No comments:

Post a Comment