次のページを参考にしました。
Jupyterを導入しよう -リモート編-
リモートサーバでjupyter notebookを起動させローカル環境で使う
- Jupyter のインストール
次のページにあります。
Jupyter Installation
sudo pacman -S jupyter-notebook
sudo jupyter nbextension enable --py --sys-prefix widgetsnbextension
sudo pacman -S ipython
- sha鍵 の生成
$ ipython
Python 3.6.6 (default, Jun 27 2018, 13:11:40)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from IPython.lib import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:5ade54f818*************************'
- 環境設定
jupyter notebook --generate-config
.jupyter/jupyter_notebook_config.py
というファイルが出来ます。
- .jupyter/jupyter_notebook_config.py の編集
.jupyter/jupyter_notebook_config.py
# Configuration file for jupyter-notebook.
from jupyter_core.paths import jupyter_config_dir, jupyter_data_dir
import os.path
import sys
sys.path.append(os.path.join(jupyter_data_dir(), 'extensions'))
c = get_config()
# 略
#
# 該当する箇所のコメントアウトを外して編集
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.password = u'sha1:XXXXXXXXX' #先ほど生成されたsha鍵を記述
c.NotebookApp.extra_template_paths = [os.path.join(jupyter_data_dir(), 'templates') ]
c.NotebookApp.server_extensions = ['nbextensions']
#
- Jupyter Notebook の起動
jupyter notebook
- クライアントでアクセス
$ jupyter --version
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : not installed
ipython : 7.13.0
ipykernel : 5.1.4
jupyter client : 6.0.0
jupyter lab : not installed
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 4.4.0
traitlets : 4.3.3