Some setup processes to get Raspbian Lite ready to use after initial install
Raspbian download is available from: https://www.raspberrypi.org/downloads/raspbian/
Getting a Raspberry Pi connected to a KVM so you can configure the network is a pain.
An easy way to avoid this is to have the Pi enable SSH when it boots up and make sure a DHCP server will serve it an IP address. You can have the Pi enable SSH on boot up by creating an empty file called 'ssh' on the root folder when you install the Raspbian image.
-
Create the emtpy file (named "ssh") in the root directory of the SD card to enable SSH on boot up after the image install.
-
Install the SD card, connect the Pi to a network with DHCP enabled and power it on.
-
After waiting a few minutes for boot up, SSH to the Pi's DHCP address
- Log in to SSH with:
- Username: pi
- Password: raspberry
- Install Network Manager with:
apt install network-manager
systemctl enable NetworkManager
systemctl start NetworkManager
systemctl stop dhcpcd.service
systemctl disable dhcpcd.service
Make sure to stop the DHCPCD service or else the network stack will start resetting every few seconds
- Reboot the Pi to have the new network settings take effect
sudo shutdown -r now
- Run
nmtui
once Pi is back up and adjust network settings
Raspbian has the root user disabled by default and requires you to log in with the default user ("pi") after install. Sometimes we need to enable the root account
-
Set the root password
sudo passwd root
-
Enable root login with SSH
sudo sed -i --follow-symlinks 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
-
Restart the SSH daemon
sudo systemctl restart ssh
-
Logout and log back into SSH with the root user
exit
-
Copy the terminal settings from the default user for pretty colors
mv .bashrc .bashrcbackup
cp /home/pi/.bashrc ~/.bashrc
It is always a good idea to update your OS with the latest patches when you build it
Update your Repo list
apt update
Install all updates for the OS
apt upgrade -y
Adjust the OS timezone
List the available timezones
timedatectl list-timezones
Set your preferred timezone
timedatectl set-timezone America/Los_Angeles
Check the CPU temperature in C
head -n 1 /sys/class/thermal/thermal_zone0/temp | xargs -I{} awk "BEGIN {printf \"%.2f\n\", {}/1000}"
Check the CPU temperature in F
head -n 1 /sys/class/thermal/thermal_zone0/temp | xargs -I{} awk "BEGIN {printf \"%.2f\n\", ({}/1000*1.8)+32}"
These are some packages I install on almost everything
- A useful package that will install python2 and some development tools.
sudo apt install -y python-pip
- A GIT client is a necessity if using a GIT repo
sudo apt install -y git
- Byobu is a terminal window manager
sudo apt install -y byobu
- Fail2Ban will stop repeated attempts at SSH
apt install -y fail2ban