Jupyter Notebook Setup - Nantawat6510545543/big-data-summary GitHub Wiki

JupyterLab Setup on Hadoop VM

Assume you are logged in as user: hadoop

1. Install pip3

sudo apt install python3-pip

2. Install JupyterLab

Preferred: Using pip3 (may be blocked on recent Ubuntu)

pip3 install jupyterlab

If you see a externally-managed-environment error, use one of the alternatives below.


Option A: Use pipx (Safe, Recommended for Isolated App Installs)

sudo apt install pipx
pipx ensurepath
pipx install jupyterlab

Launch:

~/.local/bin/jupyter-lab

Option B: Use Python Virtual Environment

sudo apt install python3-venv
python3 -m venv ~/venv
source ~/venv/bin/activate
pip install jupyterlab

Launch:

~/jupyter-env/bin/jupyter-lab

3. Optional: Generate and Edit Config

If you installed JupyterLab using pip3

~/.local/bin/jupyter server --generate-config
nano /home/hadoop/.jupyter/jupyter_server_config.py

If you installed JupyterLab using pipx

~/.local/bin/jupyter-lab server --generate-config
nano /home/hadoop/.jupyter/jupyter_lab_config.py

Add:

c.NotebookApp.token = ''
c.NotebookApp.password = u''
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8887
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.allow_origin = '*'
c.NotebookApp.allow_remote_access = True

4. Create a JupyterLab Systemd Service

sudo nano /etc/systemd/system/Jupyter.service

Paste:

[Unit]
Description=Jupyter Lab
[Service]
Type=simple
User=hadoop
Group=hadoop
WorkingDirectory=/home/hadoop
ExecStart=/home/hadoop/.local/bin/jupyter-lab --config=/home/hadoop/.jupyter/jupyter_server_config.py
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target

5. Enable & Start the Service

sudo systemctl enable Jupyter.service
sudo systemctl daemon-reload
sudo systemctl start Jupyter.service
sudo systemctl status Jupyter.service
sudo ufw allow 8887/tcp

6. Access JupyterLab

Then visit:

http://<your-vm-ip>:8887
⚠️ **GitHub.com Fallback** ⚠️