04-03-2022
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
# Headless
|
||||
# Installation Headless
|
||||
|
||||
|
||||
|
||||
Télécharger l'image [Raspian Stretch Lite](https://www.raspberrypi.org/downloads/raspbian/) et l'installer sur la carte SD avec [Etcher](https://www.balena.io/etcher/).
|
||||
|
||||
Activer et connecter le wifi:
|
||||
### Activer et connecter le wifi:
|
||||
|
||||
Il faut créer un fichier `wpa_supplicant.conf` dans /boot
|
||||
|
||||
```bash
|
||||
# Depuis macOS
|
||||
```bash title="Depuis macOS"
|
||||
cd /Volumes/boot
|
||||
nano wpa_supplicant.conf
|
||||
```
|
||||
|
||||
|
||||
|
||||
```ini title="wpa_supplicant.conf"
|
||||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
|
||||
update_config=1
|
||||
country=FR
|
||||
@@ -24,19 +27,17 @@ network={
|
||||
}
|
||||
```
|
||||
|
||||
Activer SSH:
|
||||
### Activer SSH:
|
||||
|
||||
Il faut créer un fichier `ssh` dans /boot
|
||||
|
||||
```bash
|
||||
#Depuis macOS
|
||||
```bash title="Depuis macOS"
|
||||
cd /Volumes/boot
|
||||
touch ssh
|
||||
```
|
||||
|
||||
|
||||
Démarrer le Raspberry, il va se connecter automatiquement à la Box.
|
||||
Pour trouver l'ip, aller sur la box -> Configuration DHCP -> Baux DHCP valides
|
||||
Pour trouver l'ip, aller sur la box :material-arrow-right: Configuration DHCP :material-arrow-right: Baux DHCP valides
|
||||
|
||||
Se connecter au Raspberry en SSH:
|
||||
|
||||
@@ -56,12 +57,15 @@ Retype new UNIX password:
|
||||
passwd: password updated successfully
|
||||
```
|
||||
|
||||
Mettre en IP fixe:
|
||||
### Mettre en IP fixe:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/dhcpcd.conf
|
||||
sudo nano /etc/dhcpcd.conf
|
||||
```
|
||||
|
||||
```bash title="dhcpcd.conf"
|
||||
# à rajouter à la fin du fichier:
|
||||
|
||||
à rajouter à la fin du fichier:
|
||||
interface eth0
|
||||
static ip_address=192.168.1.24/24
|
||||
static routers=192.168.1.1
|
||||
@@ -73,16 +77,19 @@ static routers=192.168.1.1
|
||||
static domain_name_servers=192.168.1.1
|
||||
```
|
||||
|
||||
Ajouter la clé ssh:
|
||||
#### Ajouter la clé ssh:
|
||||
|
||||
```
|
||||
bruno@silverbook:~/.ssh$ ssh pi@framboise.local 'mkdir -p ~/.ssh; chmod 0700 ~/.ssh; echo ' $(< ~/.ssh/id_ed25519.pub) ' >> ~/.ssh/authorized_keys ; chmod 0600 ~/.ssh/authorized_keys'
|
||||
```
|
||||
|
||||
Sécuriser ssh:
|
||||
#### Sécuriser ssh:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/ssh/sshd_config
|
||||
sudo nano /etc/ssh/sshd_config
|
||||
```
|
||||
|
||||
```bash title="sshd_config"
|
||||
Port 36722
|
||||
PermitRootLogin prohibit-password
|
||||
|
||||
@@ -90,15 +97,21 @@ yes (défaut)
|
||||
# without-password (prohibit-password) authentification par mot de passe désactivée, # authentification par clé publique seulement
|
||||
# forced-commands-only avec l'option Commande, authentification par clé publique seulement
|
||||
# no
|
||||
|
||||
$ sudo service ssh restart
|
||||
```
|
||||
|
||||
Configurer le Raspberry:
|
||||
```bash
|
||||
sudo service ssh restart
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Configurer le Raspberry:
|
||||
|
||||
```bash
|
||||
$ sudo raspi-config
|
||||
sudo raspi-config
|
||||
```
|
||||
|
||||
```bash title="raspî-config"
|
||||
-Network Options -> changer le hostname
|
||||
-Localisations Options -> Change Locale, Change Timezone
|
||||
-Interfacing Options -> enable Camera, SPI, I2C, Serial
|
||||
@@ -106,13 +119,13 @@ $ sudo raspi-config
|
||||
-Update (raspi-config)
|
||||
```
|
||||
|
||||
Installer git:
|
||||
#### Installer git:
|
||||
|
||||
```bash
|
||||
$ sudo apt-get install -y git dirmngr
|
||||
sudo apt-get install -y git dirmngr
|
||||
```
|
||||
|
||||
Installer log2ram:
|
||||
#### Installer log2ram:
|
||||
|
||||
```bash
|
||||
cd /home/pi
|
||||
@@ -125,9 +138,9 @@ sudo ./install.sh
|
||||
sudo vi /etc/log2ram.conf
|
||||
```
|
||||
|
||||
Vérifier l'installation de log2ram:
|
||||
##### Vérifier l'installation de log2ram:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ df -h
|
||||
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
|
||||
/dev/root 15G 1,1G 13G 8% /
|
||||
@@ -148,16 +161,21 @@ sudo mv /etc/cron.hourly/log2ram /etc/cron.daily/log2ram
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
Mettre à jour le Raspberry:
|
||||
|
||||
|
||||
### Mettre à jour le Raspberry:
|
||||
|
||||
```bash
|
||||
$ sudo apt-get update && sudo apt-get upgrade
|
||||
sudo apt-get update && sudo apt-get upgrade
|
||||
```
|
||||
|
||||
Créer un alias dans .bashrc:
|
||||
alias update='sudo apt-get update && sudo apt-get upgrade'
|
||||
*Créer un alias dans .bashrc:*
|
||||
`alias update='sudo apt-get update && sudo apt-get upgrade'`
|
||||
|
||||
|
||||
|
||||
### Backup de la carte SD
|
||||
|
||||
Backup de la carte SD
|
||||
https://raspberrypi.stackexchange.com/questions/311/how-do-i-backup-my-raspberry-pi
|
||||
|
||||
```bash
|
||||
@@ -169,7 +187,7 @@ bruno@silverbook:~$ sudo dd if=/dev/rdisk2 bs=1m | gzip > /Users/bruno/Downloads
|
||||
bruno@silverbook:~$ sudo dd if=/dev/rdisk2 bs=1m | pv | gzip > /Users/bruno/Downloads/litePi_1.gz
|
||||
```
|
||||
|
||||
Restaurer:
|
||||
#### Restaurer:
|
||||
|
||||
```bash
|
||||
bruno@silverbook:~$ diskutil list
|
||||
|
||||
Reference in New Issue
Block a user