Difference between revisions of "Minimal Raspbian Installation"
(→You do not have a screen) |
|||
(13 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | '''Goal:''' Setup a minimal Raspbian setup without bloat. This was used before by starting with a minibian installation, but has been superseded by the availability of | + | '''Goal:''' Setup a minimal Raspbian setup without bloat. This was used before by starting with a minibian installation, but has been superseded by the availability of Raspbian lite images. |
− | + | == Setting up SD Card == | |
− | |||
* Download Raspbian '''Lite''' image: https://www.raspberrypi.org/downloads/raspbian/ | * Download Raspbian '''Lite''' image: https://www.raspberrypi.org/downloads/raspbian/ | ||
* unzip image: | * unzip image: | ||
− | unzip | + | unzip 2020-02-13-raspbian-buster-lite.zip |
* Put image on SD Card (ADJUST /dev/sdX target to the correct block device!): | * Put image on SD Card (ADJUST /dev/sdX target to the correct block device!): | ||
* Stick SD Card in (duh) | * Stick SD Card in (duh) | ||
− | dd bs=4M if= | + | dd bs=4M if=2020-02-13-raspbian-buster-lite.img of=/dev/sdX status=progress |
OR IF YOU HAVE OLD DD | OR IF YOU HAVE OLD DD | ||
− | dd bs=4M if= | + | dd bs=4M if=2020-02-13-raspbian-buster-lite.img | pv | dd bs=4M of=/dev/sdX |
− | |||
− | + | == Connecting to the Pi == | |
By default Raspbian will get an IP on ethernet. | By default Raspbian will get an IP on ethernet. | ||
− | + | === You do not have a screen === | |
− | + | * Don't remove the SD card from computer | |
− | Figure out what is your RPi IP address (adjust mask to reflect own network): | + | * Refresh partition table (use <code>partprobe</code> on Linux, on FreeBSD it should not be needed, and no idea for the rest) |
− | nmap -sP 192.168.1.1-255 | + | * mount the first partition from the SD card (adjust paths!): |
+ | sudo mount /dev/sdc1 /media/stuff # Linux | ||
+ | sudo mount -t msdosfs /dev/da2s1 /media/stuff # FreeBSD | ||
+ | * Create an empty file called <code>ssh</code> inside <code>/media/stuff/</code>: | ||
+ | sudo touch /media/stuff/ssh | ||
+ | * If using a raspbian starting from Bullseye you also need to configure a default user | ||
+ | # as root | ||
+ | echo "pi:"$(echo 'raspberry' | openssl passwd -6 -stdin) > /media/stuff/userconf | ||
+ | * Unmount the partition | ||
+ | sudo umount /media/stuff | ||
+ | * Insert SD, Power the RPi, wait for crazy blinking to stop | ||
+ | * Figure out what is your RPi IP address (adjust mask to reflect own network), using one of these methods: | ||
+ | nmap -sP 192.168.1.1-255 # adjust network mask, the RPi's default name is raspberrypi | ||
+ | arp -na | grep -i b8:27:eb # list arp entries, filter MAC addresses of RPi vendor (up to RPi3 included) | ||
+ | arp -na | grep -i dc:a6:32 # list arp entries, filter MAC addresses of RPi vendor (RPi4 and more) | ||
+ | * ssh in RPi (passwd is raspberry) | ||
+ | ssh pi@192.168.1.XXX | ||
+ | * '''CHANGE PASSWORD THANKS''' | ||
+ | passwd | ||
− | + | === You have a screen and keyboard === | |
− | the IP will is displayed in the console at the end of the boot process. However you need to enable sshd first. | + | * Insert SD, Power the RPi, '''the IP will is displayed in the console at the end of the boot process'''. However you need to enable sshd first. |
* log into the console with pi:raspberry | * log into the console with pi:raspberry | ||
* start raspi-config tool | * start raspi-config tool | ||
Line 27: | Line 43: | ||
* In interfacing options, enable SSH | * In interfacing options, enable SSH | ||
* Exit raspi-config | * Exit raspi-config | ||
− | * ssh | + | * If you did not take note of the IP yet, you can always do: |
− | ssh pi@192.168.1. | + | ifconfig eth0 | grep inet |
− | * | + | * ssh in RPi (passwd is raspberry) |
+ | ssh pi@192.168.1.XXX | ||
+ | * '''CHANGE PASSWORD THANKS''' | ||
+ | passwd | ||
+ | |||
+ | == Base system == | ||
− | + | All this stuff as <code>root</code>: | |
− | * | + | * Change hostname |
echo "BMO" > /etc/hostname | echo "BMO" > /etc/hostname | ||
hostname -F /etc/hostname | hostname -F /etc/hostname | ||
+ | * In <code>/etc/hosts</code>, replace <code>127.0.0.1 raspberrypi</code> with <code>127.0.0.1 BMO</code> | ||
* don't bloat the system | * don't bloat the system | ||
echo -e 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/90norecommend | echo -e 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/90norecommend | ||
Line 41: | Line 63: | ||
apt update | apt update | ||
apt upgrade | apt upgrade | ||
− | * update to latest kernel | + | * update to latest kernel ('''nowadays discouraged, only use if you need a pre-release kernel''') |
apt install rpi-update | apt install rpi-update | ||
rpi-update | rpi-update | ||
Line 48: | Line 70: | ||
dpkg-reconfigure tzdata | dpkg-reconfigure tzdata | ||
− | + | == Comfy environment (optional) == | |
− | Now you can install all your comfy l33t command line tools and whatnot, fav editors, etc. This is just an example | + | Now you can install all your comfy l33t command line tools and whatnot, fav editors, etc. This is just an example, YMMV: |
* comfy tools and stuff | * comfy tools and stuff | ||
ln -s /usr/bin/vim.tiny /usr/bin/vim | ln -s /usr/bin/vim.tiny /usr/bin/vim | ||
− | apt install tmux | + | apt install tmux git |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | == THIS IS IT! == | |
Well done, you now have a minimal RPi installation, the guideline stops here, anything past this point is just a matter of what the RPi will be used for. | Well done, you now have a minimal RPi installation, the guideline stops here, anything past this point is just a matter of what the RPi will be used for. |
Latest revision as of 21:55, 13 March 2023
Goal: Setup a minimal Raspbian setup without bloat. This was used before by starting with a minibian installation, but has been superseded by the availability of Raspbian lite images.
Contents
Setting up SD Card
- Download Raspbian Lite image: https://www.raspberrypi.org/downloads/raspbian/
- unzip image:
unzip 2020-02-13-raspbian-buster-lite.zip
- Put image on SD Card (ADJUST /dev/sdX target to the correct block device!):
- Stick SD Card in (duh)
dd bs=4M if=2020-02-13-raspbian-buster-lite.img of=/dev/sdX status=progress OR IF YOU HAVE OLD DD dd bs=4M if=2020-02-13-raspbian-buster-lite.img | pv | dd bs=4M of=/dev/sdX
Connecting to the Pi
By default Raspbian will get an IP on ethernet.
You do not have a screen
- Don't remove the SD card from computer
- Refresh partition table (use
partprobe
on Linux, on FreeBSD it should not be needed, and no idea for the rest) - mount the first partition from the SD card (adjust paths!):
sudo mount /dev/sdc1 /media/stuff # Linux sudo mount -t msdosfs /dev/da2s1 /media/stuff # FreeBSD
- Create an empty file called
ssh
inside/media/stuff/
:
sudo touch /media/stuff/ssh
- If using a raspbian starting from Bullseye you also need to configure a default user
# as root echo "pi:"$(echo 'raspberry' | openssl passwd -6 -stdin) > /media/stuff/userconf
- Unmount the partition
sudo umount /media/stuff
- Insert SD, Power the RPi, wait for crazy blinking to stop
- Figure out what is your RPi IP address (adjust mask to reflect own network), using one of these methods:
nmap -sP 192.168.1.1-255 # adjust network mask, the RPi's default name is raspberrypi arp -na | grep -i b8:27:eb # list arp entries, filter MAC addresses of RPi vendor (up to RPi3 included) arp -na | grep -i dc:a6:32 # list arp entries, filter MAC addresses of RPi vendor (RPi4 and more)
- ssh in RPi (passwd is raspberry)
ssh pi@192.168.1.XXX
- CHANGE PASSWORD THANKS
passwd
You have a screen and keyboard
- Insert SD, Power the RPi, the IP will is displayed in the console at the end of the boot process. However you need to enable sshd first.
- log into the console with pi:raspberry
- start raspi-config tool
sudo raspi-config
- In interfacing options, enable SSH
- Exit raspi-config
- If you did not take note of the IP yet, you can always do:
ifconfig eth0 | grep inet
- ssh in RPi (passwd is raspberry)
ssh pi@192.168.1.XXX
- CHANGE PASSWORD THANKS
passwd
Base system
All this stuff as root
:
- Change hostname
echo "BMO" > /etc/hostname hostname -F /etc/hostname
- In
/etc/hosts
, replace127.0.0.1 raspberrypi
with127.0.0.1 BMO
- don't bloat the system
echo -e 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/90norecommend
- update system
apt update apt upgrade
- update to latest kernel (nowadays discouraged, only use if you need a pre-release kernel)
apt install rpi-update rpi-update reboot
- what time is it
dpkg-reconfigure tzdata
Comfy environment (optional)
Now you can install all your comfy l33t command line tools and whatnot, fav editors, etc. This is just an example, YMMV:
- comfy tools and stuff
ln -s /usr/bin/vim.tiny /usr/bin/vim apt install tmux git
THIS IS IT!
Well done, you now have a minimal RPi installation, the guideline stops here, anything past this point is just a matter of what the RPi will be used for.