Ubuntu16.04安装配置jupyterhub
1 Anconda3安装 1.1 下载
国内代理:https://mirror.tuna.tsinghua.edu.cn/help/anaconda/
在https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/下载对应版本,此处为: Anaconda3-4.3.1-Linux-x86_64.sh
下载位置在根目录:~/ Anaconda3-4.3.1-Linux-x86_64.sh
1.2 安装
对应目录下执行:bashAnaconda3-4.3.1-Linux-x86_64.sh
接受协议
同意协议:yes
添加路径:yes,此处路径默认为:/root/.bashrc 立即生效:source/root/.bashrc
1.3 测试安装
通过命令:conda –version
1.4 补充说明
默认安装了anaconda3,并使路径生效后,python版本为3.6.0
因此此处pip默认为pip3,Ubuntu16.04自带的python版本为2.7
2 安装依赖包 2.1 npm/nodejs
命令:apt-get install npm nodejs-legacy
验证: node-v npm –v
PS:若apt源为aliyun源(如阿里云的ECS服务器中的Ubuntu),会提示找不到包,此处提供的解决办法是通过修改apt源 修改apt源为默认Ubuntu源 查看源
命令:cat /etc/apt/sources.list
若出现deb http://us.archive.ubuntu.com/ubuntu/,则说明源为Ubuntu系统默认的源 若未出现且提示安装包找不到,继续下一步 修改源
首先进入相应目录:cd /etc/apt/
备份原文件,命令:cpsources.listsources.list.bak
清空原文件内容,然后插入以下内容
#deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## universe WILL NOT receive any review or updates from the Ubuntu security ## team. deb http://us.archive.ubuntu.com/ubuntu/ xenial universe # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu xenial partner # deb-src http://archive.canonical.com/ubuntu xenial partner deb http://security.ubuntu.com/ubuntu xenial-security main restricted # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted deb http://security.ubuntu.com/ubuntu xenial-security universe # deb-src http://security.ubuntu.com/ubuntu xenial-security universe deb http://security.ubuntu.com/ubuntu xenial-security multiverse # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
保存后通过
刷新:①apt-get update;②apt-get upgrade
2.2 proxy
命令:npm install -g configurable-http-proxy 验证:configurable-http-proxy –version
PS:国内存在npm可能被墙,修改npm镜像为淘宝NPM镜像 命令:npm install -g cnpm --registry=https://registry.npm.taobao.org 同步:cnpm sync connect
之后利用cnpm代替npm安装proxy,命令如下: cnpm install -g configurable-http-proxy
3 jupyterhub安装 3.1 jupyterhub
命令:pip install jupyterhub 验证:jupyterhub –V
3.2 notebook
安装好jupyterhub后,notebook一般是同步安装了,此处做一下更新。 命令:pip install --upgrade notebook
3.3 验证访问
开启服务:jupyterhub --no-ssl
本机访问:http://127.0.0.1:8000 外网访问:http://your_ip:8000
PS:如果不能访问,关闭防火墙试试
4 jupyterhub配置 4.1 安全访问配置
命令:openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem 验证:通过ls,查看是否生成mykey.key和mycert.pem文件
4.2 Github OAuthentication
创建Oauth application
your Github profile > Settings > Oauth application Authorization callback URL
https://your_host/hub/oauth_callback
自动生成Client ID、Client Secret