LoginSignup
118
117

More than 5 years have passed since last update.

Jupyter notebookをリモートサーバで実行する

Last updated at Posted at 2015-10-01

jupyter のインストール

pyenv でanaconda環境に切り替えたのち
pip install jupyter

jupyter/notebookのインストール

nodejsとnpmが入っていることをはっきりさせる
sudo apt-get install nodejs-legacy npm
macなら brew install node
jupyter notebookをcloneしてビルド

git clone https://github.com/jupyter/notebook.git
cd notebook
pip install --pre -e .
jupyter notebook

ipythonの設定

pip3 install ipython

ipython3でIpythonを立ち上げて、以下のコマンド

from notebook.auth import passwd
passwd()

passを入力するとsha鍵が出るので、これを
~/.jupyter/jupyter_notebook_config.py内に以下のような形で書く

c = get_config()

# 全てのIPから接続を許可
c.NotebookApp.ip = '*'
c.NotebookApp.password = u'sha1:bcd259ccf...<先ほどの鍵をコピペ>'
#ブラウザは立ち上げない
c.NotebookApp.open_browser = False

# 特定のポートに指定(デフォルトは8888)
c.NotebookApp.port = 9999

後はjupyter notebook &で立ち上げてローカルのブラウザから
http://<サーバのIP>:9999でログイン

セキュリティを気にする時はIPを制限したり、SSLとか使う。詳しくは公式

/etc/rc.localとかにnohup jupyter notebook &を書いておくとreboot時に自動で立ち上がる

118
117
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
118
117