Raspberry Pi

Introduction
Raspberry Pi is an ARM computer the size of a credit card that only costs 25/35 dollars.

It is produced by the non-profit foundation of the same name with the aim of teaching children how to program.

Raspberry Pi OS (previously called Raspbian)
We choose as the distribution to install Raspbian, which is a Debian distribution optimized for Raspberry Pi.

Download the latest available version: https://www.raspberrypi.org/downloads/raspbian/

Check the integrity of the archive: sha256sum *raspios*.zip

Decompress the archive: unzip -q *raspios*.zip rm *raspios*.zip

Write the image to the SD card previously connected to the PC (in my case /dev/sdd): sudo umount /dev/sdd[1-9]* /dev/sdd sudo dd bs=4M if=$(ls *raspios*.img) of=/dev/sdd conv=fsync & sudo kill -USR1 $(pidof dd)  # per vedere lo stato della copia sudo sync rm *raspios*.img

Remove the SD card from the PC, insert it into the Raspberry Pi and turn it on.

Connect to the Raspberry Pi via ssh: ssh -X pi@raspberry

A menu is presented at startup that simplifies the initial actions of configuring the operating system: │ Raspi-config                                                                │ │                                                                             │                                    │           info               Information about this tool                     │ │    x     expand_rootfs      Expand root partition to fill SD card           │ │          overscan           Change overscan                                 │ │    x     configure_keyboard Set keyboard layout                             │ │          change_pass        Change password for 'pi' user                   │ │    x     change_locale      Set locale                                      │ │    x     change_timezone    Set timezone                                    │ │          memory_split       Change memory split                             │ │          overclock          Configure overclocking                          │ │          ssh                Enable or disable ssh server                    │ │          boot_behaviour     Start desktop on boot? │                                   │           update             Try to upgrade raspi-config                     │

You can run the menu at any time with the command: sudo raspi-config

For convenience, add your public ssh key to the user pi, so you don't have to enter your password every time you connect: mkdir ~/.ssh vi ~/.ssh/authorized_keys chmod -R go= ~/.ssh

Set a password for the root user and change the default one of the pi user: sudo passwd root passwd

Install the latest available updates: sudo apt update sudo apt upgrade sudo apt clean

Wi-Fi USB
To configure a Wi-Fi USB stick, proceed as follows.

Generate the secret phrase string (psk) using this command: wpa_passphrase RouterName

Edit the configuration file, adapting ssid and psk: sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="NomeRouter" key_mgmt=WPA-PSK proto=WPA pairwise=TKIP group=TKIP psk=alphanumeric_string_of_the_secret_secret_frase_generated_with_the_previous_command }
 * 1) home network; WPA-PSK/TKIP

Bluetooth Keyboard
To configure a mini bluetooth keyboard, proceed as follows.

Install the necessary packages: sudo apt install bluez python-gobject-2

Set the computer as Discoverable: sudo dbus-send --system --type=method_call --print-reply \ --dest=org.bluez "/org/bluez/$(pidof bluetoothd)/hci0" \ org.bluez.Adapter.SetProperty string:Discoverable variant:boolean:true

Set the computer as Pairable: sudo dbus-send --system --type=method_call --print-reply \ --dest=org.bluez "/org/bluez/$(pidof bluetoothd)/hci0" \ org.bluez.Adapter.SetProperty string:Pairable variant:boolean:true

Put the bluetooth device in pairing mode so you can pair it with the computer.

Find the MAC address of the Bluetooth device: hcitool scan Scanning ... 0C:FC:84:00:03:78	BN1000

Associate the device to the computer: sudo bluez-simple-agent hci0 0C:FC:84:00:03:78 RequestPinCode (/org/bluez/1485/hci0/dev_0C_FC_84_00_03_78) Enter PIN Code: 1234 Release  # write the same PIN on the Bluetooth keyboard and press Enter New device (/org/bluez/1485/hci0/dev_0C_FC_84_00_03_78)

Set the bluetooth device as Trusted: sudo bluez-test-device trusted 0C:FC:84:00:03:78 yes

Connect the device to the computer: sudo bluez-test-input connect 0C:FC:84:00:03:78

Links

 * The MagPi - A Magazine For Raspberry Pi Users
 * element14 Community Group