インストール方法
公式ページにある通り
pip3 install jupyterlab
設定変更
- config生成
jupyter notebook --generate-config
下記でコメントインした上で鍵の場所を書くとSSL接続ができるようになる
c.NotebookApp.keyfile '/etc/letsencrypt/live/your domain/privkey.pem' c.NotebookApp.certfile = '/etc/letsencrypt/live/your domain/fullchain.pem'
Raspberry Piにはモニターを付けないで使っている為、
下記で起動時にブラウザを立ち上げないようにする
また、ターミナルに関してもdisableとしている
Port番号も書き換えている
c.NotebookApp.open_browser = False c.NotebookApp.terminals_enabled = False c.NotebookApp.port = 9999
下記でプロンプトに打ち込む
jupyter notebook password
c.NotebookApp.notebook_dir = '/home/pi/work'
Jupyter Notebookを起動
下記コマンドで実行してエラーが出ない場合はブラウザを開いてアクセスをする
jupyter lab --ip=0.0.0.0
パスワードを入力すると、noteが開く
起きたエラー
- 鍵がないと言われる
- アクセス権がないと言われる
- エラーメッセージ
ValueError: certfile "/etc/letsencrypt/live/your domain/fullchain.pem" does not exist
- 解決方法 フォルダの権限を変える
sudo chmod 755 /etc/letsencrypt/archive/
- エラーメッセージ
PermissionError: [Errno 13] Permission denied
- 解決方法 オーナーを追加する
sudo chown pi privkey.pem sudo chown pi fullchain.pem
起動時に実行する
細かいことを考えずにsystemdに登録する
$cat /etc/systemd/system/jupyter.service [Unit] Description=Jupyter Notebook [Service] Type=oneshot WorkingDirectory=/home/pi/jupyter ExecStart=/home/pi/.local/bin/jupyter lab --ip=0.0.0.0 User=pi Group=pi [Install] WantedBy=multi-user.target $sudo systemctl enable jupyter $sudo systemctl status jupyter