CentOS7 remote link jupyter AND how to use jupyter

#远程连接jupyter 

1.安装anaconda

2.生成配置文件 #jupyter notebook --generate-config

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

3.生成jupyter密码

Enter password:   youpasswd
Verify password:   youpasswd(confirm),生成加密后的密码

root@mycount/]# ipython  
Python 3.5.1 (default, Oct 21 2016, 21:37:19)   
Type 'copyright', 'credits' or 'license' for more information  
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.  
  
In [1]: from notebook.auth import passwd  
  
In [2]: passwd()  
Enter password:   
Verify password:   
Out[2]: 'sha1:adfdagegweghwsgghwrhno5454554bvshedhehe'  
  
In [3]:quit()   

4.修改配置文件,命令:

[root@localhost ~]# vi /root/.jupyter/jupyter_notebook_config.py 

5.填写配置信息 

c.NotebookApp.ip='*' #设置访问notebook的ip,*表示所有IP,这里设置ip为都可访问  
c.NotebookApp.password = u'sha1:fdfdfsgergwgwg598745ghrgrgsgsgsg' #填写刚刚生成的密文  
c.NotebookApp.open_browser = False # 禁止notebook启动时自动打开浏览器(在linux服务器一般都是ssh命令行访问,没有图形界面的。所以,启动也没啥用)  
c.NotebookApp.port =8888 #指定访问的端口,默认是8888。
c.NotebookApp.notebook_dir = '/home/chen/tensorfile' #更改默认jupyter打开文件(无,则默认为anaconda安装的文件夹)

6.启动jupyter notebook 命令 # jupyter notebook --allow-root   或  #jupyter notebook --allow-root&(后台挂起运行)

[root@localhost ~]# jupyter notebook --allow-root

[W 10:53:38.866 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 10:53:38.926 NotebookApp] JupyterLab beta preview extension loaded from /root/anaconda3/lib/python3.6/site-packages/jupyterlab
[I 10:53:38.927 NotebookApp] JupyterLab application directory is /root/anaconda3/share/jupyter/lab
[I 10:53:38.933 NotebookApp] Serving notebooks from local directory: /root
[I 10:53:38.933 NotebookApp] 0 active kernels
[I 10:53:38.933 NotebookApp] The Jupyter Notebook is running at:
[I 10:53:38.933 NotebookApp] http://localhost.localdomain:8888/
[I 10:53:38.934 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 10:53:43.575 NotebookApp] 302 GET / (10.0.93.184) 0.99ms
[I 10:53:43.579 NotebookApp] 302 GET /tree? (10.0.93.184) 1.05ms

7.浏览器访问:http://yourip:8888/,输入密码:

8.进入(默认文件路径【如下图显示的文件夹】可以在配置文件中更改,如上面第5步中最后一行):

 9.如果访问出错,关闭linux防火墙,service iptables stop关闭,service iptables start开启

        *. 永久性生效

        开启:chkconfig iptables on

        关闭:chkconfig iptables off

        *. 即时生效,重启后失效

        开启:service iptables start

        关闭:service iptables stop

[root@localhost ~]# service iptables stop
Redirecting to /bin/systemctl stop iptables.service
Failed to stop iptables.service: Unit iptables.service not loaded.

10.如果提示:Failed to stop iptables.service: Unit iptables.service not loaded.则关闭防火墙失败

centos7关闭防火墙有变化:systemctl stop firewalld.service          systemctl disable firewalld.service

[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

systemctl命令戳: 这里

#jupyter使用方法

1.新建文件,点击new,确定python为运行环境

2. 使用

 3.可以把jupyter文件转换pdf和html等文件

5.下载之后浏览器打开长这样:

详细使用jupyter可以参考:这里

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章