You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过SSH在远程服务器启动Jupyter Notebook并在本地浏览器运行?

Access Jupyter Notebook on Remote Server via Local Browser (Over SSH)

Absolutely, this is a super common workflow and totally solves the hassle of coding in a terminal-only environment. Here's a step-by-step guide to get you set up smoothly:

Step 1: Install Jupyter on the Remote Server

First, SSH into your remote server like you normally do. If Jupyter isn’t already installed, run one of these commands based on your package manager:

  • For pip users: pip install jupyter (add --user if you don’t have admin rights)
  • For conda users: conda install -c conda-forge jupyter

Step 2: Start Jupyter Notebook on the Server

Launch Jupyter without opening a browser on the server, and specify a port (we’ll use 8889 here, but you can pick any unused port):

jupyter notebook --no-browser --port=8889

If you haven’t set a password for Jupyter yet, it’ll output a token in the terminal—save that, you’ll need it to log in locally. For a more convenient experience, set a password ahead of time with:

jupyter notebook password

Step 3: Set Up SSH Port Forwarding from Local to Server

Open a new terminal window on your local machine (don’t close the one running Jupyter!) and run this command to create an encrypted tunnel:

ssh -L 8889:localhost:8889 your_username@remote_server_address

Quick breakdown:

  • -L tells SSH to set up a local port forward
  • 8889:localhost:8889 means "forward local port 8889 to the server’s localhost port 8889"
  • Swap your_username and remote_server_address with your actual server credentials

Step 4: Access Jupyter from Your Local Browser

Open your favorite browser and navigate to:
http://localhost:8889
Enter your Jupyter password if you set one, or paste the token from the server terminal into the login page (you can also append it to the URL like http://localhost:8889?token=your_token_here).

Pro Tips & Notes

  • Port Conflicts: If 8889 is in use locally, just pick a different port (like 8890) — update both the server’s --port flag and the local forward command (e.g., -L 8890:localhost:8889).
  • Security: Since we’re using SSH tunneling, you don’t need to open the Jupyter port to the public on your server’s firewall—all traffic is encrypted through the SSH connection, which is way safer.
  • Persistent Sessions: To keep Jupyter running even after you close your SSH terminal, use tools like screen or tmux on the server. For example:
    screen -S jupyter_session
    # Start Jupyter as usual here
    # To detach: press Ctrl+A then D
    # To reattach later: screen -r jupyter_session
    

内容的提问来源于stack exchange,提问作者Deepak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:20:05