Skip to content

Instantly share code, notes, and snippets.

@forslund
Last active September 21, 2017 06:30
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 forslund/d9b7faeb1367f7a701db172b28b6951e to your computer and use it in GitHub Desktop.
Save forslund/d9b7faeb1367f7a701db172b28b6951e to your computer and use it in GitHub Desktop.
Setup mycroft SD card
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install apt-transport-https -y
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F3B1AA8B
sudo bash -c 'echo "deb http://repo.mycroft.ai/repos/apt/debian debian main" > /etc/apt/sources.list.d/repo.mycroft.ai.list'
sudo apt-get update
sudo apt-get install mycroft-core -y
# Vim for the people!
sudo apt-get install vim -y
# Simple firewall
sudo apt-get install ufw -y
# Setup cron job to update mycroft-core
# write out current crontab
sudo crontab -l > tmpcron
# echo new cron into cron file
echo "0 4 * * * /usr/bin/apt-get update >> /var/log/mycroft-update.log && /usr/bin/apt-get install --only-upgrade mycroft-core mimic -y >> /var/log/mycroft-update.log" >> tmpcron
# install new cron file
sudo crontab tmpcron
rm tmpcron
# Disable kernel debug on GPIO tty
sudo systemctl stop serial-getty@ttyAMA0.service
sudo systemctl disable serial-getty@ttyAMA0.service
# create config directory
sudo mkdir /etc/mycroft
# Setup firewall
#Block all incoming by default
sudo ufw default deny incoming
#Allow ssh on port 22 when enabled
sudo ufw allow 22
#WiFi setup client: Allow tcp connection to websocket
sudo ufw allow in from 172.24.1.0/24 to any port 8181 proto tcp
#Allow tcp to web server
sudo ufw allow in from 172.24.1.0/24 to any port 80 proto tcp
#Allow udp for dns
sudo ufw allow in from 172.24.1.0/24 to any port 53 proto udp
#Allow udp for dhcp
sudo ufw allow in from 0.0.0.0 port 68 to 255.255.255.255 port 67 proto udp
sudo ufw enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment