Last active
September 15, 2021 02:02
-
-
Save AnthonyDiGirolamo/9388732 to your computer and use it in GitHub Desktop.
Raspberry Pi Provisioning Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp -r archives [email protected]:~/ ; ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh [email protected] 'sudo mv ~/archives/* /var/cache/apt/archives/' | |
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_setup [email protected]:~/ ; ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh [email protected] 'bash ~/pi_setup pi9 109' | |
# for pi in 110 111 112 | |
# do | |
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_keys [email protected].$pi:~/.ssh/authorized_keys | |
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_hosts pi_mpihostsfile [email protected].$pi:~/ | |
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp ~/.ssh/config [email protected].$pi:~/.ssh/ | |
# ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh [email protected].$pi 'cat /etc/hosts pi_hosts | tee hosts ; sudo cp hosts /etc/hosts' | |
# done | |
sudo apt-get -y update | |
sudo apt-get -y upgrade | |
sudo apt-get -y install vim mpich2 xboxdrv libglew-dev | |
sudo sed -i 's/CODESET=.*/CODESET="guess"/ | |
s/FONTFACE=.*/FONTFACE="Terminus"/ | |
s/FONTSIZE=.*/FONTSIZE="12x24"/' /etc/default/console-setup | |
sudo sed -i ' | |
s/XKBMODEL=.*/XKBMODEL="pc105"/ | |
s/XKBLAYOUT=.*/XKBLAYOUT="us"/ | |
s/XKBVARIANT=.*/XKBVARIANT=""/ | |
s/XKBOPTIONS=.*/XKBOPTIONS="terminate:ctrl_alt_bksp"/' /etc/default/keyboard | |
sudo tee /etc/default/locale <<-EOF | |
# File generated by update-locale | |
LANG=en_US.UTF-8 | |
EOF | |
sudo tee /etc/locale.gen <<-EOF | |
# This file lists locales that you wish to have built. You can find a list | |
# of valid supported locales at /usr/share/i18n/SUPPORTED, and you can add | |
# user defined locales to /usr/local/share/i18n/SUPPORTED. If you change | |
# this file, you need to rerun locale-gen. | |
# | |
en_US.UTF-8 UTF-8 | |
EOF | |
sudo locale-gen | |
# sudo dpkg-reconfigure tzdata | |
for file in \ | |
/etc/hostname \ | |
/etc/hosts \ | |
/etc/ssh/ssh_host_rsa_key.pub \ | |
/etc/ssh/ssh_host_dsa_key.pub | |
do | |
[ -f $file ] && sudo sed -i "s/raspberrypi/$1/" $file | |
done | |
sudo hostname $1 | |
sudo tee /etc/network/interfaces <<-EOF | |
auto lo | |
iface lo inet loopback | |
# iface eth0 inet dhcp | |
auto eth0 | |
iface eth0 inet static | |
address 192.168.3.$2 | |
gateway 192.168.3.1 | |
netmask 255.255.255.0 | |
network 192.168.3.0 | |
broadcast 192.168.3.255 | |
# allow-hotplug wlan0 | |
# iface wlan0 inet manual | |
# wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf | |
# iface default inet dhcp | |
EOF | |
ssh-keygen -N '' -f /home/pi/.ssh/id_rsa | |
sudo reboot | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment