1. nodejs 설치

nodejs 바이너리파일 다운로드 : https://nodejs.org/en/download/

2. 압축해제 후 환경변수 설정

$ cd ~/usr/local
$ xz -d node-v16.13.1-linux-x64.tar.xz
$ tar -xf node-v16.13.1-linux-x64.tar

$ vi .bash_profile
# nodejs
export NODE_HOME=$HOME/usr/local/node-v16.13.1-linux-x64
PATH=$NODE_HOME/bin:$PATH

 

3. http-proxy 모듈 설치

$ git clone https://github.com/jupyterhub/configurable-http-proxy
$ cd configurable-http-proxy
$ npm install -g

4. jupyterhub config 설정

일반계정으로 실행하게 되면 LD_LIBRARY_PATH를 가져오지 못해 설정에 추가해준다. (원인은 모름)

$ cd /DATA/jupyterhub
$ jupyterhub --generate-config

# LD_LIBRARY_PATH 환경 추가
import os
c = get_config()
os.environ['LD_LIBRARY_PATH'] = '/home/eva/usr/local/Python3.9.9/lib'
c.Spawner.env.update('LD_LIBRARY_PATH')
c.Spawner.env_keep.append('LD_LIBRARY_PATH')

os.environ['HADOOP_HOME'] = '/home/eva/usr/local/hadoop-3.3.1'
c.Spawner.env.update('HADOOP_HOME')
c.Spawner.env_keep.append('HADOOP_HOME')

os.environ['HADOOP_CONF_DIR'] = '/home/eva/usr/local/hadoop-3.3.1/etc/hadoop'
c.Spawner.env.update('HADOOP_CONF_DIR')
c.Spawner.env_keep.append('HADOOP_CONF_DIR')


# ssl 적용
c.JupyterHub.ssl_cert = '/home/eva/ssl/cert.pem'
c.JupyterHub.ssl_key = '/home/eva/ssl/cert.key'

# 어드민으로 사용할 계정 등록
c.JupyterHub.admin_users = {'eva'}
c.Authenticator.admin_users = {'eva'}

# 단일 주피터를 실행할 때 실행되는 방식
c.JupyterHub.spawner_class = 'simplespawner.SimpleLocalProcessSpawner'
c.Spawner.default_url = '/lab'

# 인증 방식1
# 임시 사용으로 모든 계정은 password 값으로 로그인이 된다
c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
c.DummyAuthenticator.password = "123123"

# 인증 방식2
# 최초 jupyterhub web에서 로그인 할 때 입력한 비밀번호를 사용한다
# 계정이 없을 때 자동생성 옵션을 해제한다
c.JupyterHub.authenticator_class = 'firstuseauthenticator.FirstUseAuthenticator'
c.FirstUseAuthenticator.create_users = False

# 주피터 파일 경로 (경로 자동생성 옵션을 못 찾음)
c.Spawner.notebook_dir = '/DATA/jupyterhub/{username}'

5. 실행

$ cd /DATA/jupyterhub
$ jupyterhub -f /DATA/jupyterhub/jupyterhub_config.py --ip 0.0.0.0

'BIGDATA > JUPYTER' 카테고리의 다른 글

jupyterhub 설치 (sudo계정 필요)  (0) 2022.03.01

+ Recent posts