How to install Jupyter in Ubuntu and make it accessible through Apache Reverse Proxy
By: Suresh in Python Tutorials on 2019-02-23
Jupyter Notebooks have become the defacto standard for data scientists to show case their research and machine learning algorithms and work for presentation and sharing with others. Here we can see how to make Jupyter Notebooks to be accessed over internet from our server.
As usual start with updating ubuntu repositories and upgrade to latest
sudo apt update sudo apt -y upgrade
If you have not installed python already, you install it now. Otherwise skip this part.
sudo apt-get install python3.6 sudo apt install -y python3-pip
Also install the necessary development tools
sudo apt install build-essential libssl-dev libffi-dev python3-dev
Create a virtual configuration in apache2 as below
ServerName jupyter.yourdomain.com ProxyPreserveHost On ProxyRequests off ProxyPass /api/kernels/ ws://localhost:8888/api/kernels/ ProxyPassReverse /api/kernels/ http://localhost:8888/api/kernels/ ProxyPass / http://localhost:8888/ ProxyPassReverse / http://localhost:8888/
In addition to enable apache reverse proxy, you also need to enable wstunnel
sudo a2enmod proxy sudo a2enmod proxy_http sudo a2enmod proxy_wstunnel sudo systemctl restart apache2
Now that you have restarted apache2, you can start jupyter to run in the background using screen
apt-get install screen screen -A -m -d -S jup jupyter notebook --allow-root --no-browser --NotebookApp.allow_remote_access=True
The switch --NotebookApp.allow_remote_access=True is important to allow the access of notebooks over internet. This will avoid errors such as this" Blocking request with non-local 'Host' jupyter.yourdomain.com. If the notebook should be accessible at that name, set NotebookApp.allow_remote_access to disable the check.
Also if you are not familiar with screen, you should probably google around to check how to use it. Some common commands are:
#to list all the screens screen -ls #to view the screen interface screen -r #to come out and detach from screen view ctrl + A and then D
Add Comment
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
- Data Science
- Android
- React Native
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Python program to get location meta data from an image
Retrieve Twitter posts and comments using Python
How to install Jupyter in Ubuntu and make it accessible through Apache Reverse Proxy
Python Basics - Setting up your Python Development Environment
Schwartzian Transform in python
Multidimensional list (array) in python
Perl's chomp() equivalent for removing trailing newlines from strings in python
Comments