一、 在服务器端安装jupyter
pip3 install jupyter
二、 配置访问的密码
在服务器端加入ipython交互环境,在终端输入ipython,输入自定义的密码,
In [1]: from IPython.lib import passwd
In [2]: passwd()
Enter password:
Verify password:
记下生成的加密字符串,在接下来的配置文件里面需要用到。
三、创建IPython notebook服务器
在服务器的终端下输入如下命令:
ipython profile create myserver
该命令会在~/.ipython/profile_myserver目录下生成下列文件
若没有生成ipython_notebook_config.py 文件,可以通过vim去创建。
四、 修改配置文件
通过vim打开ipython_notebook_config.py 文件,并在文件中添加下列配置信息:
$ vim ipython_notebook_config.py
c = get_config()
# Kernel config
c.IPKernelApp.pylab = 'inline'
# Notebook config
c.NotebookApp.ip='*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:df04061b16ebd97bacaf7f1199'# 将前面生成的密码替换掉这段字符串
c.NotebookApp.port = 8888 #设置端口号,我这里设置的是8888,可以设置成任意喜欢的
五、启动jupyter服务器
在服务器终端输入命令:
jupyter notebook --config .ipython/profile_myserver/ipython_notebook_config.py
看到有下面输出就表示开启成功
六、 本机测试
若服务器的IP地址是:210.28.35.178,则在本机的浏览器中输入:210.28.35.178:8888,输入密码后就可以看到
熟悉的画面了。