RPi 4 et boitier Argon One M.2 (avec SSD M.2)¶
https://www.argon40.com/argon-one-m-2-case-for-raspberry-pi-4.html
Le boitier accepte les SSD M.2 (Key-B ou Key-B&M)
Installer Raspberry Pi OS sur la MicroSD:¶
Télécharger Raspberry Pi OS
wget https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2021-01-12/2021-01-11-raspios-buster-armhf-full.zip
Copier Raspberry Pi OS sur la MicroSD avec Etcher
Booter sur la MicroSD.
Mettre à jour l'OS et le firmware:
sudo apt update
sudo apt full-upgrade
sudo rpi-update
Redémarrer le Raspberry.
Installer le dernier bootloader;
sudo rpi-eeprom-update -d -a
Redémarrer le Raspberry.
Configurer le boot du Raspberry Pi:¶
Ouvrir raspi-config:
sudo raspi-config
- Choisir Advanded Options puis Enter
- Choisir Bootloader Version puis Enter
- Choisir Latest (Use the latest version boot ROM software) puis Enter
- Choisir Non pour utiliser Latest boot ROM
- Choisir Advanded Options puis Enter
- Choisir Boot Order puis Enter
- Choisir USB Boot (si une carte SD est présente, le Raspberry démarrera sur la carte SD) puis Enter
Copier la carte SD sur le disque SSD:¶
- Lancer SD Card Copier depuis le menu Démarrer, section Accessoires.
- Choisir la carte SD pour Copy From Device.
- Choisir le SSD pour Copy to Device.
- Cliquer sur Start.
- La copie dure une dizaine de minutes...
- Eteindre le Raspberry.
- Retirer la carte SD.
- Redémarrer le Raspberry qui boote sur le SSD.
Outils Argon:¶
Installer Bouton Power et contrôle ventilo:
curl https://download.argon40.com/argon1.sh | bash
Fonctions Bouton Power:
Argon One Pi 4 State | Action | Function |
---|---|---|
OFF | Appui court | Démarrer |
ON | Appui long (>= 3s) | Arrêter et éteindre |
ON | Appui court (< 3s) | rien |
ON | Double tap | Reboot |
ON | Appui long (>= 5s) | Forcer l'arrêt |
Vitesse ventilo:
CPU Temp | Puissance ventilo |
---|---|
55° C | 10% |
60° C | 55% |
65° C | 100% |
Pour configurer:
argonone-config
Désinstaller:
argonone-uninstall
Mise à l'heure:¶
Installer le correcteur orthographique français:¶
sudo apt-get install myspell-fr
Installer des logiciels:¶
Gestionnaire de mot-de-passe: KeepassXC (keepassxc-2.3.4)
Clé SSH:¶
Clé une clé SSH:¶
$ ssh-keygen -t rsa -b 4096 -C "Clé sur Raspberry4"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/pi/.ssh/id_rsa):
Created directory '/home/pi/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Passphrases do not match. Try again.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/pi/.ssh/id_rsa.
Your public key has been saved in /home/pi/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:6TzjtL9Q31LwOwRAXMLyR2OEO+fYNlc5ccyux4zvhGo Clé sur Raspberry4
The key's randomart image is:
+---[RSA 4096]----+
| +++o o |
| . +o+ .+|
| o +o. .+|
| .+ o+ oo|
| S .B +*.|
| o ...=++o+|
| B .oo=o.|
| o = Eo o.|
| o.oo. ..|
Répertoire ~/.ssh
¶
pi@framboise:~/.ssh $ ls -la
total 28
drwx------ 2 pi pi 4096 févr. 4 14:35 .
drwxr-xr-x 33 pi pi 4096 févr. 9 13:46 ..
-rw------- 1 pi pi 846 juin 1 2019 authorized_keys
-rw-r--r-- 1 pi pi 369 févr. 4 14:41 config
-rw------- 1 pi pi 1675 févr. 4 2019 id_rsa
-rw-r--r-- 1 pi pi 394 févr. 4 2019 id_rsa.pub
-rw-r--r-- 1 pi pi 1776 févr. 4 14:49 known_hosts
Copier la clé publique ssh sur le serveur distant:¶
$ ssh-copy-id -i ~/.ssh/id_rsa.pub bruno@maboiteverte.fr
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/pi/.ssh/id_rsa.pub"
The authenticity of host 'maboiteverte.fr (212.227.191.167)' can't be established.
ECDSA key fingerprint is SHA256:iw66SSVTlEmiXO4kayKS1lHPbrTb5IT3CJtu9c4U7V4.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'bruno@maboiteverte.fr'"
and check to make sure that only the key(s) you wanted were added.
1ere connection sans mot-de-passe:¶
$ ssh 'bruno@maboiteverte.fr'
Enter passphrase for key '/home/pi/.ssh/id_rsa':
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-96-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
* Canonical Livepatch is available for installation.
- Reduce system reboots and improve kernel security. Activate at:
https://ubuntu.com/livepatch
New release '20.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Sat Feb 20 16:57:19 2021 from 86.209.226.200
bruno@localhost:~$
Créer le ssh-agent:¶
$ eval $(ssh-agent -s)
Agent pid 3551
Ajouter la clé ssh au ssh-agent:¶
$ ssh-add
Enter passphrase for /home/pi/.ssh/id_rsa:
Identity added: /home/pi/.ssh/id_rsa (Clé sur Raspberry4)
Pour retirer la clé privée¶
$ kill PROCESSID
Configurer le serveur ssh:¶
$ sudo nano /etc/ssh/sshd_config
# Ajouter:
Protocol 2
Port 36722
PasswordAuthentication no
PermitEmptyPasswords no
X11Forwarding no
ClientAliveInterval 1500
MaxAuthTries 3
PermitRootLogin no
Utiliser le protocole ssh version 2:¶
Protocol 2
❯ ssh -1 -p '36722' 'pi@raspberrypi4.local'
SSH protocol v.1 is no longer supported
Durée de vie de la connexion:¶
ClientAliveInterval 1500 # seconds
Connexion par clés uniquement:¶
PasswordAuthentication no
Limiter le nombre d'essais (mauvais mot-de-passe)¶
MaxAuthTries 3
Désactiver la connection en root:¶
PermitRootLogin prohibit-password # connection root avec clé ssh uniquement
PermitRootLogin no # connection root interdite
N'autoriser qu'une seule IP à se connecter:¶
ListenAddress 192.168.1.2
N'autoriser que certains utilisateurs:¶
AllowUsers user1 user2
Redémarrer le service ssh:¶
sudo service ssh restart
Si pas besoin de SSH, il faut le désactiver:¶
sudo systemctl stop sshd
sudo systemctl disable sshd
Node:¶
# Par défaut (Raspi OS)
$ node -v
v10.24.0
Installer nvm:¶
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
# est ajouté au .bashrc:
export NVM_DIR="$HOME/.config/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Installer node:¶
$ nvm install --lts=fermium
Installing with latest version of LTS line: fermium
Downloading and installing node v14.16.0...
Version
$ node -v
v14.16.0
Samba:¶
Installer Samba:¶
$ sudo apt install samba samba-common-bin smbclient cifs-utils
Configurer:¶
$ sudo nano /etc/samba/smb.conf
# Ajouter dans[global] au début:
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = raspberrypi4
security = user
map to guest = bas user
dns proxy = no
# Ajouter le partage à la fin:
[shared]
comment = Dossier partage dans le dossier User
path = /home/pi/shared
writeable = Yes
create mask = 0777
directory mask = 0777
public = no
Créer un mot-de-passe Samba pour l'utilisateur pi:¶
$ sudo smbpasswd -a pi
New SMB password:
Retype new SMB password:
Added user pi.
Redémarrer le service Samba:¶
$ sudo systemctl restart smbd
Vérifier l'état du service Samba:¶
$ sudo systemctl status smbd.service
● smbd.service - Samba SMB Daemon
Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-03-03 18:33:53 CET; 6min ago
Copier des fichiers:¶
scp:¶
# Copier des fichiers vers le Rpi4:
$ scp -P36722 requirements.txt pi@raspberrypi4.local:Desktop/
requirements.txt 100% 1215 417.8KB/s 00:00
# Copier des fichiers depuis le Rpi4:
$ scp -P36722 pi@raspberrypi4.local:Desktop/ex/hostname hostname
hostname 100% 13 4.0KB/s 00:00
sftp:¶
sudo tasksel
Dernière mise à jour:
March 4, 2022