Skip to content

Instantly share code, notes, and snippets.

@janaSunrise
Last active September 27, 2021 12:59
Show Gist options
  • Save janaSunrise/199a0609ec51356c1445825b366cabcf to your computer and use it in GitHub Desktop.
Save janaSunrise/199a0609ec51356c1445825b366cabcf to your computer and use it in GitHub Desktop.
A quick bash script to setup Jupyter notebooks on your server.
sudo pip3 install jupyter
export PASSWD=$(ipython -c "from IPython.lib import passwd; print(passwd('sudo123'))") # Change with your password here between quotes.
jupyter notebook --generate-config
cd ~
mkdir certs
cd certs
sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
sed -i '1s/^/c = get_config()
c.IPKernelApp.pylab = "inline"
c.NotebookApp.certfile = u"~/certs/mycert.pem"
c.NotebookApp.ip = "*"
c.NotebookApp.open_browser = False
# Your password below will be whatever you copied earlier
c.NotebookApp.password = $PASSWD
c.NotebookApp.port = 8888\n /' ~/.jupyter/jupyter_notebook_config.py
# Install firewall if not already
sudo apt install ufw -y
ufw allow ssh
ufw allow 8888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment