Skip to content

Instantly share code, notes, and snippets.

@arobb
Last active October 13, 2021 16:01
Show Gist options
  • Save arobb/f572fdd8946df2f037e9b8e515698fb7 to your computer and use it in GitHub Desktop.
Save arobb/f572fdd8946df2f037e9b8e515698fb7 to your computer and use it in GitHub Desktop.
Raspberry Pi initial configuration
# IP and new hostname of PI
PI_IP=""
PI_NEW_HOSTNAME=""
# Set ssh keys, use default password
cat ~/.ssh/id_rsa.pub | ssh pi@"$PI_IP" 'cat >> .ssh/authorized_keys'
# Connect to the pi
ssh pi@"$PI_IP"
# Change default password
passwd
exit
# Set hostname
echo "$PI_NEW_HOSTNAME" | ssh pi@"$PI_IP" 'sudo tee /etc/hostname >/dev/null'
echo "$PI_NEW_HOSTNAME" | ssh pi@"$PI_IP" 'export PI_NEW_HOSTNAME=`cat`; \
sudo sed -i "s/raspberrypi/$PI_NEW_HOSTNAME/" /etc/hosts 2>/dev/null'
# Restart
ssh pi@"$PI_IP" 'sudo reboot'
# Disable terminal sleep
# Edit /etc/kbd/config and set BLANK_TIME=0
# Other stuff
# Java support for Ubnt
# sudo apt-get install oracle-java8-jdk
# Add Ubiquiti sources and install Unifi
# echo 'deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
# sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg
# sudo apt-get update
# sudo apt install unifi
# Pi Hole
# See https://github.com/pi-hole/pi-hole#alternative-semi-automated-install-methods
# Java updates
## Set silent install - https://askubuntu.com/a/190674 - /var/lib/dpkg/info/oracle-java8-installer.preinst
# echo debconf shared/accepted-oracle-license-v1-1 select true | \
# sudo debconf-set-selections
## https://community.ubnt.com/t5/UniFi-Wireless/UniFi-Controller-5-10-17-doesn-t-work-with-Raspberry-Pi/m-p/2684263/highlight/true#M369457
# sudo apt-key adv --recv-key --keyserver keyserver.ubuntu.com EEA14886
# echo deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/webupd8team.list
# echo deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/webupd8team.list
# sudo apt-get update
# sudo apt-get install oracle-java8-installer
# sudo apt-get install oracle-java8-set-default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment