Python
Ubuntu
Azure
Jupyter

AzureのUbuntu Server 18.04 LTSでJupyter Notebookを設定

Anacondaのインストール

AzureのUbuntu Server 18.04 LTSにAnacondaをインストール

設定ファイルの生成

$ jupyter notebook --generate-config
Writing default config to: /home/y39ono/.jupyter/jupyter_notebook_config.py

パスワードの設定

$ ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:777777ac77dd:aec777b777c777f777777fad7777e7c77fe7e7a7'
In [2]: quit()

設定ファイルの編集

$ vim /home/y39ono/.jupyter/jupyter_notebook_config.py
## The IP address the notebook server will listen on.
c.NotebookApp.ip = '*'

## Whether to open in a browser after starting. The specific browser used is
#  platform dependent and determined by the python standard library `webbrowser`
#  module, unless it is overridden using the --browser (NotebookApp.browser)
#  configuration option.
c.NotebookApp.open_browser = False

## Hashed password to use for web authentication.
#  
#  To generate, type in a python/IPython shell:
#  
#    from notebook.auth import passwd; passwd()
#  
#  The string should be of the form type:salt:hashed-password.
c.NotebookApp.password = u'sha1:777777ac77dd:aec777b777c777f777777fad7777e7c77fe7e7a7'

ポートの開放

Azure portalのVMの受信ポートの規則で8888ポートを開放

Jupyter Notebookの起動

$ nohup jupyter notebook &

Jupyter Notebookの接続

ブラウザでhttp://VMのIPアドレス:8888と入力すれば接続

image.png