Ubuntu 远程 Jupyter 配置

时间:2019-04-08 18:43:51   收藏:0   阅读:178

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

方便开发的 Jupyter 配置

pip 使用清华镜像

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

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

使用代码提示

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user

美化 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

原文:https://www.cnblogs.com/wuxie0ne/p/10672438.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!