๋ฐ์ํ
๋ฆฌ๋ ์ค ํ๊ฒฝ (CentOS 7, Python3.8)์์ JupyterHub ์ค์น ๋ฐฉ๋ฒ ๊ณต์ ํฉ๋๋ค.
์ค์น ์ Jupyter ์ฉ์ด ๊ด๋ จํ์ฌ ๊ฐ๋ตํ๊ฒ ์ ๋ฆฌ ํ๊ฒ ์ต๋๋ค.
Jupyter Notebook
- ๋ํํ Python Interpreter๋ก ์น ํ๊ฒฝ์์ Python ์ฝ๋ ์์ฑ ๋ฐ ์คํํ๋ ๊ฐ๋ฐ ํ๊ฒฝ(tool)
Jupyter Lab
- Jupyter Notebook์ ์ฐจ์ธ๋ ๋ฒ์ ์ผ๋ก ์ฌ์ฉ์ ํธ์ ๊ธฐ๋ฅ๋ค์ด ์ถ๊ฐ๋จ
- ๋ค์ค์ฐฝ ์ง์, csv/pdf ๋ฑ ํ์ผ๋ ์ด ์ ์์ด์ ๋์๋ณด๋์ฒ๋ผ ์ฌ์ฉ ๊ฐ๋ฅ
JupyterHub
- ๋ฉํฐ ์ฌ์ฉ์ ํ๊ฒฝ์์ Jupyter Notebook/Lab์ ์ฌ์ฉ
๐ ์ค์น ๋ฐฉ๋ฒ
1. os ํจํค์ง ์ค์น
yum install –y nodejs
yum install openssl
2. nodejs ํจํค์ง ์ค์น
โพ ์ค์น ๊ณผ์ ์ค nodejs, npm ๋ฒ์ ์ด ๋๋ฌด ๋ฎ์ ๊ณ์ install ์คํจํ์ฌ ์ต์ ๋ฒ์ ์ผ๋ก ์ค์น ํ ํด๊ฒฐ
npm install -g configurable-http-proxy
3. python ํจํค์ง ์ค์น
pip3 install sudospawner
pip3 install jupyterlab
4. ๊ณ์ /๊ทธ๋ฃน ์์ฑ ๋ฐ ๊ถํ ์ค์
useradd admin
passwd admin
groupadd jupyterhub
usermod -a -G jupyterhub admin
visudo
-----------------------------------------------------
Cmnd_Alias JUPYTER_CMD = /usr/local/bin/sudospawner
admin ALL=(%jupyterhub) NOPASSWD:JUPYTER_CMD
-----------------------------------------------------
โพ ์ฌ์ฉ์ ์ถ๊ฐ
useradd user01
passwd user01
usermod -a -G jupyterhub user01
5. ์ค์ ํ์ผ ์์ฑ ๋ฐ ์์ฑ (Ldap ์ค์ ํฌํจ)
mkdir /etc/jupyterhub
chown admin:admin /etc/jupyterhub
cd /etc/jupyterhub
sudo -u admin /usr/local/bin/jupyterhub --generate-config
vi jupyterhub_config.py
-----------------------------------------------------------------------------------------------
c.JupyterHub.hub_connect_ip = '0.0.0.0'
c.JupyterHub.port = 8000
c.JupyterHub.spawner_class = 'sudospawner.SudoSpawner'
c.SudoSpawner.sudospawner_path = '/usr/local/bin/sudospawner'
c.Spawner.default_url = '/lab'
c.JupyterHub.extra_log_file = '/var/log/jupyterhub/jupyterhub.log'
c.Application.log_format = '[%(asctime)s,%(msecs).03d] [%(levelname)s] [%(name)s] %(message)s'
c.Application.log_level = 0
##Ldap Configuration
c.LDAPAuthenticator.server_address = 'adserver.hadoop.com'
c.LDAPAuthenticator.server_port = 389
c.LDAPAuthenticator.lookup_dn = False
c.LDAPAuthenticator.bind_dn_template = [
"CN={username},OU=Users,OU=BIGDATA,DC=HADOOP,DC=COM",
]
-----------------------------------------------------------------------------------------------
6. jupyterhub ์คํ ๋ฐ ์ ์ ํ์ธ (http://localhost:8000)
jupyterhub -f /etc/jupyterhub/jupyterhub_config.py
โพ ์คํ ์ค ์๋์ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค๋ฉด, sqlite-devel ํจํค์ง ์ค์น ๋ฐ python ์ฌ์ค์น๊ฐ ํ์
Error: No module named '_sqlite3'
1) Install the sqlite-devel package:
yum install -y sqlite-devel
2) Recompile python from the source:
./configure
make
make altinstall
7. ์ ์ ํ์ธ ํ ์๋น์ค ๋ฑ๋ก ๋ฐ ์คํ
vi /usr/lib/systemd/system/jupyterhub.service
-------------------------------------------------------------------------------
[Unit]
Description=Jupyterhub
[Service]
User=root
ExecStart=/usr/local/bin/jupyterhub -f /etc/jupyterhub/jupyterhub_config.py
-------------------------------------------------------------------------------
systemctl daemon-reload
systemctl start jupyterhub