pi:raspbian
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pi:raspbian [2019-08-10 14:05] – heading gabriel | pi:raspbian [2020-05-19 09:39] (current) – [Raspbian] updating overview gabriel | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Raspbian ====== | ====== Raspbian ====== | ||
- | This page documents | + | Documentation for my local Raspberry Pi 3 B+ config. |
- | * Add OpenSSH authorized_keys for root user | + | ===== Before first boot ===== |
- | * Remove all key types except rsa and ed25519 from sshd_config | + | |
- | * Remove | + | By default Raspbian attempts to grow the root partition of your system on first boot to fill your entire SD card. To disable this option do the following on the SD card image before first boot. |
- | * '' | + | |
- | * '' | + | * Remove |
- | * '' | + | * Remove |
- | * '' | + | |
- | * Make '' | + | ===== After first boot ===== |
- | * Set static IP address | + | |
+ | The following steps should be completed after first boot to configure the Pi for remote management. | ||
+ | |||
+ | ==== Set vim as the default editor | ||
+ | |||
+ | < | ||
+ | apt install vim | ||
+ | update-alternatives --set editor / | ||
+ | </ | ||
+ | |||
+ | ==== Disble IPv6 ==== | ||
+ | |||
+ | Add the following to '' | ||
+ | |||
+ | < | ||
+ | # disable IPv6 | ||
+ | net.ipv6.conf.all.disable_ipv6=1 | ||
+ | </ | ||
+ | |||
+ | ==== Configure | ||
+ | |||
+ | Edit ''/ | ||
< | < | ||
- | # See dhcpcd.conf(5) for details. | + | # Static eth0 configuration |
interface eth0 | interface eth0 | ||
- | static ip_address=$IP/$MASK | + | static ip_address=10.77.3.6/24 |
- | static routers=$ROUTER | + | static routers=10.77.3.1 |
+ | static domain_name_servers=10.77.3.4 10.77.3.5 | ||
</ | </ | ||
- | * Set '' | + | Add our local domain to the default search path configured by '' |
< | < | ||
- | # Configuration for resolvconf(8) | + | echo " |
- | # See resolvconf.conf(5) for details | + | </ |
- | resolv_conf=/ | + | ==== Configure OpenSSHD on boot==== |
- | # If you run a local name server, you should uncomment the below line and | + | |
- | # configure your subscribers configuration files below. | + | |
- | search_domains=in.quay.net | + | |
- | # BUG WORKAROUND: space separated lists of DNS servers are not currently working | + | |
- | name_servers=$NS1 | + | |
- | name_servers_append=$NS2 | + | |
- | # Mirror the Debian package defaults for the below resolvers | + | Set to run on boot. |
- | # so that resolvconf integrates seemlessly. | + | |
- | dnsmasq_resolv=/ | + | < |
- | pdnsd_conf=/ | + | systemctl enable ssh |
- | unbound_conf=/ | + | systemctl start ssh |
</ | </ | ||
- | * Remove pi default user | + | ==== User configuration ==== |
- | * Remove pi group | + | |
- | * Add new default user and group | + | |
- | * Add sudoers entry for user | + | |
- | * Set password | + | |
- | * Update ntp config; '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * Set timezone to Toronto: '' | + | |
- | * Remove MOTD text ''> | + | |
- | * Install git and needrestart | + | |
- | Raspbian appears to have issues with managing network dependencies during boot. This script ensures that BIND, dhcpd, and NTP start up correctly after the network interface is properly set up. It is run via ''/ | + | The following user modifications are made. |
+ | |||
+ | === local user === | ||
+ | |||
+ | Add local user: | ||
< | < | ||
- | #!/bin/bash | + | groupadd -g 1778 gabriel |
+ | useradd -u 1778 -c " | ||
+ | passwd gabriel | ||
+ | </code> | ||
- | until fping -qc 3 8.8.8.8 > /dev/null 2>& | + | === pi === |
- | echo " | + | |
- | done | + | |
- | for daemon in isc-dhcp-server bind9; do | + | Disable pi user: |
- | echo " | + | |
- | service $daemon restart | + | |
- | done | + | |
- | echo " | + | < |
- | service ntp stop | + | usermod |
- | ntpdate | + | |
- | service ntp start | + | |
</ | </ | ||
- | ===== Service management under systemd ===== | + | === root === |
- | * Add service to systemd init process: '' | + | Now set root password. |
- | * List all services: '' | + | |
- | ===== Disable WiFi completely ===== | + | === ansible |
- | Blacklist the driver by creating a file in ''/ | + | Add ansible user: |
< | < | ||
- | blacklist brcmfmac | + | groupadd -g 1111 ansible |
- | blacklist brcmutil | + | useradd -u 1111 -c " |
+ | usermod -p ' | ||
</ | </ | ||
+ | |||
+ | Configure the following sudo rule for ansible: | ||
+ | |||
+ | < | ||
+ | # Ansible control user | ||
+ | ansible ALL=(ALL) NOPASSWD: | ||
+ | </ | ||
+ | |||
+ | Copy SSH keys for Ansible user. | ||
+ | |||
+ | ==== Sudoers config ==== | ||
+ | |||
+ | Set '' | ||
+ | |||
+ | ==== Grow root partition ==== | ||
+ | |||
+ | Use '' | ||
+ | |||
+ | < | ||
+ | # grow partition | ||
+ | parted | ||
+ | |||
+ | unit GiB | ||
+ | resizepart 2 42.25 | ||
+ | |||
+ | # resize filesystem | ||
+ | resize2fs / | ||
+ | </ | ||
+ | |||
+ | ==== raspi-config ==== | ||
+ | |||
+ | Run the '' | ||
+ | |||
+ | * **2 Network Options** -> Hostname -> Set hostname | ||
+ | * **4 Localization** | ||
+ | * **I1 Change Locale** -> en_CA.UTF-8 UTF-8 -> disable en_GB.UTF-8 UTF-8 -> Set default locale to C.UTF-8 | ||
+ | * **4 Localization Options** | ||
+ | * **I2 Timezone** -> America -> Toronto | ||
+ | * **4 Localization Options** | ||
+ | * **I3 Change Keyboard Layout** -> Generic 104-key PC -> Other -> English (US) -> English (US) -> The default for the keyboard layout -> No compose key | ||
+ | * **4 Localization Options** | ||
+ | * **I4 Change WLAN Country** -> CA Canada | ||
+ | * **7 Advanced Options** | ||
+ | * **A3 Memory Split** -> 16 | ||
+ | |||
+ | ==== Additional hardware configuration via config.txt ==== | ||
+ | |||
+ | These settings involve manual configuration of ''/ | ||
+ | |||
+ | === Disable unneeded networking === | ||
+ | |||
+ | < | ||
+ | # disable WiFi | ||
+ | dtoverlay=disable-wifi | ||
+ | |||
+ | # disable Bluetooth | ||
+ | dtoverlay=disable-bt | ||
+ | </ | ||
+ | |||
+ | Disable modem service per boot overlays doc: | ||
+ | |||
+ | < | ||
+ | systemctl disable hciuart | ||
+ | </ | ||
+ | |||
+ | === Disable audio driver === | ||
+ | |||
+ | Comment out the audio driver: | ||
+ | |||
+ | < | ||
+ | # Enable audio (loads snd_bcm2835) | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | ==== Configure OpenSSH server ==== | ||
+ | |||
+ | Disable all keys except ed25519. | ||
+ | |||
+ | < | ||
+ | cat " | ||
+ | rm -fv / | ||
+ | dpkg-reconfigure openssh-server | ||
+ | </ | ||
+ | |||
+ | ==== Packages ==== | ||
+ | |||
+ | < | ||
+ | vim | ||
+ | ntp | ||
+ | isc-dhcp-server | ||
+ | bind9 | ||
+ | dnsutils | ||
+ | whois | ||
+ | fping | ||
+ | git | ||
+ | tmux | ||
+ | mksh | ||
+ | zsh | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Services ==== | ||
+ | |||
+ | Service modification | ||
+ | |||
+ | < | ||
+ | systemctl disable apt-daily-upgrade.timer | ||
+ | systemctl disable apt-daily.timer | ||
+ | </ | ||
+ | |||
+ | ===== See also ===== | ||
+ | |||
+ | * [[quay: | ||
+ | * [[quay: | ||
+ | * [[quay: |
pi/raspbian.1565460306.txt.gz · Last modified: 2019-08-10 14:05 by gabriel