Overview
This guide walks you through creating a Linux virtual machine on Microsoft Azure, installing uv (Python package manager), Anaconda, and configuring Jupyter Notebook for remote multi-user access. By the end of this tutorial, you'll have a fully functional development environment that multiple users can access via IP address and port number with password authentication.
Prerequisites
- Active Azure account (Students can create a free Azure account using their school/university email. This often includes credits and free-tier VM access for learning and research. Without this you'll need a paid subscription)
- Basic knowledge of Linux command line
- Understanding of SSH connections (both password and public key authentication methods)
Step 1: Creating a Linux Virtual Machine on Azure
1.1 Access Azure Portal
- Navigate to portal.azure.com
- Sign in with your Azure credentials
1.2 Create Virtual Machine
- Click "Create a resource" in the Azure portal
- Search for "Virtual Machine" and select it
- Click "Create"
1.3 Configure Basic Settings
- Subscription: Select your Azure subscription
- Resource Group: Create new resource group or select existing
-
Virtual Machine Name: Choose a descriptive name (e.g.,
linux-dev-vm
) - Region: Select appropriate region close to you for better performance
- Image: Choose Ubuntu Server 22.04 LTS (recommended)
- Size: Select appropriate VM size based on your needs
-
Authentication Type:
- Password: Easier for beginners but less secure
- SSH Public Key: More secure, recommended for long-term or multi-user environments
1.4 Configure Networking
- Ensure SSH (port 22) is allowed
- Add custom inbound port rules:
- Port 8888: For Jupyter Notebook access
- Port 8889-8899: For additional notebook instances (optional)
1.5 Review and Create
- Review all configurations
- Click "Create"
- Wait for validation and deployment to complete (typically 2-5 minutes)
Step 2: Connecting to Your Virtual Machine
2.1 Obtain Connection Details
- Go to your VM resource in Azure portal
- Note the Public IP address
- Download the SSH private key (if using SSH key authentication)
2.2 Connect via SSH
# Replace with your actual username and IP address
ssh azureuser@VM_PUBLIC_IP
# If using SSH key file
ssh -i /path/to/your/private/key azureuser@VM_PUBLIC_IP
Choose authentication method based on your security needs. Keys are harder to hack, while passwords are simpler to use.
Step 3: Installing uv (Python Package Manager)
uv
is a modern Python package manager designed for speed and reproducibility.
3.1 Update System Packages
sudo apt update
sudo apt upgrade -y
3.2 Install uv
# Install uv using the official installer
curl -LsSf https://astral.sh/uv/install.sh | sh
# Reload your shell configuration
source ~/.bashrc
# Verify installation
uv --version
3.3 Configure uv (Optional)
# Create a project directory
mkdir ~/python-projects
cd ~/python-projects
# Initialize a new uv project
uv init my-project
cd my-project
Use uv
to manage Python dependencies in projects cleanly and efficiently.
Step 4: Installing Anaconda
Anaconda is a widely used Python distribution that simplifies package management and includes popular data science libraries.
4.1 Download Anaconda
# Navigate to home directory
cd ~
# Download Anaconda installer using wget
wget https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
# Make the installer executable
chmod +x Anaconda3-2024.02-1-Linux-x86_64.sh
4.2 Install Anaconda
# Run the installer
bash Anaconda3-2024.02-1-Linux-x86_64.sh
# Follow the prompts:
# - Press ENTER to review license
# - Type 'yes' to accept license terms
# - Press ENTER to confirm installation location
# - Type 'yes' to initialize Anaconda3
4.3 Activate Anaconda
# Reload bash profile
source ~/.bashrc
# Verify installation
conda --version
python --version
Anaconda makes it easier to manage environments for different projects (data science, AI, scientific computing).
Step 5: Verifying Anaconda Installation
5.1 Test Anaconda Components
# Verify Anaconda installation
conda --version
python --version
# Check if conda environments are working
conda info
# List installed packages to confirm Anaconda distribution
conda list | head -20
5.2 Test Jupyter Notebook Installation
# Verify Jupyter is installed with Anaconda
jupyter --version
# Check available Jupyter commands
jupyter --help
5.3 Quick Functionality Test
# Test Python from Anaconda
python -c "import sys; print(f'Python version: {sys.version}')"
python -c "import pandas; print(f'Pandas version: {pandas.__version__}')"
python -c "import numpy; print(f'NumPy version: {numpy.__version__}')"
python -c "import jupyter; print('Jupyter is working!')"
5.4 Verify Anaconda Path
# Check which Python is being used (should point to Anaconda)
which python
which conda
which jupyter
# Expected output should show paths like:
# /home/azureuser/anaconda3/bin/python
# /home/azureuser/anaconda3/bin/conda
# /home/azureuser/anaconda3/bin/jupyter
Expected Output Example:
conda 23.7.4
Python 3.11.5
pandas 2.0.3
NumPy 1.24.3
Jupyter is working!
If all these commands work without errors, your Anaconda installation is successful and ready for Jupyter Notebook configuration.
Step 6: Configuring Jupyter Notebook for Remote Access
Note: Jupyter Notebook here is just an example of how to use Anaconda in a multi-user environment. It allows different users to log in, run code, and collaborate, but Anaconda can also be used in other workflows like machine learning model training, data pipelines, and research simulations.
Jupyter Notebook provides a web interface for writing Python code. It's often used in education, research, and collaborative projects.
6.1 Generate Jupyter Configuration
# Generate Jupyter config file
jupyter notebook --generate-config
6.2 Create Password for Notebook Access
# Start Python and create password hash
python -c "from jupyter_server.auth import passwd; print(passwd())"
Note: Save the generated hash. You'll need it for configuration.
6.3 Configure Jupyter Notebook
# Edit Jupyter configuration
nano ~/.jupyter/jupyter_notebook_config.py
Add the following configuration:
# Configuration for remote access
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'YOUR_GENERATED_PASSWORD_HASH'
c.NotebookApp.allow_remote_access = True
c.NotebookApp.notebook_dir = '/home/azureuser/notebooks'
6.4 Create Notebooks Directory
# Create directory for notebooks
mkdir ~/notebooks
cd ~/notebooks
This setup ensures multiple users can log in via browser using a shared server.
Step 7: Configuring Firewall and Network Security
Protect your VM from unauthorized access.
7.1 Configure Ubuntu Firewall
# Enable UFW firewall
sudo ufw enable
# Allow SSH
sudo ufw allow ssh
# Allow Jupyter Notebook port
sudo ufw allow 8888
# Check firewall status
sudo ufw status
7.2 Configure Azure Network Security Group
- Go to your VM in Azure portal
- Navigate to Networking
- Ensure inbound rule for port 8888 exists
- Source: Any (or restrict to specific IP ranges for security)
- Destination: Any
- Action: Allow
Always keep ports restricted to necessary services only.
Step 8: Starting Jupyter Notebook
8.1 Start Jupyter Notebook
# Start Jupyter Notebook
jupyter notebook
# Or run in background
nohup jupyter notebook > jupyter.log 2>&1 &
8.2 Access Jupyter Notebook Remotely
- Open web browser
- Navigate to:
http://VM_PUBLIC_IP:8888
- Enter the password you created earlier
- You should now see the Jupyter Notebook interface
Step 9: Multi-User Access Configuration
If multiple users need separate workspaces:
9.1 Create Additional User Accounts (Optional)
# Create new user
sudo adduser newusername
# Add user to sudo group (if needed)
sudo usermod -aG sudo newusername
9.2 Set Up Multiple Jupyter Instances
# For different users on different ports
# User 1: Port 8888
# User 2: Port 8889
# User 3: Port 8890
# Example for second instance
jupyter notebook --port=8889 --ip=0.0.0.0 --no-browser
This allows collaboration while keeping users' files isolated.
Step 10: Security Best Practices
10.1 Enable HTTPS (Recommended)
# Generate SSL certificate
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem
10.2 Update Jupyter Configuration for HTTPS
c.NotebookApp.certfile = '/home/azureuser/mycert.pem'
c.NotebookApp.keyfile = '/home/azureuser/mykey.key'
10.3 Restrict Access by IP
# In jupyter_notebook_config.py
c.NotebookApp.ip = 'YOUR_SPECIFIC_IP_RANGE'
Security is critical since the VM is exposed on the internet.
Step 11: Maintenance and Monitoring
11.1 Keep System Updated
# Regular updates
sudo apt update && sudo apt upgrade -y
# Update conda
conda update --all
11.2 Monitor Resource Usage
# Check system resources
htop
# Check disk space
df -h
# Check memory usage
free -h
This prevents downtime and ensures smooth performance.
Troubleshooting Common Issues
Issue 1: Cannot Access Jupyter from Browser
- Check firewall: Ensure port 8888 is open
- Verify Azure NSG: Confirm inbound rule exists
- Check Jupyter logs: Review error messages
Issue 2: Permission Denied Errors
# Fix ownership of notebooks directory
sudo chown -R azureuser:azureuser ~/notebooks
Issue 3: Jupyter Notebook Won't Start
# Kill existing processes
pkill -f jupyter
# Restart with verbose logging
jupyter notebook --debug
Conclusion
You now have a fully functional Linux virtual machine on Azure with uv and Anaconda installed, configured for remote multi-user access via Jupyter Notebook. Users can access notebooks by navigating to http://VM_IP:8888
and authenticating with the configured password. While Jupyter was used here to demonstrate how Anaconda can support collaboration, the same setup can be adapted for machine learning, research computing, or teaching environments.
Top comments (0)