Raspberry Pi3 installation and configure wlan/wifi (raspbian)

Today I’m setting up the raspi3 that I recently got from the pihut.
https://thepihut.com/
The pi3 has wifi built in (2.4Ghz only).

I use linux now, so in order to set it up with raspbian I performed the following steps.

Get the latest raspi (lite) image here: (I install all software by hand)
https://www.raspberrypi.org/downloads/

Unzip the image with:

unzip [filename]

I got an 8Gb SD card laying abouts. To write the unpacked imageĀ  [.img] to the SD card, do the following on linux [you may want to carefully watch where the kernel put you card-device with e.g. the command:]

dmesg

write the data:

dd if=2016-03-18-raspbian-jessie-lite.img of=/dev/mmcblk0 bs=1M

after a while it’s done. To perform a sync to flush all buffers, do:

sync
sync

and unplug the card, put it in your raspi, and turn it on.

To configure the pi from scratch, I connect it with an ethernet cable (no display). By default, the raspi image has eth0 on dhcp. I look up the address it got in my router, or use an ip scanner on my local network to see what it has become.

When you’ve located it, ssh to the IP address:

ssh pi@xx.xx.xx.xx

(where xx stands for the IP)
By default, the image has the password “raspberry” for user “pi”

Great to change that immediately.

sudo passwd pi
 [wisely choose a password]
 [enter it correctly again]

I want to change the root password immediately as well:

sudo passwd root
 [wisely choose a password]
 [enter it correctly again]

Now you’re still on eth0, and perhaps you want to use wifi.

Use your favorite editor like vi or nano to edit the following two files to configure it (I usually just do this with su – [password] as root/uid0 or you can do it as user pi with sudo):

(found at http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/)

vi /etc/network/interfaces

and change the contents to:

auto wlan0

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.100.200
netmask 255.255.255.0
gateway 192.168.100.254
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Change the ip adresses and network settings for your network, or leave these entries and specify: iface wlan0 inet dhcp (for dhcp, for just interface wlan0, leave the other entries intact)

and

vi /etc/wpa_supplicant/wpa_supplicant.conf

to change the wifi settings for your network:

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

network={
ssid="SSID"
psk="verysecret!"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

proto=RSN stands for WPA2

Of course you may want to update your pi:

apt-get update
apt-get upgrade
apt-get dist-upgrade

Reboot, and possibly do this again, maybe an apt-get autoremove is neccesary afterwards.

You’re now set up with your pi, you can use

raspi-config

to enable the camera or enable SPI or I2C, or other settings or functions, etcetera.
Don’t forget to expand the filesystem on the sd card, see raspi-config main menu, there’s an entry for it there.

Hope this helps you!
Have fun!

This entry was posted in raspi. Bookmark the permalink.