Skip to content

Instantly share code, notes, and snippets.

@royashbrook
Last active April 14, 2018 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royashbrook/7f2e1d287ffea9549afe31ad98e2935b to your computer and use it in GitHub Desktop.
Save royashbrook/7f2e1d287ffea9549afe31ad98e2935b to your computer and use it in GitHub Desktop.
# note that this is not a shell script that is meant to be run, just a list of shell commands mostly with comments.
# I am setting this up on my mac so all commands will be relative to that
# 1. Setup the piholes as usual, download stretch lite, image sdcard with etcher
# start with the following link if you forgot:
# https://www.raspberrypi.org/downloads/raspbian/
# 2. enable ssh
touch /Volumes/boot/ssh
# 3. get wifi setup
# note that you can do this a number of ways, but this is how I did it, I just put a new file as listed below and it gets copied over and wifi gets enabled.
# I forget where i picked up this tip, but I'll leave this link here as a little searching for headless pi zero setup showed it and it looks familiar. =)
# https://medium.com/@aallan/setting-up-a-headless-raspberry-pi-zero-3ded0b83f274
echo -e "country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
\tssid=\"SIDGOESHERE\"
\tpsk=\"WIFIPASSWORD\"
}
" > /Volumes/boot/wpa_supplicant.conf
# 4. find ip
# you can use any ip scanner for this, the nmap command below will work
# change for your subnet
sudo nmap -sP 192.168.2.0/24
# 5. ssh to pi and do more setup, the following steps will all require you to ssh into the pi forst
ssh pi@ip
# 6. Initial Setup
# 6a, reset password
passwd
# 6b, fix stuff via raspi-config
sudo raspi-config
fix localization
fix memory mapping
fix hostname
# 7. set IP address, change for your ip of course
# note that i am using 1*,8*,9* for dns, you can use whatever you like
# tons of lists of public dns servers, here is one
# https://www.lifewire.com/free-and-public-dns-servers-2626062
sudo nano /etc/dhcpcd.conf
#replace the contents of the file with the config below
#i have fiddled with making this an echo statement, but i feel like i always
# run into some weird issue that i need to check on, so no generally just ctrl+k
# to delete all of the lines and copy/paste this in there.
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
option interface_mtu
require dhcp_server_identifier
slaac private
interface wlan0
static ip_address=192.168.2.50/24
static routers=192.168.2.1
static domain_name_servers=1.1.1.1 8.8.8.8 9.9.9.9
# 8. update/upgrade everything
sudo apt-get update && sudo apt full-upgrade -y
# 9. install pihole, YMMV, if you don't like curling to bash, please check the pihole site for the latest info on how to do this manually.
curl -sSL https://install.pi-hole.net | sudo bash
# 9a, ensure you record this information once the installation finishes
┌─────────────────────┤ Installation Complete! ├─────────────────────┐
│ │
│ Configure your devices to use the Pi-hole as their DNS server │
│ using: │
│ │
│ IPv4: 192.168.2.50 │
│ IPv6: 2002::6c76:706d:f9c5:6513 │
│ │
│ If you set a new IP address, you should restart the Pi. │
│ │
│ The install log is in /etc/pihole. │
│ │
│ View the web interface at http://pi.hole/admin or │
│ http://192.168.2.50/admin │
│ │
│ Your Admin Webpage login password is XXXXXXXX │
│ │
│ <Ok> │
│ │
└────────────────────────────────────────────────────────────────────┘
#10. Profit! That's it, just do it again on another pi if you want, same steps, different IP and hostname. =)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment