Download The Raspberry PI OS image
go to https://www.raspberrypi.org/software/operating-systems/
it will take a while … it 3 Gb
when you will unpack it - it 8 Gb
so do the rest while it is downloading
Raspberry Pi Imager - Download from here https://www.raspberrypi.org/software/
install it
VNC Viewer - you way to see the RPi screen remotely
https://www.realvnc.com/en/connect/download/viewer/windows/
Run the Pi Imager
select in Operating System menu - custom and pick the image you have downloaded
make sure that the storage is the SD card you going to use.
click Write
and wait …
done
insert it into the Rpi
connect screen mouse and keyboard
follow the wizard on the screen
=========
actions on the RPI
-------------
install mosquitto
sudo apt-get install mosquitto
sudo apt-get install mosquitto-clients
Install and configure additional SW that will be useful to have
sudo apt-get install -y ant build-essential busybox byobu cmake cmake-gui curl default-jdk doublecmd-qt g++ git gzip htop maven mc meld mlocate mosquitto mosquitto-clients ntp python python-all python-all-dev python3 python3-pip rsync samba samba-common-bin smbclient wget zip
1#install docker
2sudo apt install -y
3sudo systemctl enable --now docker
4sudo usermod -aG docker ubuntu
1#index the files for locate
2sudo updatedb
NTP server - required by the ESP32 to get his time on every startup
sudo apt-get install ntp
if using mosquitto mqtt broker then the following configuration:
create and add to the /etc/mosquitto/conf.d/devel.conf
1max_queued_messages 200
2message_size_limit 0
3
4allow_zero_length_clientid true
5allow_duplicate_messages false
6
7log_type all
8
9listener 1883 0.0.0.0
10autosave_interval 900
11autosave_on_changes false
12persistence false
13persistence_file mosquitto.db
14
15allow_anonymous true
16
===== FOR DEVELOPMENT ONLY === Do not do this in production!!! ====
Samba Configuration
Configure Samba service so that Rpi will be accessible on the windows network like yet another computer to write / read files from
Install samba
sudo apt-get install -y samba samba-common-bin smbclient
2. Edit the /etc/samba/smb.conf
Do it as root (sudo) !!
add at the end of the file
1[root]
2path = /
3browseable = yes
4guest ok = yes
5guest only = yes
6read only = no
7force user = root
8force create mode = 0777
9force directory mode = 0777
10
Now, set a username and password for the Samba share. This command has to be run with root privilege.
1$ sudo smbpasswd -a piit will ask you to set a password. set the same as pi password for convinience and from Windows you can now access //<rpi hostname>/root and read/write the whole linux filesystem
After you are done
run to restart the Samba service
sudo systemctl restart smbd
to test that the samba is up
run this
sudo smbclient //raspberrypi/root
and then click l
this should give you the list of the files and directories in the root of the Raspberry
-------
configure ssh key based access from windows to rpi
type c:\users\boris\.ssh\id_rsa.pub | ssh pi@rpi "cat >> .ssh/authorized_keys"
-----
Coplete shell script to run on new rpi
#!/bin/sh sudo apt update sudo apt upgrade -y sudo apt-get install -y ant build-essential busybox byobu cmake cmake-gui code curl default-jdk doublecmd-qt g++ git gzip htop maven mc meld mlocate mosquitto mosquitto-clients nedit ntp python python-all python-all-dev python3 python3-pip rsync samba samba-common-bin smbclient wget zip sudo mkdir /java/ sudo chmod ugo+rwx /java/ cd /java/ wget https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.1%2B12/OpenJDK17U-jdk_arm_linux_hotspot_17.0.1_12.tar.gz tar xzfv OpenJDK17U-jdk_arm_linux_hotspot_17.0.1_12.tar.gz ./jdk-17.0.1+12/bin/java -version wget https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz tar xzfv apache-maven-3.8.4-bin.tar.gz ln -s /java/jdk-17.0.1+12/ jdk ln -s /java/jdk-17.0.1+12/ jdk17 ln -s /java/apache-maven-3.8.4/ maven echo 'PATH=/java/jdk/bin:/java/maven/bin:$PATH' >> ~/.profile source /home/pi/.profile git config --global user.email "boris@daich.biz" git config --global user.name "Boris Daich" # echo "================installing Docker ===============================" cd ~ curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker pi sudo sh -eux <<EOF # Install newuidmap & newgidmap binaries apt-get install -y uidmap EOF dockerd-rootless-setuptool.sh install echo "export DOCKER_HOST=unix:///run/user/1000/docker.sock" >> /home/pi/.bashrc source /home/pi/.bashrc docker version docker info docker run hello-world # ===================== DOCKER INSTALL DONE ================ # generate SSH KEYS ssh-keygen -q -t rsa -b 4096 -C "boris@daich.biz" -N '' -f ~/.ssh/id_rsa <<<y >/dev/null 2>&1
RASPBERRY PI - INCREASE SWAP SIZE
STOP THE SWAP
sudo dphys-swapfile swapoff
MODIFY THE SIZE OF THE SWAP
As root, edit the file /etc/dphys-swapfile and modify the variable CONF_SWAPSIZE:
CONF_SWAPSIZE=1024
To modify the swap file, edit the variable CONF_SWAPFILE, and run dphys-swapfile setup which will create and initialize the file.
START THE SWAP
sudo dphys-swapfile swapon




No comments:
Post a Comment