<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Sharpsteen.net</title>
 <link href="http://sharpsteen.net/atom.xml" rel="self"/>
 <link href="http://sharpsteen.net/"/>
 <updated>2026-02-09T10:55:18+00:00</updated>
 <id>http://sharpsteen.net</id>
 <author>
   <name>Charlie Sharpsteen</name>
   <email></email>
 </author>

 
 <entry>
   <title>Installing Raspbian on SD Cards</title>
   <link href="http://sharpsteen.net/blag/installing-raspbian-on-sd-cards/"/>
   <updated>2019-06-22T00:00:00+00:00</updated>
   <id>http://sharpsteen.net/blag/installing-raspbian-on-sd-cards</id>
   <content type="html">&lt;p&gt;Recently I have started dabbling with &lt;a href=&quot;https://www.raspberrypi.org/&quot;&gt;Raspberry Pi&lt;/a&gt; Single Board Computers
(SBCs). One of the first tasks encountered when setting up a new
Raspberry Pi is getting the Raspbian operating system loaded onto a SD card
that the computer will boot from. This involves copying the operating system to
the card and, commonly, configuring WiFi and SSH so that the Pi is accessible
after it boots up. Several articles out on the internet cover various aspects
of this process, but I couldn’t find one that gathered everything into one
place, so I decided to write the process down.&lt;/p&gt;

&lt;h2 id=&quot;step-1-install-raspbian-on-the-card&quot;&gt;Step 1: Install Raspbian on the card&lt;/h2&gt;

&lt;p&gt;The first step is to download a &lt;a href=&quot;https://raspbian.org/&quot;&gt;Raspbian&lt;/a&gt; disk image and copy it to
the SD card. The latest images can be found at:&lt;/p&gt;

&lt;p&gt; &lt;a href=&quot;https://www.raspberrypi.org/downloads/raspbian/&quot;&gt;https://www.raspberrypi.org/downloads/raspbian/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The instructions in this article will work with both the “desktop” and “lite”
versions of the distribution. When the download has completed, extract the
archive to get a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.img&lt;/code&gt; file. This image can be written to a SD card using the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dd&lt;/code&gt; utility:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo dd &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1m &lt;span class=&quot;nv&quot;&gt;conv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sync&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2019-04-08-raspbian-stretch-lite.img &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;«path to SD card device»
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This process will completely overwrite the SD card with the content of the disk
image which is usually:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;A &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot&lt;/code&gt; partition which uses the FAT32 filesystem. This contains the
bootloader code for Raspberry Pi hardware and is also where configuration
files can be created in order to ensure the computer starts with systems
like WiFi and SSH configured.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;A &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt; partition which uses the EXT4 filesystem. This contains the Linux
operating system which is launched by the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot&lt;/code&gt; partition as part of
startup.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;step-2-configure-wifi-and-ssh&quot;&gt;Step 2: Configure WiFi and SSH&lt;/h2&gt;

&lt;p&gt;Once the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.img&lt;/code&gt; file has been copied to the SD card, WiFi and SSH can be
configured by mounting the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot&lt;/code&gt; partition and writing configuration
files to it. The remainder of this section will assume the partition has
been mounted to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/Volumes/boot&lt;/code&gt;. Substitute another path, such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/mnt/boot&lt;/code&gt;,
as appropriate.&lt;/p&gt;

&lt;h3 id=&quot;configuring-wifi&quot;&gt;Configuring WiFi&lt;/h3&gt;

&lt;p&gt;The Pi can be configured to connect to a WiFi network when it boots by adding
a &lt;a href=&quot;https://linux.die.net/man/5/wpa_supplicant.conf&quot;&gt;wpa_supplicant.conf&lt;/a&gt; file to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot&lt;/code&gt; partition:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos; &amp;gt; /Volumes/boot/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=«your_ISO-3166-1_two-letter_country_code»

network={
    ssid=&quot;«your WiFi network name»&quot;
    psk=&quot;«your WiFi password»&quot;
    key_mgmt=WPA-PSK
}
&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The ISO country code is required to ensure the WiFi transmitter is configured
properly. A list of current codes can be found here:&lt;/p&gt;

&lt;p&gt; &lt;a href=&quot;https://www.iso.org/obp/ui/#search/code/&quot;&gt;https://www.iso.org/obp/ui/#search/code/&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;configuring-ssh&quot;&gt;Configuring SSH&lt;/h3&gt;

&lt;p&gt;By default, Raspbian will not start the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh&lt;/code&gt; service. This can be changed
by adding an empty file named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot&lt;/code&gt; partition:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;touch&lt;/span&gt; /Volumes/boot/ssh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will allow SSH access with Raspbian’s default username/password of
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pi/raspberry&lt;/code&gt;. If the Pi is connected to a network where it will be
exposed to other users or the internet-at-large, then you must connect
immediately after boot and use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo raspi-config&lt;/code&gt; to change the password.
This will prevent a hostile takeover of the computer as the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pi&lt;/code&gt; user has
access to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt; account via the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo&lt;/code&gt; command and the default &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;raspberry&lt;/code&gt;
password is well-known to other technical users and the internet-at-large.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Copying &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.img&lt;/code&gt; files to a SD card from various host operating systems:&lt;br /&gt;
&lt;a href=&quot;https://www.raspberrypi.org/documentation/installation/installing-images/README.md&quot;&gt;https://www.raspberrypi.org/documentation/installation/installing-images/README.md&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Configuring the Pi to connect to a WiFi network after boot:&lt;br /&gt;
&lt;a href=&quot;https://raspberrypi.stackexchange.com/a/57023&quot;&gt;https://raspberrypi.stackexchange.com/a/57023&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Enabling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sshd&lt;/code&gt; on first boot:&lt;br /&gt;
&lt;a href=&quot;https://www.raspberrypi.org/documentation/remote-access/ssh/README.md&quot;&gt;https://www.raspberrypi.org/documentation/remote-access/ssh/README.md&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 

</feed>
