生产环境使用 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. Spring总结 1.装配bean

    本随笔内容要点如下: 依赖注入 Spring装配bean的方式 条件化装配 一.依赖注入 我理解的依赖注入是这样的:所谓的依赖,就是对象所依赖的其他对象.Spring提供了一个bean容器,它负责创建 ...

  2. JavaScrip t对象和 JSON 数据格式转换

    <script> //定义一个js对象 var person = { firstName: "John", lastName: "Doe", age ...

  3. Leetcode 763. Partition Labels

    思路:动态规划.对于属于coins的coin,只要知道amount-coin至少需要多少个货币就能表示,那么amount需要的货币数目=amount-coin需要的货币数目+1:如果amount-co ...

  4. nginx-access.log的logstash解析

    1.nginx的access的格式: log_format hehe '$http_host $server_addr $remote_addr [$time_local] "$reques ...

  5. Netty 启动过程源码分析 (本文超长慎读)(基于4.1.23)

    前言 作为一个 Java 程序员,必须知道Java社区最强网络框架-------Netty,且必须看过源码,才能说是了解这个框架,否则都是无稽之谈.今天楼主不会讲什么理论和概念,而是使用debug 的 ...

  6. .1-浅析webpack源码之webpack.cmd

    此系列随时可能断更,毕竟我是解释型源码分析…… tips:本系列源码版本为3.10.0 尝试看过Spring的源码,有点烧脑,所以还是重回JS吧! 在配置完环境变量后,可以通过webpack指令进行打 ...

  7. [转]csv文件导入Mysql

    本文转自:https://blog.csdn.net/quiet_girl/article/details/71436108 本篇博客主要讲将csv文件导入Mysql的方法(使用命令行). Step1 ...

  8. WPF ContextMenu的使用

    <Grid.ContextMenu > <ContextMenu> <MenuItem Header="增加" Click="MenuIte ...

  9. C#取整函数Math.Round、Math.Ceiling和Math.Floor 【非原创,用来收藏,分享】

    1.Math.Round:四舍六入五取偶 引用内容 Math.Round(0.0) //0Math.Round(0.1) //0Math.Round(0.2) //0Math.Round(0.3) / ...

  10. C#常见几道面试题

    首先碰到的是这样的一首题目:计算数组{1,1,2,3,5,8.......} 第30位值,不用递归,我写出了以下这样的代码: static void Main(string[] args) { ]; ...