Make Jupyter Lab accessible remotely

Introduction

The iMac and Linux server in the laboratory have better specifications, so this is a setting memo when you can use the Jupyter Lab that you usually use remotely.

I referred to this Using jupyter lab remotely. Rather, it is almost as it is.

environment

procedure

1. Create jupyterconfig.py

$ jupyter lab --generate-config
Writing default config to: /home/okuda/.jupyter/jupyter_notebook_config.py

2. Create password hash value with ipython

$ ipython
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from IPython.lib import passwd                                                                                                                      

In [2]: passwd()                                                                                                                                            
Enter password: 
Verify password: 
Out[2]: 'sha1:xxxxxxxxx'

3. Set config.py

$ nano ~/.jupyter/jupyter_notebook_config.py

Then edit the necessary parts.

~/.jupyter/jupyter_notebook_config.py


c = get_config()
c.IPKernelApp.pylab = 'inline'
c.NotebookApp.open_browser = False
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.port = 9999
c.NotebookApp.allow_remote_access = True
c.NotebookApp.password = 'sha1:xxxx' 

4. Connect with port forwarding with ssh

$ ssh -p port number[user]@[ip] -NL 9999:localhost:9999

Start Jupyter Lab and

http://localhost:9999/ It is OK if you access.

~/.ssh/config


Host xxx
	HostName xxx
	User xxx
	Port xxx
        IdentityFile ~/.ssh/id_rsa_xxx
	LocalForward 9999 localhost:9999

It's convenient!

thank you for your hard work.

Recommended Posts

Make Jupyter Lab accessible remotely
Jupyter Lab begins
Let's make jupyter lab easy to use
Install Python Jupyter lab
Label images on jupyter lab
Make custom settings for Jupyter Lab when creating docker image
Error: 500 (Internal Server Error) Jupyter lab
Make a sound with Jupyter notebook
Run Open Modelica from Jupyter Lab
Make testing with Selenium more accessible
Make Python dict accessible by Attribute
Make Python dictionaries accessible as attributes