ubuntu18.04配置jupyter远程&开机自启动

首先安装jupyter

pip install jupyter

然后进行配置:

jupyter notebook --generate-config

终端打开ipyhon,输入

In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

打开配置文件,填入

c.NotebookApp.ip='*'#163行
c.NotebookApp.password = u'sha:ce...刚才复制的那个密文'  #217行
c.NotebookApp.open_browser = False#208
c.NotebookApp.port =8888 #可自行指定一个端口, 访问时使用该端口228行


连上同一个wifi,在浏览器输入127.0.0.1:8888即可远程登陆
接下来配置开机自启动:

cd /etc/systemd/system/
sudo touch jupyter.service

复制:

[Unit]
Description=Jupyter Notebook
After=network.target
[Service]
Type=simple
ExecStart=/home/micrl/.local/bin/jupyter-notebook --config=//home/micrl/.jupyter/jupyter_notebook_config.py --no-browser
User=micrl
Group=micrl
WorkingDirectory=/home/
#文件路径名
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target

输入:

sudo systemctl status jupyter.service
sudo systemctl start jupyter.service
sudo systemctl enalbe jupyter.service

你可能感兴趣的:(ubuntu,linux,运维)