Linux Miniconda 安装jupyter notebook 并配置防火墙

这两天了解了jupyter notebook这个编辑器,相比于pyCharm大型的集成开发环境,jupyter notebook虽然在开发大型的项目上有自己的局限,但notebook有自己独特的优势:

  1. 可以在其中写学习笔记,并将执行的结果保存到笔记中,方便后期的查看
  2. 可以使用conda不同的环境
  3. 相比于python的shell,能执行更复杂的命令,且能保存结果

1. 使用conda安装jupyter notebook

在这里插入图片描述

解决方法:

  • 进入conda环境,执行

在这里插入图片描述

本机已存在,如果没有会直接安装完成

在这里插入图片描述

2. 配置notebook

  1. 生成配置文件
jupyter notebook --generate-config --allow-root

一般会显示生成的目录,可以使用本机的编辑环境对其进行编辑,或者使用Linux Vim 编辑器对其进行编辑,Linux中的notebook配置的位置:~/.jupyter/jupyter_notebook_config.py

  1. 设置登录密码,服务器必选
jupyter notebook password
  1. 修在配置文件
  1. 设置IP: “0.0.0.0” 为本机地址, “*” 可以任意IP访问
  2. 设置端口号
  3. 设置浏览器自动打开

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

3. 启动jupyter notebook

  1. 临时启动:窗口关闭则服务关闭
jupyter notebook --allow-root
  1. 在服务器后台运行
nohup jupyter notebook --allow-root > jupyter.log 2>&1 &
  • nohup: no hang up: 不挂起,即使终端退出,依然后台运行
  • & 让命令后台运行, 并把标准输出写入jupyter.log
  1. 关闭运行的notebook
  • 查看运行的ID
ps -ef | grep jupyter
  • ps -ef : 显示所有的进程
  • grep: 过滤含有jupyter的进程名

在这里插入图片描述

  • 结束进程
kill -9 8614

更新:

本人在前几天遇到了jupyter关闭后无法打开的情况,原因是Linux服务器没有配置jupyter 环境,需要在conda中运行

在这里插入图片描述

4. Linux中防火墙的配置

  1. 查看防火墙的状态
systemctl status firewalld

在这里插入图片描述

  1. 启动 - 关闭防火墙
systemctl start firewalld
systematl stop firewalld
  1. 查看防火墙开启的端口
firewall-cmd --list-ports
  1. 开启 – 关闭 某个端口
firewall-cmd --zone=public --add-port=8889/tcp --permanent
firewall-cmd --zone=public --remove-port=8889/tcp --permanent
  1. 重新加载防火墙:使得新的配置生效
firewall-cmd  --reload
  1. 查看防火墙帮助
man firewall-cmd

参考:

参考链接:
conda安装:https://blog.csdn.net/qq_41699621/article/details/103064684
防火墙使用:https://blog.csdn.net/frdevolcqzyxynjds/article/details/105571095
Conda基本使用见文章: https://blog.csdn.net/qq_44776065/article/details/121619599

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值