星期四, 9月 24, 2015

Jupyterhub with CentOS 7 小記

最近真的覺得 jupyter 還有 jupyterhub 真是不錯的東西
所以就來動手裝一下 jupyterhub

OS: CentOS 7  in Chameleon Cloud


jupyter 官方網頁 https://jupyter.org/




jupyter 是給單人用的, 如果要多人同時使用, 就要使用 jupyterhub


Jupyterhub requires Python  >= 3

檢查 python 版本
$ whereis  -b python
python: /usr/bin/python2.7 /usr/bin/python /usr/lib/python2.7 /usr/lib64/python2.7 /usr/include/python2.7


$ sudo  yum   search   python3
============================================================== N/S matched: python3 ==============================================================
python-fastcache.x86_64 : C implementation of python3 lru_cache
python3-pkgversion-macros.noarch : Convenience macros for Fedora/EPEL Python 3 packages building
python34.x86_64 : Version 3 of the Python programming language aka Python 3000
python34-debug.x86_64 : Debug version of the Python 3 runtime


$ sudo  yum  -y  install   python34
Resolving Dependencies
--> Running transaction check
---> Package python34.x86_64 0:3.4.3-2.el7 will be installed
--> Processing Dependency: python34-libs(x86-64) = 3.4.3-2.el7 for package: python34-3.4.3-2.el7.x86_64
--> Processing Dependency: libpython3.4m.so.1.0()(64bit) for package: python34-3.4.3-2.el7.x86_64
--> Running transaction check
---> Package python34-libs.x86_64 0:3.4.3-2.el7 will be installed
--> Finished Dependency Resolution


Dependencies Resolved


==================================================================================================================================================
Package                                Arch                            Version                               Repository                     Size
==================================================================================================================================================
Installing:
python34                               x86_64                          3.4.3-2.el7                           epel                           49 k
Installing for dependencies:
python34-libs                          x86_64                          3.4.3-2.el7                           epel                          6.6 M


Transaction Summary
==================================================================================================================================================
Install  1 Package (+1 Dependent package)


Total download size: 6.7 M
Installed size: 27 M
Is this ok [y/d/N]:  Y


檢查 python 版本
$ whereis  -b  python
python: /usr/bin/python2.7 /usr/bin/python /usr/bin/python3.4 /usr/bin/python3.4m /usr/lib/python2.7 /usr/lib/python3.4 /usr/lib64/python2.7 /usr/lib64/python3.4 /usr/include/python2.7 /usr/include/python3.4m

安裝 jupyterhub 需要的相關套件
$ sudo  yum  -y  install   zlib-devel   bzip2-devel   openssl-devel   ncurses-devel   sqlite-devel readline-devel   tk-devel   gdbm-devel   db4-devel   libpcap-devel   xz-devel  npm


利用 npm 指令 安裝 http proxy
$ sudo  npm  install   -g   configurable-http-proxy


安裝  wget 指令
$ sudo  yum   -y   install   wget


取得 get-pip.py 來安裝 pip3
$ wget   https://bootstrap.pypa.io/get-pip.py


安裝 pip3 指令
$ sudo  python3.4   get-pip.py


安裝 python 以及 python3 開發套件
$ sudo yum   -y   install   python-devel    python34-devel


透過 pip3 安裝 juypterhub
$ sudo  pip3  install  jupyterhub   ipython[notebook]


最後就是 啟動 jupyterhub 了,  預設會在 port 8000 listen
$sudo  jupyterhub

螢幕快照 2015-09-23 下午3.27.21.png
接下來可以使用 系統內的使用者登入


螢幕快照 2015-09-23 下午3.29.18.png
例如可以新增一個 Python 3 的 notebook


可以在裡面撰寫 python 程式並執行它


螢幕快照 2015-09-23 下午3.28.39.png


也可以利用終端機
是個非常方便的工具


然後也有把上面的過程寫成 shell script
如果懶得自己裝就抓下來執行就好
假設已經有個 sudo 授權的使用者


可以利用 curl 指令把 shell script 抓下來 存成 Install.sh ( 不用這個名字也可以啦 )


執行 安裝的 script
$ sh  Install.sh



~ enjoy it




沒有留言: