Scenario : Want to install jupyter notebook from a single machine and can be utilized by more than 50 users at a time. This can be a ideal solution for schools or python lab where students or users can access from anywhere using their own devices.
We have a windows 10 machine with Desktop / Workstation with 16GB Ram and around 250 GB HDD space.
Brief Steps involved
1. Oracle Virtual Box :For creating virtual machine on top of Windows
VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL) version 2. See “About VirtualBox” for an introduction.
Link For Download : https://www.virtualbox.org/
Download this software and install on top of Windows 10.
2. Ubuntu Server 18
Download iso image from : https://releases.ubuntu.com/18.04/ubuntu-18.04.5-live-server-amd64.iso
Open Oracle Virtualbox Manager and Create a new virtual machine using ubuntu server image.
While Creating : Assign at least 16GB Memory, 200GB HDD Space.
While installing only select open ssh server and no need to add any additional items.
3. Putty Client
PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers.
Link for Download : https://www.putty.org/
4. Fix the DNS issue in Ubuntu 18.04 [This is necessary to keep permanent DNS]
Install the resolvconf package.
sudo apt install resolvconf
Add permanent name server
sudo nano /etc/resolvconf/resolv.conf.d/head and add the following:
# Make edits to /etc/resolvconf/resolv.conf.d/head.
Restart the resolvconf service.
sudo service resolvconf restart
5. Install JupyterHub on Ubuntu 18.
sudo apt install python3 python3-dev git curl
curl https://raw.githubusercontent.com/jupyterhub/the-littlest-jupyterhub/master/bootstrap/bootstrap.py | sudo -E python3 - --admin haneef
[Replace haneef with your own admin username required for jupyterhub]
Follow the steps outlined here however use above commands the commands in their site giving various errors.
Follow above link to access the newly installed JupyterHub from any browser and also for adding new users
Also to run this command to enable users to install packages.
sudo chmod 777 -R /opt/tljh/user/
6. Install Cloudflare Access
Cloudflare Access allows you to securely publish self-hosted applications to the Internet by providing an authentication layer using your existing identity providers to control who has access to your applications.
Download Cloudlfared and setup argo tunnel by following these steps : https://www.mjwebs.io/blog/how-to-set-up-cloudflare-argo-tunnel-on-ubuntu-18-04
Once you configure the argo tunnel as service you can access jupyter hub from browser.
- Allow user to create own environment
- Allow user to add google drive as shared folder
- Use GPU Passthrough for using CUDA
Error Updates :
Some users noticed that they were not able top open new python file and getting following error
500 : internal server error
I was able to solve the same by running below commands.
sudo tljh-config set user_environment.default_app jupyterlab
sudo tljh-config reload Now it works fine .