Help us understand the problem. What is going on with this article?

Jupyter Labをリモートからアクセスできるようにする

はじめに

研究室のiMacやLinuxサーバーの方がそりゃあスペックが良いので,普段使用しているJupyterLabをリモートからでも使用できるようにするときの設定メモです.

こちらのjupyter labをリモートから使うを参考にさせていただきました.というかほとんどこのままです.

環境

  • python3.6
  • Ubuntu18.04 (macOS 10.14.6でも試しました)
  • jupyter-notebook 6.0.2
  • jupyter lab 1.1.4
  • ipython 7.9.0

手順

1.jupyterconfig.pyの作成

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

2. 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. config.pyを設定

$ nano ~/.jupyter/jupyter_notebook_config.py

で,必要なところを編集.

~/.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. sshでポートフォワーディングで接続

$ ssh -p ポート番号 [user]@[ip] -NL 9999:localhost:9999

Jupyter Labを起動して,

http://localhost:9999/
にアクセスすればOKです.

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

みたいなのかくと,便利!

お疲れ様です.

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした