How to stay connected to the GPU server even after your laptop goes to sleep.


  • 0
  • 0

Running Jupyter Notebook Server on a Remote Server with tmux

Here’s a step-by-step guide on how to run a Jupyter Notebook server on a remote server using Tmux:

Prerequisites:

  • SSH access: You need SSH access to your remote server.
  • tmux installed: Make sure tmux is installed on the remote server. You can usually install it using your server’s package manager (e.g., sudo apt install tmux for Ubuntu/Debian).

Steps:

sudo apt install tmux
  1. Connect to the server: Use your preferred SSH client to connect to your remote server.
  2. Start a new tmux session: Run the following command to create a new tmux session named jupyter_session:
tmux new -s jupyter_session
  1. Launch Jupyter notebook: Inside the tmux session, run the following command to start the Jupyter notebook server without opening a browser window:
jupyter notebook --no-browser

jupyter lab --no-browser --ip xx.xx.xx.xx --port 8888
  1. Detach from the session: Press Ctrl+B followed by D to detach from the tmux session. This keeps the session and the Jupyter notebook server running even if you close your SSH connection.

Reconnecting to the session:

  • To reconnect to the running tmux session later, use the following command:
tmux attach -t jupyter_session

This will bring you back to the tmux session where your Jupyter notebook server is running.

Additional notes:

  • You can access the Jupyter notebook interface from your local machine by opening a web browser and navigating to the following URL:
http://<your_server_ip_address>:8888

Replace <your_server_ip_address> with the actual IP address of your remote server.

  • You might need to configure a password or token for accessing the Jupyter notebook server depending on your setup.

Using screen:

The steps for using screen are very similar to tmux. Instead of tmux new, use screen -S jupyter_session to create a new session and screen -r jupyter_session to reattach to it.

Security:

It’s important to remember that running a Jupyter notebook server on a public server exposes it to the internet. Make sure you have proper security measures in place, such as password protection and firewall rules, to restrict access only to authorized users.

Leave a Reply

Your email address will not be published. Required fields are marked *