Skip to content

Instantly share code, notes, and snippets.

@philkuz
Forked from rashmibanthia/jupyter_notebook_ec2.sh
Last active January 8, 2017 22:00
Show Gist options
  • Save philkuz/4b7fda8bc2eba4f9a1ba71c54321c126 to your computer and use it in GitHub Desktop.
Save philkuz/4b7fda8bc2eba4f9a1ba71c54321c126 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#Code adapted from https://gist.github.com/rashmibanthia/5a1e4d7e313d6832f2ff (Removed Anaconda install for those servers that have it installed)
jupyter notebook --generate-config
key=$(python -c "from notebook.auth import passwd; print(passwd())")
cd ~
mkdir certs
cd certs
certdir=$(pwd)
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.key -out mycert.pem
cd ~
sed -i "1 a\
c = get_config()\\
c.NotebookApp.certfile = u'$certdir/mycert.pem'\\
c.NotebookApp.ip = '*'\\
c.NotebookApp.open_browser = False\\
c.NotebookApp.password = u'$key'\\
c.NotebookApp.port = 8888" .jupyter/jupyter_notebook_config.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment