生产环境使用 Fedora 28, 并且需要搭建一个 Jupyter 的notebook 方便使用,所搭建的Jupyter 支持单人远程 密码访问

1. 安装

安装 Jupyter , 出错

[root@dhcp-- ~]# pip install jupyter
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
.
.
.
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying scandir.py -> build/lib.linux-x86_64-2.7
running build_ext
building '_scandir' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE= -fexceptions -fstack-protector-strong --param=ssp-buffer-size= -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE= -fexceptions -fstack-protector-strong --param=ssp-buffer-size= -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2. -c _scandir.c -o build/temp.linux-x86_64-2.7/_scandir.o
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
error: command 'gcc' failed with exit status ----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8KqVrv/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-IrivkV-record/install-record.txt --single-version-externally-managed --compile" failed with error code in /tmp/pip-build-8KqVrv/scandir/
You are using pip version 9.0., however version 10.0. is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

安装 redhat-rpm-config

[root@dhcp-- ~]# yum install redhat-rpm-config

安装 python-devel

[root@dhcp-- ~]# yum install python-devel

安装 notebook

[root@dhcp-- ~]# pip install notebook

2. 运行

生成token 运行:

[root@dhcp-- ~]# jupyter notebook --allow-root
[I ::13.108 NotebookApp] Serving notebooks from local directory: /root
[I ::13.108 NotebookApp] active kernels
[I ::13.108 NotebookApp] The Jupyter Notebook is running at:
[I ::13.108 NotebookApp] http://localhost:8888/?token=60bbeb5c2ef4a8c0e15cfcb85588e265a185b46949e051e7

生成配置文件:

[root@dhcp-- ~]# jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py

3. 配置

(1)在配置文件中配置密码:

c.NotebookApp.password = u'sha1:12a39cedb875:c97d0285f90cec397fffe96f11e5ef5e56e90fa2'

其中:加密使用

from notebook.auth import passwd  中 password 方法进行加密
可以在 python shell 中生成 或者直接使用:
[root@dhcp-- ~]# jupyter notebook password

设置密码,并直接写到配置文件中

如果没有设置密码 可以使用 jupyter notebook list 命令来查看 token 从而进行访问。

(2)允许所有ip地址访问

# Set ip to '*' to bind on all interfaces (ips) for the public server
c.NotebookApp.ip = '*' or c.NotebookApp.ip = '0.0.0.0' (2020年4月20日更新)
c.NotebookApp.password = u'sha1:bcd259ccf...<your hashed password here>'
c.NotebookApp.open_browser = False # It is a good idea to set a known, fixed port for server access
c.NotebookApp.port = 8888

(3)  保证 IPython Clusters 运行

[root@dhcp-- ~]# pip install ipyparallel

后台运行:

[root@dhcp-- ~]# nohup jupyter notebook --allow-root &

具体对 notebook 外观的修改,可以从源代码角度进行修改,进行定制,这里就不多讲了。

如果 需要添加 防火墙规则,可以根据实际需要的端口进行添加。

更多配置请参考:

https://jupyter-notebook.readthedocs.io/en/stable/public_server.html#securing-a-notebook-server

https://github.com/ipython/ipyparallel

https://jupyterhub.readthedocs.io/en/latest/

保持更新,转载请注明出处。

Use Jupyter notebook on Fedora 28的更多相关文章

  1. ubuntu下设置jupyter notebook 2017年07月29日 19:28:34 小旋锋 阅读数:8329 标签: ubuntu 更多 个人分类: python 二三事 来源:http://blog.csdn.net/suzyu12345/article/details/51037905 Ipython Notebook现在已经改名为Ipython jupyter,是最知名最好用的

    ubuntu下设置jupyter notebook     来源:http://blog.csdn.net/suzyu12345/article/details/51037905 Ipython No ...

  2. 27个Jupyter Notebook使用技巧及快捷键(翻译版)

    Jupyter Notebook Jupyter Notebook 以前被称为IPython notebook.Jupyter Notebook是一款能集各种分析包括代码.图片.注释.公式及自己画的图 ...

  3. Jupyter Notebook中的快捷键

    1.快捷键 Jupyter Notebook 有两种键盘输入模式.编辑模式,允许你往单元中键入代码或文本:这时的单元框线是绿色的.命令模式,键盘输入运行程序命令:这时的单元框线是灰色. 命令模式 (按 ...

  4. Jupyter Notebook的安装

    依赖安装 pandoc texlive-xetex texlive-lang-cjk 安装Jupyter Notebook 本文不讲解在Anaconda中安装. 安装方法 sudo python -m ...

  5. 使用Jupyter Notebook编写技术文档

    1.jupyter Notebook的组成 这里它的组件及其工程构成,帮助大家更好的用好jupyter Notebook 组件 Jupyter Notebook结合了三个组件: 笔记本Web应用程序: ...

  6. 在CentOS7服务器端启动jupyter notebook服务,在windows端使用jupyter notebook,服务器充当后台计算云端

    在CentOS7服务器端启动jupyter notebook服务,在windows端使用jupyter notebook,服务器充当后台计算云端 在服务器端启动jupyter notebook服务,在 ...

  7. linux安装python3 ,安装IPython ,安装jupyter notebook

    安装python3    下载到 /opt/中 1.下载python3源码,选择3.6.7因为ipython依赖于>3.6的python环境wget https://www.python.org ...

  8. 初学者需要IPython 与 Jupyter Notebook 吗?

    ipython 是 jupyter notebook的前身并拥有ipython的全部功能         jupyter拥有 cell, markdown 整合的功能, 能同时运行代码, 而且是多组的 ...

  9. 机器学习:Jupyter Notebook中numpy的使用

    一.Jupyter Notebook的魔法命令 # 模块/方法 + ?或者help(模块/方法):查看模块/方法的解释文档: 1)%run # 机械学习中主要应用两个魔法命令:%run.%timeit ...

随机推荐

  1. php使用 utf8_encode 来将特殊字符转成 utf8

    如果在接受 $_POST 或 $_GET 时发生类似的错误报告:SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF6te ...

  2. Spring Aop 注解方式参数传递

    v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VM ...

  3. vue-cli中配置屏幕自适应(px2rem)

    在vue-cli中配置屏幕自适应的方法 首先,我们需要安装flexible库. npm i lib-flexible --save 在index.html文件当中配置meta标签, <meta ...

  4. 使用 Swagger UI 与 Swashbuckle 创建 RESTful Web API 帮助文件(转)

    作者:Sreekanth Mothukuru2016年2月18日 本文旨在介绍如何使用常用的 Swagger 和 Swashbuckle 框架创建描述 Restful API 的交互界面,并为 API ...

  5. C# 往线程里传参数的方法总结

    Thread (ParameterizedThreadStart) 初始化 Thread 类的新实例,指定允许对象在线程启动时传递给线程的委托.   Thread (ThreadStart) 初始化 ...

  6. SpringBoot结合Swagger2自动生成api文档

    首先在pom.xml中添加如下依赖,其它web,lombok等依赖自行添加 <dependency> <groupId>io.springfox</groupId> ...

  7. Codeforces292D(SummerTrainingDay06-L 前缀并查集)

    D. Connected Components time limit per test:2 seconds memory limit per test:256 megabytes input:stan ...

  8. 初学HTML-2

    HTML标签的分类:单标签:只有开始标签,没有结束标签,即,只由一个<>组成的html.     双标签:有开始标签和结束标签,即,由一个<>和一个</ >组成的h ...

  9. python-外观模式

    源码地址:https://github.com/weilanhanf/PythonDesignPatterns 说明: 外观模式又叫做门面模式.在面向对象程序设计中,解耦是一种推崇的理念.但事实上由于 ...

  10. Javascript经典算法学习1:产生随机数组的辅助类

    辅助类 在几个经典排序算法学习部分,为方便统一测试不同算法,新建了一个辅助类,主要功能为:产生指定长度的随机数组,提供打印输出数组,交换两个元素等功能,代码如下: function ArraySort ...