December 13, 2024

Raspberry Pi OS install with Mac/Windows/Linux

Updated 2024-12-13 !

When starting up a new project with Raspberry Pi I like to start up fresh and with a minimal OS. 
Therefore i always use Raspberry Pi OS(ROS) Lite and then adding what I need

Doing it right You don't have to use an external display, keybord and mouse, just a "sshclient.

Flash to a SSD ? Check this post.

Intro
If you been using ROS before you know that there always been a default, active, user "pi" when installing. This have now, 2022-04, changed and you have to use the  Raspberry Pi Imager(RPiI) and set a user.

With RPiI, >=v1.8.x, you also select hardware and will get a recommendation for preferable OS version.  

Flash the SD card

Use RPiI and follow these instructions.

Choose from one of the 2 versions with either 32 or 64 bit OS
  • ROS, with desktop and recommended software
  • ROS lite, minimal OS without desktop
If you just want the images they are found here.

Nice to know is that RPiI stores the OS image in;
  • Windows    => C:\Users\<username>\AppData\Local\Raspberry Pi\Imager\cache
  • Mac            => /Users/<username>/Library/Caches/Raspberry\ Pi/Imager
RPi boot settings
Using the RPiI, advanced options, you have probably set;
  • Hostname
  • Enable SSH
  • Set a username and password
  • Configure wireless lan
  • Local settings
Browse the content of the SD card and You will see a nice structure of files and folders.

If you didn't active SSH above you can still, old way, create an empty file with the name "ssh", no extension, in the root of the SD card. This will enable ssh before it is actually configured. (See picture)

You now have to unmount the SD card.

Plug the SD card into Your RPi, connect the LAN cable.

Connect the mouse, keyboard, screen and power. Log on and continue with the configuration below.

OR 

Use headless just connecting the power

It will boot, green led flashes, and after about 2 minutes it should be visible in Your routers list over connected devices with the name "raspberrypi".

Or just check with a ping in the Mac Terminal or similar for other OS


$ ping raspberrypi
PING raspberrypi.lan (192.168.1.79): 56 data bytes
64 bytes from 192.168.1.79: icmp_seq=0 ttl=64 time=247.129 ms
64 bytes from 192.168.1.79: icmp_seq=1 ttl=64 time=8.676 ms
64 bytes from 192.168.1.79: icmp_seq=2 ttl=64 time=3.914 ms
64 bytes from 192.168.1.79: icmp_seq=3 ttl=64 time=1.865 ms

Start Mac Terminal, or Windows putty, and logon with "ssh" and default password "raspberry"

$ ssh pi@raspberrypi                                                        
The authenticity of host 'raspberrypi (192.168.1.79)' can't be established.
ECDSA key fingerprint is SHA256:lNY6d3pAK5TDO5XLma3k2w0IgOkGBcs1wa1T7QGaXjk.
Are you sure you want to continue connecting (yes/no)? yes                  
Warning: Permanently added 'raspberrypi' (ECDSA) to the list of known hosts.
Warning: the ECDSA host key for 'raspberrypi' differs from the key for the IP address '192.168.1.79'                                                      
Offending key for IP in /Users/xxxxx/.ssh/known_hosts:5                    
Are you sure you want to continue connecting (yes/no)? yes                  
pi@raspberrypi's password:                                                  
The programs included with the Debian GNU/Linux system are free software;  
the exact distribution terms for each program are described in the          
individual files in /usr/share/doc/*/copyright.                            
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent          
permitted by applicable law.                                                    
SSH is enabled and the default password for the 'pi' user has not been changed.  
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
pi@raspberrypi:~ $

If the name doesn't work with the ssh command use the IP from the routers device list instead.

As You see in the log I have used this RPi before and the router is assigning it the same IP but with a new fingerprint(New OS). The easiest way to solve the problem is just to empty the file  "known_hosts" on Your Mac.

First update the installation with


$ sudo apt update && sudo apt full-upgrade -y && sudo apt clean

If you didn't use the "Advanced options" or want to change/add anything start the basic setup. Use up and down arrow to move, left right arrow to select and Enter to confirm

$ sudo raspi-config











And go through, at least, the following items

1  System Options
    S3 Change User Password
    S4 Hostname
3  Interface options
    I2 SSH
5  Localisations options
    L1 Locale (Swedish sv_SE ISO-8859-1)
    L2 Timezone*
    L3 Keyboard
    L4 WLAN Country
  
then reboot

$ sudo reboot

Remarks
Log files
The logfiles can grew very big if you don't take care. Check the size with 

journalctl --disk-usage


to limit the size to for example 500 MB, use command

sudo journalctl --vacuum-size=500M


or just 7 days 

sudo journalctl --vacuum-time=7d

A good tutorial is found here.

FTP
Raspberry FTP can be found here https://downloads.raspberrypi.org

OS images
Lite

Full


Headless WiFi install
Use the RPi Imager to set it up.

Suite value
There could be a notice

xxxxx InRelease' changed its 'Suite' value from 'testing' to 'stable' 

which is solved with using 

$ sudo apt-get update --allow-releaseinfo-change

Additional software
You should also check Samba, RPi as a Windows fileserver, RPi as a Apache webserver with PHP and Rasbian lite with GUI, VNC, RDP, Chrome.


Ready for USB boot ? Use an USB SSD, or other USB drive, to improve performance !

System information tool
A nice light weight app getting info about the system is Archey. Install the latest release with

wget https://github.com/HorlogeSkynet/archey4/releases/download/v4.15.0.0/archey4_4.15.0.0-1_all.deb

sudo apt install ./archey4_4.15.0.0-1_all.deb


And run with just archey


Checking SD-cards
Connect the card reader, with the SD card inserted, to Your client and format the card with SD Formatter and use the "Owerwrite Formate" option. This will also check that the SD card is OK.

3 comments:

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !