curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ~/Miniconda3-latest-Linux-x86_64.sh -b -p /app/dkit/anaconda3
ln -Tfs /app/dkit/anaconda3/bin/conda /usr/bin/conda
source /app/dkit/anaconda3/etc/profile.d/conda.sh
echo -e "y\n" | conda create -n jupyter python=3.9
conda activate jupyter
pip install jupyterlab
echo -e "y\n" | conda install -c conda-forge jupyter_server=2.0.0
mkdir -p /app/dkit/anaconda3/config
cat <<JUPYTER_SETTING > /app/dkit/anaconda3/config/jupyter_config.py
c.NotebookApp.open_browser = False
c.NotebookApp.ip = "0.0.0.0"
c.NotebookApp.port = 8888
c.NotebookApp.allow_origin = "*"
JUPYTER_SETTING
set +H
echo c.NotebookApp.password = \'`python -c "from notebook.auth import passwd; print(passwd('P@ssw0rd!'))"`\' >> /app/dkit/anaconda3/config/jupyter_config.py
mkdir -p /app/ws/jupyter
cat <<JUPYTER_SETTING > /etc/systemd/system/jupyter.service
[Unit]
Description=Jupyter Lab Server
[Service]
Type=simple
PIDFile=/run/jupyter.pid
User=root
Environment="PATH=/app/dkit/anaconda3/envs/jupyter/bin:/app/dkit/anaconda3/condabin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ExecStart=/app/dkit/anaconda3/envs/jupyter/bin/jupyter-lab --allow-root --config=/app/dkit/anaconda3/config/jupyter_config.py
WorkingDirectory=/app/ws/jupyter
Restart=always
RestartSec=10
StandardOutput=file:/root/.jupyter/jupyter.service.log
StandardError=file:/root/.jupyter/jupyter.service.log
[Install]
WantedBy=multi-user.target
JUPYTER_SETTING
systemctl daemon-reload
systemctl enable jupyter
systemctl start jupyter
systemctl status jupyter