

#[2016-09-22] jnsスクリプトの作者様に見つかった模様。ツイート> https://twitter.com/kleinee/status/778972855878889472
概要
-
- Raspberry Pi 3で、Jupyterをつかう
GitHub – kleinee/jns: Jupyter Notebook Server on Raspberry PI 2 and 3こちらのスクリプトで、Jupyterをインストール。
環境
-
- Raspberry Pi 3
-
- 2016-05-27-raspbian-jessie-lite.img
- microSD 8GB (jnsスクリプトのページでは、16GB以上、となっている)
手順
Raspbian Jessie Lite Imageの準備
2016-05-27-raspbian-jessie-lite.imgを焼く。
いつもの ++
sudo apt-get update
sudo apt-get upgrade
#
# hostnameとか、タイムゾーンとか、言語とか.
sudo raspi-config
#
# 一度リブート
sudo reboot
#
# 必要なパーッケージ.
sudo apt-get install -y pandoc
sudo apt-get install -y git
# おこのみで.
sudo apt-get install htop byobu
jnsのスクリプトを使って、jupyterインストール
jnsユーザ作成
# jnsユーザ追加(パスワード設定あり)・グループ設定
adduser jns
usermod -aG sudo,ssh jns
#
# jnsユーザに変更して作業.
su – jns
git clone
# gitクローン.
cd ~
git clone https://github.com/kleinee/jns.git
cd jns
chmod +x *.sh
#
#
#swap作成.. これはやらない.
# sudo ./configure_disk_image.sh
sudo EDITOR=vi visudo # sudoerの設定
jns ALL=(ALL) NOPASSWD: ALL を最後の行に追加。sudo時にpassきかれない
インストールスクリプト変更
configure_jupyter.sh :先頭に #!/bin/bash
configure_jupyter.sh__先頭に#!/bin/bash
#!/bin/bash
# script name: configure_jupyter.sh
# last modified: 2016/04/17
# sudo: no
install_python.sh: 最新の Python 3.5.2を使用
install_python.sh__最新の3.5.2にしましょう
#Python 3 version to install
#version=”3.5.1″
version=”3.5.2″
インストール開始sudo ./install_jns.sh
=>結構時間かかります
# この遅めの8GBのカードで、4~5時間(速めカードで、3~4時間)くらい。
動作確認: sudo -u jns jupyter notebook
ブラウザを開いて、 http://<らずぱいのIP>:9090/にアクセス。
Passwordは、 jns
CTRL-Cで、終了するか聞かれる。yで終了
IPが固定じゃない場合、設定変更
/home/jns/.jupyter/jupyter_notebook_config.py
…
# The IP address the notebook server will listen on.
c.NotebookApp.ip =’*’
…
pi@raspberrypi:~$ sudo -u jns jupyter notebook
[W 06:02:33.036 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 06:02:33.071 NotebookApp] Serving notebooks from local directory: /home/jns/notebooks
[I 06:02:33.072 NotebookApp] 0 active kernels
[I 06:02:33.072 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:9090/
[I 06:02:33.072 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
#
# ここで、ブラウザを開いて、http://<らずぱいのIP>:9090/ でアクセス。
.
.
.
# CTRL-Cにて、終了確認メッセージが出てくる
#
^C[I 06:03:01.661 NotebookApp] interrupted
Serving notebooks from local directory: /home/jns/notebooks
0 active kernels
The Jupyter Notebook is running at: http://[all ip addresses on your system]:9090/
Shutdown this notebook server (y/[n])? y
[C 06:03:04.375 NotebookApp] Shutdown confirmed
[I 06:03:04.377 NotebookApp] Shutting down kernels
pi@raspberrypi:~$
systemdで自動起動(JupyterHubを使う場合は、こっちは使わない)
sudo vi /etc/systemd/system/jupyter.service
/etc/systemd/system/jupyter.service
[Unit]
Description=Jupyter notebook
[Service]
Type=simple
PIDFile=/var/run/jupyter-notebook.pid
ExecStart=/usr/local/bin/jupyter notebook
User=jns
Group=jns
WorkingDirectory=/home/jns/notebooks
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
有効にする
sudo systemctl start jupyter
sudo systemctl enable jupyter
sudo systemctl status jupyter
スクショ

その他
GitHub – jupyterhub/jupyterhub: Multi-user server for Jupyter notebooksも動かした。(これで、複数ユーザログインして使用できる… 一人でしか使わないんだけど…)
インストールメモは、のちほど追記します。
https??…要設定.
結構、時間かかるので、寝る前にセットするとか、いいかも。
Python … いつか、しっかりとりくもうと思ってるんだけどね..