5

I want to run a jupyter notebook server in a machine to which I have ssh access and that I am already able to run notebooks locally.

How can I setup the jupyter notebook so it can be accessed remotely?

nico
  • 1,136
  • 1
  • 15
  • 33
  • 2
    I'm voting to close this question as off-topic because it is not about programming, but about Linux usage. I suggest to re-ask this question on https://unix.stackexchange.com . – peterh Oct 01 '18 at 01:17
  • 1
    @peterh, the question has been answered and the provided solution has enough information for anyone that has the same problem to get around it. Although I dont oppose closing the question, I think this is the right place for it. StackOverflow provides the right tags and this methodology could be applied to any OS (linux, macOS, WindowsOS - with a terminal emulator), where a programmer wants to program python code over a remote notebook. :) – nico Oct 06 '18 at 19:19
  • @peterh, to you and everyone that voted this question off-topic, I would recommend reading the guidelines for "on-topic": https://stackoverflow.com/help/on-topic Stack Overflow is clearly the place for questions like this: it is about "software tools commonly used by programmers" and it is about "a practical, answerable problem that is unique to software development" henceforth "you’re in the right place to ask your question!". Hope you are more attentive to the guidelines during future reviews. Cheers – nico Oct 06 '18 at 19:27
  • 1
    While I don't oppose this question (actually, I voted it up), I think both we see that it is not really about programming. It might be useful for programming, but the problem is not a programming problem. I think, asking this question on a more ontopic sister site had been a better idea, that is all. In my opinion, the best would be to reopen this question and then move to another site, it can't happen on the structural problems of the SE network. – peterh Oct 06 '18 at 19:29

1 Answers1

8

If you have ssh access to the machine that will run the server, follow the next steps:

1) In the machine that you will run the server, execute:

jupyter notebook # To start the server with the default port forwarding (8888)

2) Take note of the notebook address: that will be shown to you in the terminal: http://localhost:8888/?token=<A_LONG_STRING_OF_NUMBERS_AND_LETTERS>

3) In the client machine, with remote access to the server:

ssh -N -L localhost:8888:localhost:8888 <server_username>@<server_ip>

4) Now, open the browser to use the following address: http://localhost:8888/?token=<THE_TOKEN>


Additional info (found here): It is possible to change the port on which the server is setup

# In the server
jupyter notebook --no-browser --port=8889

# In the client
ssh -N -L localhost:8888:localhost:8889 <server_username>@<server_ip>
nico
  • 1,136
  • 1
  • 15
  • 33