CentOS配置远程jupyter环境


一、Anaconda3安装

  1. 从清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn//anaconda/archive/ 中找到(.sh)文件下载连接,我所安装的版本是:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linux-x86_64.sh

  2. 使用wget 下载以上anaconda3安装包

[root@VM-0-7-centos home]# wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linux-x86_64.sh
  1. 使用bash命令安装Anaconda3-5.3.1-Linux-x86_64.sh
[root@VM-0-7-centos home]# bash Anaconda3-5.3.1-Linux-x86_64.sh

安装过程中按Enter建继续,当出现是否安装VsCode询问时,输入no 即可;

  1. 配置Anaconda环境变量
    先执行一下命令:
 [root@VM-0-7-centos home]# vim /root/.bashrc

并在vim打开的配置文件最后加入anaconda的安装路径:

export PATH="/root/anaconda3/bin:$PATH"

然后按Esc,输入 :wq(表示保存并退出)

使用一下命令重现加载配置文件

[root@VM-0-7-centos home]# source ~/.bashrc

最后测试是否成功:

[root@VM-0-7-centos home]# conda -V
conda 4.5.11

若看到conda 版本,说明anaconda安装成功!

二、配置jupyter notebook 远程环境

  1. 生成配置文件
[root@VM-0-7-centos home]# jupyter notebook --generate-config

生成的配置文件路径为:/root/.jupyter/jupyter_notebook_config.py

  1. 创建访问密码
[root@VM-0-7-centos ~]# jupyter notebook password
Enter password: 
Verify password: 
[NotebookPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_notebook_config.json
  1. 创建hash密码
[root@VM-0-7-centos ~]# ipython
Python 3.7.0 (default, Jun 28 2018, 13:15:42) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from notebook.auth import passwd                                                                              
In [2]: passwd()                                                                                                      
Enter password: 
Verify password: 
Out[2]: 'sha1:3454fd2b8ca1:2e9cf3f77dc9a169dfdd83ccdad167cb99fc7f3b'
In [3]: quit
[root@VM-0-7-centos ~]# 
  1. 配置jupyter_notebook_config.py文件
    vim 打开jupyter_notebook_config.py配置文件:
 [root@VM-0-7-centos ~]# vim /root/.jupyter/jupyter_notebook_config.py

并在打开的文件中更改一下几个选项(vim 先按esc 然后:/c.NotebookApp.password查找):

c.NotebookApp.password = u'sha1:3454fd2b8ca1:2e9cf3f77dc9a169dfdd83ccdad167cb99fc7f3b'

c.NotebookApp.port = 8889

c.NotebookApp.allow_remote_access = True

c.NotebookApp.ip = '*'

c.NotebookApp.open_browser = False
  1. 后台激动jupyter服务:
 [root@VM-0-7-centos ~]# nohup jupyter notebook --allow-root &
[1] 28966

后台运行jupyter服务后 ,本地浏览器输入IP地址和配置的端口号,并输入jupyter访问密码即可登录操作

  1. 查找jupyter 后台进程
[root@VM-0-7-centos ~]#  ps -aux | grep jupyter
root     28966  0.2  2.7 601440 56640 pts/0    Sl   16:07   0:01 /root/anaconda3/bin/python /root/anaconda3/bin/jupyter-notebook --allow-root
  1. 释放进程
[root@VM-0-7-centos ~]# kill -9 28966
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

rapkat310

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值