简体   繁体   中英

Connecting Jupyter notebook to Remote server

I have a linux server. On that I have installed Miniconda3 and other python packages along with Jupyter.

Now I want to run the notebook on the server and open in my browser.

For that, after installation of all packages, I do:

user@remoteip:$ jupyter notebook --no-browser --port=8890

Now I am copying the server IP address along with port to open it in my local browser.

http://remoteip:8890

However it doesn't open up anything.

I then followed all suggestions given in this SO answer by adding the required statements in the configuration file on the remote server anaconda and even local anaconda jupyter config file.

But it doesn't help at all.

After that I had to port forwarding as below in my local terminal:

user@localhost: ssh -N -f -L localhost:8890:localhost:8890 user@remoteip

And after that when I open

localhost:8890 

now it opens up the notebook requiring the token to be entered and then it works.

My question is that do we need to do port forwarding everytime for us to open a notebook on remote server? One of my colleague said he didn't do any port forwarding and after first step itself, he was able to open the notebook with by typing

http://remoteip:8890

So I am not sure we need to do port forwarding for us to open the server jupyter notebook to open in browser or we can directly open the notebook with remoteip address?

Edit:

As per Alex's suggestion below, ran the following command after logging into dev server.

(ds_env) user@devvm1049:~$ jupyter notebook --no-mathjax --no-browser --ip 0.0.0.0 --port 8890
[I 23:49:56.032 NotebookApp] Serving notebooks from local directory: /home/user
[I 23:49:56.032 NotebookApp] The Jupyter Notebook is running at:
[I 23:49:56.032 NotebookApp] http://devvm.cdw.com:8890/
[I 23:49:56.032 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

Copied the above link to both chrome and Safari but it didn't open anything.

I have already done the above suggestions in this post. The only thing that has worked until now is doing Port tunneling but that is 3 steps everytime one has to open the jupyter on remote server.

Is this can be some port blocking issue? I tried pinging the remote server on laptop and it didn't give me any ping.

If you specify the --ip option when starting the server you can allow remote connection without port forwarding.

jupyter notebook --no-mathjax --no-browser --ip 0.0.0.0 --port 8890
# The --no-mathjax improves loading over slow connections

This is not recommended, though. See running a public jupyter notebook server . If you do this, I strongly recommend that you set a password, as described in that link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM