目录
1.安装jupyter notebook
请参考将Anaconda 安装在个人用户下并设置环境变量_自行安装的软件,配置软件对应的 modulefile 文件_朗道十戒的博客-CSDN博客
2. 配置远程登录
生成一个 notebook 配置文件
默认情况下,配置文件 ~/.jupyter/jupyter_notebook_config.py 并不存在,需要自行创建。使用下列命令生成配置文件:
jupyter-notebook --generate-config
Writing default config to: /home/xxx/.jupyter/jupyter_notebook_config.py
3.生成密码
3.1
jupyter-notebook password
Enter password: ****
Verify password: ****
[NotebookPasswordApp] Wrote hashed password to /home/xxx/.jupyter/jupyter_notebook_config.json
3.2
进入python环境:
python
输入python语句命令:
from notebook.auth import passwd
passwd()
输入自己想要设置的密码,之后会自动生成一个密码序列,复制下来。
修改配置文件
cd .jupyter/
gedit jupyter_notebook_config.py
4.修改jupyter配置文件
在 jupyter_notebook_config.py 中找到下面的行,取消注释并修改(东西比较多,仔细找)
c.NotebookApp.allow_remote_access = True
c.NotebookApp.notebook_dir = '/home/xxx'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8889 #可自行指定一个端口, 访问时使用该端口
c.NotebookApp.password='sha1:XXXXXXXXXXXXXXXXXXXXXXXXXX'
// (注:XXXXXXXXXXXXXXXXXXXXXXX 为第3步中生成的密码序列)
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.allow_origin = '*'
5.关闭防火墙,或设置开放指定端口(推荐)
xxx@xxx-PowerEdge-T440:~$ systemctl stop firewalld.service
xxx@xxx-PowerEdge-T440:~$ firewall-cmd --zone=public --add-port=8888/tcp --permanent
success
xxx@xxx-PowerEdge-T440:~$ systemctl restart firewalld.service
6.远程登录
进入jupyter notebook环境
jupyter-notebook
在本地网页中输入一下ip地址:
https://ipaddress:8889
https://ipaddress:8889