[LINUX] OS setup with Raspberry Pi Imager

OS setup with Raspberry Pi Imager

--Using Raspberry-Pi 4 --Work terminal is Windows

overall structure

We are planning to build in this order, this time it will be the OS setting edition.

--OS installation / environment settings --Container environment construction --Application introduction

OS installation / environment settings

Usage model

Raspberry Pi purchased the following. I just played around with it, so I could have used lower specs. I'm not sure, but if you buy a set, there's no problem! Purchased in the spirit of. https://www.amazon.co.jp/gp/product/B07ZRF5BC1/

SD card preparation

It seems that the file system must be FAT32. At first I was thinking of pulling out the SD card of Nintendo Switch and using it, This is used this time because it was enclosed in the above set.

Media creation with Raspberry Pi Imager

Download the exe file from the site https://www.raspberrypi.org/downloads/ image.png

Install and start with administrator privileges Specify the OS and write destination volume, and select [WRITE]. image.png

It took a while to complete. It may be a little over 30 minutes image.png

OS settings

Insert the SD card into the Raspberry Pi, turn on the power, copy the display with the HDMI cable and operate

--Ssh enabled

--VNC enabled

Confirm activation

# netstat -ant
Working internet connection(Server and establishment)
Proto reception-Q send-Q Internal address External address Status
tcp        0      0 0.0.0.0:5900            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN

Check the IP address with ifconfig here and switch to work with SSH connection

--vim installation

# apt install ^vim$

--IP address fixed


# vi /etc/dhcpcd.conf
==Postscript=====
interface wlan0
static ip_address=172.22.1.253/22
static routers=172.22.0.1
static domain_name_servers=172.22.255.1

# service sshd restart

--Distribution and firmware update

# apt-get dist-upgrade
# rpi-update
# apt-get update
# apt-get upgrade

Reboot once here and log in again

# shutdown -r now

--User creation, sudo settings

# adduser batch
# vi /etc/sudoers
==Postscript=====
batch   ALL=(ALL)   NOPASSWD: ALL

--Creating a private key / public key

# su - batch
$ ssh-keygen -t rsa -b 4096
$ scd .ssh/
$ schmod 600 id_rsa
$ smv id_rsa authorized_keys
$ ls -l
8 in total
-rw-------1 batch batch 3381 May 25 22:01 authorized_keys
-rw-------1 batch batch 743 May 25 22:01 id_rsa.pub

Download id_rsa.pub locally

--Modified sshd_config

Let's confirm the login while leaving the existing session.

# vi /etc/ssh/sshd_config
==Change the following====
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no

--Alias setting

I tried to write it in .bashrc, but when I looked at the contents .bash_aliase seemed to be more suitable, so I wrote it there

# vi .bash_aliase
==Described below====
alias ll='ls -la --color=auto'

--Swap disabled

Reboot is required to reflect the settings

# swapoff --all
# systemctl stop dphys-swapfile
# systemctl disable dphys-swapfile

# free -h
              total        used        free      shared  buff/cache   available
Mem:          3.7Gi        88Mi       3.1Gi       8.0Mi       611Mi       3.5Gi
Swap:            0B          0B          0B


--Disable unused log output

# vi /etc/rsyslog.conf
==Comment out the following====
#daemon.*                       -/var/log/daemon.log
#lpr.*                          -/var/log/lpr.log
#mail.*                         -/var/log/mail.log
#mail.info                      -/var/log/mail.info
#mail.warn                      -/var/log/mail.warn
#mail.err                       /var/log/mail.err
#*.=debug;\
#       auth,authpriv.none;\
#       news.none;mail.none     -/var/log/debug

--Other

I wanted to set a partition as well, but I stopped because it was annoying. Make logrotate settings enter after application installation

Get backup

Get a backup file in this state

Install Win32 Disk Imager https://sourceforge.net/projects/win32diskimager/

With Win32 Disk Imager running, connect the Raspberry Pi SD card to your work PC

File name of backup image in [ImageFIle] Specify the device name that the SD card is recognized in [Device] image.png

Backup acquisition is completed in about 30 minutes.

Reference site

Raspberry Pi-01 ~ Base environment construction ~ Set a fixed IP address for the wireless LAN of Raspberry Pi 3 (Raspbian Jessie) [[Raspberry Pi] How to back up the entire SD card](https://raspi.taneyats.com/entry/backup-sdcard#Win32-Disk-Imager%E3%82%A4%E3%83%B3%E3 % 82% B9% E3% 83% 88% E3% 83% BC% E3% 83% AB% E3% 81% 99% E3% 82% 8B)

Recommended Posts

OS setup with Raspberry Pi Imager
DigitalSignage with Raspberry Pi
Raspberry Pi 4 setup memo
Mutter plants with Raspberry Pi
Install Raspberry Pi OS (Raspbian)
[Raspberry Pi] Stepping motor control with Raspberry Pi
Use vl53l0x with Raspberry Pi (python)
Servo motor control with Raspberry Pi
Serial communication with Raspberry Pi + PySerial
Try L Chika with raspberry pi
VPN server construction with Raspberry Pi
Try moving 3 servos with Raspberry Pi
Using a webcam with Raspberry Pi
Measure SIM signal strength with Raspberry Pi
Pet monitoring with Rekognition and Raspberry pi
Hello World with Raspberry Pi + Minecraft Pi Edition
Build a Tensorflow environment with Raspberry Pi [2020]
Get BITCOIN LTP information with Raspberry PI
Try fishing for smelt with Raspberry Pi
Programming normally with Node-RED programming on Raspberry Pi 3
Install 64-bit OS (bate) on Raspberry Pi
Improved motion sensor made with Raspberry Pi
Install docker-compose on 64-bit Raspberry Pi OS
Try Object detection with Raspberry Pi 4 + Coral
Power SG-90 servo motor with raspberry pi
Working with sensors on Mathematica on Raspberry Pi
Use PIR motion sensor with raspberry Pi
Make a wash-drying timer with a Raspberry Pi
Infer Custom Vision model with Raspberry Pi
Operate an oscilloscope with a Raspberry Pi
Create a car meter with raspberry pi
Inkbird IBS-TH1 value logged with Raspberry Pi
Working with GPS on Raspberry Pi 3 Python
Raspberry Pi backup
Discord bot with python raspberry pi zero with [Notes]
Media programming with Raspberry Pi (preparation for audio)
I tried L-Chika with Raspberry Pi 4 (Python edition)
Enjoy electronic work with GPIO on Raspberry Pi
MQTT RC car with Arduino and Raspberry Pi
Power on / off your PC with raspberry pi
Use Majoca Iris elongated LCD with Raspberry Pi
CSV output of pulse data with Raspberry Pi (CSV output)
Observe the Geminids meteor shower with Raspberry Pi 4
Get CPU information of Raspberry Pi with Python
Play with your Ubuntu desktop on your Raspberry Pi 4
Get temperature and humidity with DHT11 and Raspberry Pi
Stock investment analysis app made with Raspberry Pi
Logging Inkbird IBS-TH1 mini values with Raspberry Pi
Connect to MySQL with Python on Raspberry Pi
GPS tracking with Raspberry Pi 4B + BU-353S4 (Python)
Measure CPU temperature of Raspberry Pi with Python
Record temperature and humidity with systemd on Raspberry Pi
Machine learning with Raspberry Pi 4 and Coral USB Accelerator
Run LEDmatrix interactively with Raspberry Pi 3B + on Slackbot
Using the digital illuminance sensor TSL2561 with Raspberry Pi
What is Raspberry Pi?
Easy IoT to start with Raspberry Pi and MESH
Display images taken with the Raspberry Pi camera module
Using Akizuki Denshi's 4WD car FT-MC-004 with Raspberry Pi
Try to visualize the room with Raspberry Pi, part 1
pigpio on Raspberry pi