Raspberry Pi


installation

configuration

keyboard

https://wiki.debian.org/Keyboard

dpkg-reconfigure

$ sudo dpkg-reconfigure keyboard-configuration
$ sudo service keyboard-setup restart

manually

/etc/default/keyboard:

XKBMODEL="macintosh_hhk"
XKBLAYOUT="us"
XKBVARIANT="dvorak"
XKBOPTIONS=""

BACKSPACE="guess"
$ sudo service keyboard-setup restart

password

default login/password: pi/raspberry

$ passwd

console setup

dpkg-reconfigure

$ sudo dpkg-reconfigure console-setup

manually

/etc/default/console-setup:

ACTIVE_CONSOLES="/dev/tty[1-6]"

CHARMAP="UTF-8"

CODESET="CyrSlav"
FONTFACE="Terminus"
FONTSIZE="10x20"

VIDEOMODE=

locale

dpkg-reconfigure

$ sudo dpkg-reconfigure locales
$ logout
/ login

when connecting via SSH remote host will try to set the same locale as on local machine - this operation will fail if corresponding locale is not generated on remote server:

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

that is why it’s a good idea to have the same locale on both local machine and remote host.

manually

/etc/default/locale:

LANG=en_US.UTF-8

/etc/locale.gen:

...
# en_US.ISO-8859-15 ISO-8859-15
en_US.UTF-8 UTF-8
# en_ZA.ISO-8859-1
...
$ sudo locale-gen
$ logout
/ login

timezone

$ sudo timedatectl set-timezone Europe/Moscow
$ date
Sun 16 Apr 00:55:55 MSK 2017

network

man interfaces 5

Ethernet

https://www.mathworks.com/help/supportpkg/raspberrypi/ug/getting-the-raspberry_pi-ip-address.html

make sure RPI Ethernet lights are on during boot - I used a cable with 4P4C (instead of 8P8C) connectors by mistake and my router refused to talk to RPI.

Wi-Fi

https://wiki.debian.org/WiFi/HowToUse

NOTE: network module in RPI supports 2.4 GHz only (at least iwlist scan doesn’t show 5 GHz networks).

NOTE: pay attention to using double quotes around PSK (pre-shared key) in configuration files - only plain passphrase must be quoted, PSK is typed directly without quotes.

using WPA supplicant

https://wiki.archlinux.org/index.php/WPA_supplicant

packages

$ sudo apt update
$ sudo apt install locate mc htop omxplayer vim git iotop

vim

~./vimrc:

set showmode

set hlsearch
set incsearch

bash

~/.bash_aliases:

alias g='git'
alias ga='git add -A .'
alias gd='git diff'
alias gdc='git diff --cached'
alias gs='git status'

alias ll='ls -al'
alias mcu='mc -ub'

alias j='sudo journalctl -ef -u ntv-*'

~/.bashrc:

...
export EDITOR=vim

screen resolution

resolution

NOTE: HDMI cable must be plugged in before booting RPI - otherwise HDMI signal is not detected.

blanking

https://raspberrypi.stackexchange.com/a/61080

Ruby

package manager will install an outdated version of Ruby - build it from source or install package from stretch release instead.

install global gems after installing Ruby:

$ sudo gem install bundler git-up

build from source

install packages for openssl and readline extensions:

$ sudo apt install libssl-dev libreadline-dev

run make clean if you have already tried to compile Ruby before and got warnings about not installed extensions (because corresponding dev packages were not installed at that time).

$ cd ~/tmp
$ wget http://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz
$ tar xvzf ruby-2.4.1.tar.gz
$ cd ruby-2.4.1
$ ./configure && make && sudo make install
$ cd .. && rm -rf ruby-2.4.1.tar.gz ruby-2.4.1/

install package from stretch release

/etc/apt/sources.list:

deb http://archive.raspbian.org/raspbian/ stretch main
$ sudo apt update
$ sudo apt install ruby2.3 ruby2.3-dev

NOTE: install dev package as well to be able to build gem native extensions.

it’s necessary to remove Ruby built from source in order to use Ruby installed from repository (unless you use Ruby version managers such as RVM or rbenv):

$ cd ~/tmp/ruby-2.4.1
$ sudo make uninstall

uninstall target is available only if you installed Ruby previously from the same directory - otherwise run ./configure && make && sudo make install again.

also after downgrading Ruby version it might be necessary to update RubyGems (package manager for Ruby which provides gem command):

$ sudo gem update --system

or else you might encounter this error when trying to install global gems:

$ sudo gem install bundler git-up
ERROR:  While executing gem ... (TypeError)
    no implicit conversion of nil into String

SSH

Samba

https://wiki.debian.org/SambaServerSimple

shutdown

by default sudo shutdown schedules shutdown in 1 minute - run sudo shutdown now to shutdown immediately.

https://www.raspberrypi.org/documentation/installation/sd-cards.md:

$ sudo halt

useful commands

see Linux - APT Commands.