Raspberry Pi Headless Installation with SSH enabled and WLAN

You need only a few simple steps, to get a fully headless setup of Raspbian Stretch for your Raspberry Pi

First, write the downloaded raspbian image to the SD-Card

Be careful, to write the image to the right device!

unzip 2017-09-07-raspbian-stretch-lite.zip
sudo dd if=2017-09-07-raspbian-stretch-lite.img of=/dev/mmcblk0xyz bs=4M

 

Create a WLAN Configuration File

You need a WLAN template with your WiFi Settings.

vi wpa_supplicant.conf

country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={

ssid="My_WLAN"
psk="password"
key_mgmt=WPA-PSK
}

Reinsert the SD-Card and create and add some configuration files

Create an empty file called ’ssh‘ on the boot partition to enable ssh daemon:

touch /run/media/juergen/boot/ssh

Copy the earlier created WLAN config file:

sudo cp wpa_supplicant.conf /run/media/juergen/9a7608bd-5bff-4dfc-ac1d-63a956744162/etc/wpa_supplicant/

Change the hostname:

sudo vi /run/media/juergen/9a7608bd-5bff-4dfc-ac1d-63a956744162/etc/hosts
sudo vi /run/media/juergen/9a7608bd-5bff-4dfc-ac1d-63a956744162/etc/hostname

Unmount the SD-Card partitions:

sudo umount /dev/mmcblk0p2
sudo umount /dev/mmcblk0p1

Now insert SD-Card in Raspberry Pi and boot. Then you can ping the Pi and login with SSH:

ping dockerpi1
ssh pi@dockerpi1

After login change the default password of the pi user:

passwd

Also change the Locale and Keyboard layout if needed:

Set 'DE' for German:
vi /etc/default/keyboard

Change your Locale:
sudo dpkg-reconfigure locales

and your timezone:
sudo dpkg-reconfigure tzdata

Optionally

Optionally install also the DNS utils to get the nslookup command.

sudo apt-get install dnsutils

If you need autologin for the pi user add this file to your Installation

sudo vi /etc/systemd/system/getty@tty1.service.d/autologin.conf

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux

 

 

 

 

Schreibe einen Kommentar

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.