Running Jupyter Notebook Server on VPS: Turn Any Device into a Professional Data Science Tool
A detailed guide to running a Jupyter Notebook Server on VPS, turning any device into a professional data science tool. Covers installation, security configuration, remote access,...
Introduction
Running a Jupyter Notebook Server on a VPS allows you to turn any device—from a personal computer to a smartphone—into a professional data science tool. With remote access, large data processing capabilities, and integration with popular Python libraries, Jupyter Notebook is ideal for Data Science, Machine Learning, and data analysis. In this guide, we will set up a Jupyter Notebook Server on a VPS, configure security, and enable safe remote access.
Prerequisites and Preparation
Before starting, ensure you have:
- A Linux-based VPS (Ubuntu 20.04/22.04 or Debian 11/12)
- Root or sudo user access
- A stable internet connection
- SSH access to the VPS
Setting Up the Jupyter Notebook Server
Run the following commands on your VPS to install Jupyter Notebook:
sudo apt update
sudo apt upgrade -y
sudo apt install python3-pip python3-venv -y
python3 -m venv jupyter_env
source jupyter_env/bin/activate
pip install jupyter notebook
After installation, start Jupyter Notebook with:
jupyter notebook --no-browser --port=8888 --ip=0.0.0.0
Notes: Change 8888 if needed. The --ip=0.0.0.0 parameter enables remote access.
Security Configuration
To ensure safety, use:
- A strong password for Jupyter Notebook
- Generate a Jupyter configuration file:
jupyter notebook --generate-config
Open ~/.jupyter/jupyter_notebook_config.py and add the following lines:
c.NotebookApp.password = u'sha1:your_hashed_password'
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
c.NotebookApp.token = ''
To generate a password hash, run:
python -c "from notebook.auth import passwd; print(passwd())"
Replace your_hashed_password with the output.
Remote Access
To access Jupyter Notebook from another device, open port 8888 on the firewall:
sudo ufw allow 8888/tcp
Access via a browser at:
http://:8888
Enter the configured password to log in.
Performance Optimization and Management
To optimize performance, consider:
- Using a VPS with NVMe SSD storage (see: NVMe Cloud VPS for Docker, Nginx & Databases)
- Running Jupyter in a virtual environment
- Integrating with tools like Kube-Ops-View for real-time container system monitoring
Verification
After setup, verify functionality by:
- Running
jupyter notebookon the VPS - Accessing
http://from another device:8888 - Creating a new notebook and running a simple Python command like
print("Hello, Data Science!")
Troubleshooting
- Cannot access: Check firewall rules, open ports, and correct IP address.
- Password not accepted: Verify the hashed password in the configuration file.
- Slow performance: Review Disk I/O and IOPS: Key Factors in VPS Performance.
References
Recommended NVMe Cloud VPS Plans to Deploy This Setup
Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.
VPS-3E
10% VAT included
- CPU: 2 vCPU
- RAM: 4 GB
- SSD: 50 GB NVMe
