Skip to content

Instantly share code, notes, and snippets.

@crazy4groovy
Last active April 27, 2019 12:04
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 crazy4groovy/86eb5f0c9c1eaec208627486533f12a9 to your computer and use it in GitHub Desktop.
Save crazy4groovy/86eb5f0c9c1eaec208627486533f12a9 to your computer and use it in GitHub Desktop.
AWS EC2 user data setup script for darknet ML tool
#!/bin/bash
## Amazon Linux 2 AMI ##
# Note: many commands don't seem to work (??)
yum update -y
yum install -y git gcc gcc-c++ httpd
service httpd start
echo "<html><h1>Running httpd!</h1></html>" > /var/www/html/index.html
cd /var/www/html
git clone https://github.com/pjreddie/darknet.git
cd darknet
# sed -i 's/GPU=0/GPU=1/g' Makefile
make
wget https://pjreddie.com/media/files/yolov3.weights
# ./darknet detect cfg/yolov3.cfg yolov3.weights myimage.jpg
wget https://pjreddie.com/media/files/darknet19.weights
# ./darknet classifier predict cfg/imagenet1k.data cfg/darknet19.cfg darknet19.weights myimage.jpg
cd ../
wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
chmod a+rx /usr/local/bin/youtube-dl
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
nvm install 10
npm i -g serve canihazip
# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment