0
0

More than 3 years have passed since last update.

CentOS7で複数ユーザーで同時に使用するJupyter Notebook環境を作る

Posted at

jupyterhub

Jupyter Notebookの環境を立てただけでは、複数ユーザーで同時に使用することは困難なので、ユーザー管理機能を追加する「JupyterHub」を用いて、Jupyter Notebookを使用できる環境を作ります。

環境

今回紹介する構築環境は以下です。
- OS:CentOS7.4 (docker)
- Anaconda3-4.3.1
- Python3.6.9
- 基盤:AWS EC2

設定

CentOSコンテナ作成

docker run -it --privileged -d -p 888:8000  --name centos_cho centos:7 /sbin/init

事前インストール

yum install wget
yum install bzip2
yum install sudo
yum install which

以降、rootユーザで操作します

Anaconda3インストール

cd ~
wget https://repo.continuum.io/archive/Anaconda3-4.3.1-Linux-x86_64.sh
bash Anaconda3-4.3.1-Linux-x86_64.sh
※注意点:インストールディレクトリは/opt/anaconda3/にします。

jupyterhubインストール&設定

conda install -c conda-forge jupyterhub
conda install notebook
npm install -g configurable-http-proxy
cd /opt/
jupyterhub --generate-config
vi jupyterhub_config.py
c.JupyterHub.ip = '0.0.0.0'
c.Spawner.ip = '127.0.0.1'
c.JupyterHub.port = 8000
c.PAMAuthenticator.encoding = 'utf8'
c.LocalAuthenticator.create_system_users = True
c.Authenticator.whitelist = {'user1', 'user1', 'user3'}
c.Authenticator.admin_users = {'user1'}
c.LocalAuthenticator.group_whitelist = {'group1'}
c.JupyterHub.statsd_prefix = 'jupyterhub'
c.Spawner.notebook_dir = '~/notebook'

ユーザ作成

groupadd group1
useradd user1
usermod -a -G group1 user1
passwd user1
mkdir -p /home/user01/notebook
chown user01:usergr /home/user01/notebook

起動&アクセス

jupyterhub --no-ssl
http://公開IPアドレス:888/

エラー解決

1.必要なら

yum install -y gcc-c++ make

2.ImportError: libsodium.so.23: cannot open shared object file: No such file or director

conda install -c conda-forge libsodium

3.ModuleNotFoundError: No module named 'nbconvert.exporters.base'

conda upgrade nbconvert

4./usr/lib64/libstdc++.so.6: version GLIBCXX_3.4.21' not found

strings /usr/lib64/libstdc++.so.6 | grep GLIBC
find / -name "libstdc++.so*"
cp /xxx/xxx/xxxx/libstdc++.so.6.0.21 /usr/lib64
cd /usr/lib64
rm -rf libstdc++.so.6
ln -s libstdc++.so.6.0.21 libstdc++.so.6
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
`

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0