Ubuntu 远程 Jupyter 配置

每次上课都要重新部署环境,最近看到阿里云的大学生优惠活动,就着手了一台云服务器,于是就把环境部署在上面了。

环境:阿里云 Ubuntu 16.04 64位

新建普通用户

su root                           # 切换到管理员用户
useradd -r -m -s /bin/bash 新用户名 # 新建用户
passwd 新用户名 # 设置新用户密码
su 新用户名 # 切换使用新用户

云主机添加安全组

云服务器默认只开启了几个端口,我们要手动增加开放的端口,Jupyter 默认使用的是 8888 端口,具体操作看服务器提供商的文档。

安装、配置 Anaconda

为了方便下载、更新我们使用清华镜像

cd ~
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.0-Linux-x86_64.sh
sudo chmod 776 Anaconda3-5.3.0-Linux-x86_64.sh
sudo ./Anaconda3-5.3.0-Linux-x86_64.sh conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

按照提示进行安装,测试执行 conda --version

如果报错需配置环境变量,编辑 /etc/environment,添加 :/home/***/anaconda3/bin

配置 jupyter notebook 远程访问

  • 使用命令生成配置文件

    jupyter notebook --generate-config

  • 利用 IPython 生成密钥

    In [1]: from notebook.auth import passwd
    In [2]: passwd()
    Enter password:
    Verify password:
    Out[2]: 'sha1:********************************'
  • 编辑生成的配置文件 ~\.jupyter/jupyter_notebook_config.py

    # 限定可以访问的ip
    c.NotebookApp.ip= '*'
    # 粘贴上面生成的密钥
    c.NotebookApp.password = u'sha1:**************************************'
    c.NotebookApp.open_browser = False
    c.NotebookApp.port = 8888 # 配置默认的工作目录
    c.NotebookApp.notebook_dir = '/home/dev'

启动和关闭 Jupyter

  • 启动

    jupyter notebook &

  • 关闭

    ps -aux         # 查看进程的 PID
    sudo kill pid

方便开发的 Jupyter 配置

pip 使用清华镜像

pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

小提示:安装 anaconda 时一定要勾选修改 .bashrc,自己配很麻烦,容易和系统自带的 Python2.7 冲突。

使用代码提示

  • 安装 nbextensions
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
  • 安装 nbextensions_configurator
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user
  • 重启jupyter,在弹出的主页面里,能看到增加了一个Nbextensions标签页,在这个页面里,勾选 Hinterland 即启用了代码自动补全

美化 Jupyter

pip install jupyterthemes
jt -t grade3 -fs 12 -altp -tfs 12 -nfs 12 -cellw 88% -T

参考:https://github.com/dunovank/jupyter-themes#command-line-examples

Ubuntu 远程 Jupyter 配置的更多相关文章

  1. Ubuntu远程vnc配置

    1. 安装xrdp 使用快捷键"Ctrl+Alt+T"打开一个终端窗口,输入"sudo apt-get install xrdp"-->回车-->输 ...

  2. 烂泥:学习ubuntu远程桌面(一):配置远程桌面

    本文由秀依林枫提供友情赞助,首发于烂泥行天下 公司服务器目前安装的都是ubuntu 14.04系统,而且由于业务需要,需要使用到ubuntu的远程桌面功能.所以本篇文章都是围绕ubuntu的远程桌面来 ...

  3. 服务器jupyter配置与ssh远程登录

    jupyter 配置 首先安装jupyter,在anaconda套装中已包含,如果安装的是精简版的miniconda则通过conda install jupyter安装. 生成配置文件 jupyter ...

  4. 远程jupyter+pycharm配置

    前言 作为一个数据工程师,最喜欢的事情就是不停的在现实的服务端环境调试代码的参数.我们在本地的环境与生产的状况决然不同,我们一开始在本地写代码测试再部署到服务端的三板斧就不适用了. 最好的方式可以直接 ...

  5. Jupyter Notebook 远程连接配置(转载)

    转载博客的Jupyter Notebook远程连接配置方法. 0 - 参考资料 https://www.jianshu.com/p/08f276d48669?utm_campaign=maleskin ...

  6. ubuntu 18.04 配置notebook远程连接的坑

    jupyter-notebook的安装不在此说明 在网上搜了很多方案都不行,好不容易从坑里爬出来 以下为远程连接配置方法 1.生成配置文件 jupyter notebook --generate-co ...

  7. Firefly安装ROS及ssh远程登录配置

    一.在Linux firefly 3.10.0 上安装ROS-indigo 快捷键 CTRL + ALT  + T 打开终端并安装ROS-indigo sudo sh -c 'echo "d ...

  8. 烂泥:学习ubuntu远程桌面(二):远程桌面会话管理

    本文由秀依林枫提供友情赞助,首发于烂泥行天下 在上一篇文章中,我们讲解了如何给ubuntu安装远程桌面及其配置,这篇文章我们再来讲解下有关ubuntu远程桌面会话的问题. 一.问题描述 在我们使用ub ...

  9. Ubuntu Server如何配置SFTP

    SH File Transfer Protocol是一个比普通FTP更为安全的文件传输协议.(参考资料:http://en.wikipedia.org/wiki/SSH_File_Transfer_P ...

随机推荐

  1. 1840: Jack Straws

    1840: Jack Straws 时间限制(普通/Java):1000MS/10000MS     内存限制:65536KByte 总提交: 168            测试通过:129 描述 I ...

  2. div盒子水平居垂直中的几种方法

      div盒子水平居垂直中的几种方法<!DOCTYPE html><html>    <head>        <mete charset="ut ...

  3. HTTP权威指南_Note

    Chapter 1 HTTP概述 1. Web客户端和Web服务器 web服务器即为HTTP服务器 Web浏览器属于客户端 Web浏览器向服务器请求HTTP对象 2. 资源 Web服务器是Web资源的 ...

  4. filter与map函数

    ·filter()函数filter()函数包括两个参数,分别是function和list.该函数根据function参数返回的结果是否为真来过滤list参数中的项,最后返回一个新列表,如下例所示:&g ...

  5. Java bean 转 Map

    Java bean 转 Map 时需要使用Fastjson //方法 一 Map<String, Object> a = (Map<String, Object>)JSON.t ...

  6. 设置和获取cookie

    通过make_response(“响应体”)创建response响应对象. 然后返回. 与直接return “响应体” 是一样的. 但是这里我们需要用到response响应对象,去设置cookie @ ...

  7. 通过类创建子线程&同步锁

    一.通过类创建子线程 import threading class MyThread(threading.Thread): def __init__(self,num): threading.Thre ...

  8. js列表添加内容清除内容,时钟

    <div id="wai"> <div id="zuo"> <select multiple="multiple&quo ...

  9. xcodebuild 错误:unknown error -1=ffffffffffffffff

    1.security list-keychains 2.security unlock-keychains -p "your password" "your login ...

  10. sitecore 8.2 item属性查询

    查询: query:/sitecore/content/[@@templatename='Homepage'] 结果: home (name: home, path: /sitecore/conten ...