Monday, January 17, 2022

Setting up GrovePi+ starter kit on Raspberry Pi Zerro 2

Generally tried to do what this say https://www.dexterindustries.com/GrovePi/get-started-with-the-grovepi/

but there are few things to run before running the 

sudo curl -kL dexterindustries.com/update_grovepi | bash




sudo apt-get update
sudo apt --fix-broken install -y
sudo apt-get remove wiringpi -y
sudo apt-get install git-core gcc make libffi6 libffi-dev software-properties-common python-setuptools -y

cd ~
mkdir ~/work/github
cd ~/work/github
git clone https://github.com/WiringPi/WiringPi --branch master --single-branch wiringpi 
cd wiringpi/ 
sudo ./build


curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py

curl -sSL https://pi4j.com/install | sudo bash





Wednesday, January 12, 2022

configure raspberry pi to work with github and github packages

 1. generate Personal Access Tocken 

steps are here 

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

2. add to ~/.m2/settings.xml 

replace the TOKEN string with the token from prev step!!

Setting up a Raspberry Pi for development

 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 :slight_smile:

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

  1. 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 pi

it 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

Followers