Skip to content

Instantly share code, notes, and snippets.

@nipunsadvilkar
Created June 11, 2017 19:34
Show Gist options
  • Save nipunsadvilkar/023708c0dc2c732873929c4601577b71 to your computer and use it in GitHub Desktop.
Save nipunsadvilkar/023708c0dc2c732873929c4601577b71 to your computer and use it in GitHub Desktop.

Installation of Jupyterhub on remote server

  1. Linux Anaconda Installation (Anaconda conveniently installs Python, the Jupyter Notebook, and other commonly used packages for scientific computing and data science. )


    • Installing by using following command:

     $ bash Anaconda2-4.0.0-Linux-x86_64.sh
    
    
     Enter(many times) >> yes >> give directory or keep it as Default
    
  2. Installing Python3 (dependency of jupyterhub is on python3)

     $ sudo apt-get install python3-pip
    
  3. Install nodejs/npm

     $ sudo apt-get install npm nodejs-legacy
    
  4. Install proxy with npm

     $ npm install -g configurable-http-proxy
    
  5. Install Jupyterhub

     $ pip3 install jupyterhub
    
  6. Install Jupyter notebook (/upgrade)

     $ pip3 install --upgrade notebook
    
  7. Test Jupyterhub default configuration

     $ jupyterhub --no-ssl
    

    This will start session in localhost:8000

    ** Make sure that port isnt protected under Firewall of your system

  8. It is reccommended to use secure SSL certificate file for the public facing interface of the proxy.
    To produce personal security certificates commands are as follows:

     $ openssl req ­x509 ­nodes ­days 365 ­newkey rsa:1024 ­keyout mykey.key ­out mycert.pem
    

    **Fill in the credentials.(even if you dont..It's ok!)

  9. Create Jupyterhub configuration file

     $ jupyterhub --generate-config 
    
  10. We will use Github OAuthentication as our Authenticator.
    so steps are as follows:

1. Go to your Github profile >  Settings > Oauth application

2. Register new application

3. Under callback URL is: [https://your_host/hub/oauth_callback](http://www.example.com)<br>

	Where **your­host**  is where your server will be running. Such as example.com:8000 .

4. click on Update/Create application.<br>

	You will see Client id and secret key generated above:<br>

		Github client_id = '---­­­­­­­Some cryptic string----­­­­­'
		Github client_secret = '­­­­­­­---­­­­­­­Some cryptic string----­­'
  1. In Terminal, write command

    $ sudo nano jupyterhub_config.py
    
  2. Install OAuthenticator:

    $ pip3 install oauthenticator
    
  3. Create userlist file

    $ sudo nano userlist
    

    It should be like username and admin after one space for giving admin right otherwise only username for normal user.
    Example:

    nipunsadvilkar admin
    manasRK admin
    Benybrahim
    

** Make sure that these username should match with your Github profile name.

  1. Create these users in your server machine:

    For ubuntu:

    $ sudo adduser nipunsadvilkar
    

    fill in credentials. and same for other users.

  2. Create Default Directory for your Jupyter Notebooks:

    $ sudo mkdir /home/nipunsadvilkar/notebooks
    

    So now all users notebooks will be under ~/notebooks directory

  3. Now Edit jupyter_config.py as follows:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment