in 3 minutes:

Using Jupyter Notebook on a Remote Linux Server :

caner kilinc
Nov 3 · 3 min read

Question: How to use Jupyter Notebook on a remote Linux server?
Answer: Just need to do port forwarding while establishing a SSH connection!

If you are a data scientist using Jupyter Notebook to carry out data-driven studies on your local computer: soon or later, in order to come over limitations of your local computation environment, you are going to migrate your data-driven studies to a remote Linux Server.

However, running Jupyter notebook on a remote server might be a bit confusing, where you only have a black window i.e. terminal. The port-forwarding is a quite handy method, as illustrated by the figure above, enables to exploit our local browser e.g. Chrome running on our local computer for the Jupyter Notebooks which are running on the remote Linux Server.

In this article, I describe how to perform the port forwarding to run Jupyter Notebooks seamlessly on a remote Linux server in tandem with your favorite browser on your local computer.

Step 1- Establishing an ssh connection to the remote Linux server

In order to connect a remote server one of the best, secure (encrypted) and the easiest access method is SSH (Secure Socket Shell). Here the assumption is that you are already able to establish a ssh connection to a remote Linux machine. If you have not yet generated ssh keys and configured the ssh, it is quite straight forward to set up a ssh connection since it is pre-installed in the Linux environment, so please go through this article.

For instance, the user name data_scientist and the remote server’s IP address is 136.225.131.31, these two will be used as combined as given below:

In order to enable the port forwarding, we can extend the ssh command line as follows:

ssh -L 8000:localhost:8000 ubuntu@136.225.131.31
  • Here — L means “Local port”
  • By declaring 8000:localhost:8000 we specify how the ssh connection is established between the host/local machine and remote machine/server and which ports will be linked via the ssh connection:

<local-port>:<connect-to-host>:<connect-to-port>

When a ssh connection is established from the <local-port> port, it sends the data through the SSH connection and then connects to <connect-to-host>:<connect-to-port> on the other side of the network.

Step 2- Run the Jupyter Notebook in the no-browser mode

Once you have connected to the remote Linux server via ssh, now you can run the Jupyter Notebook in the no-browser mode as below. Here note that the specified port number is that the same port number that you are forwarding.

jupyter notebook --no-browser --port=8000 --ip=0.0.0.0

Please note that the command above starts the Jupyter Notebook and returns authentication token for the Jupyter Notebook access. The token will be used at the end of the third step.

Step 3- Connect to the Jupyter Notebook

Now you are ready to start your browser e.g. Chrome, and in the address bar type the following URL. You can now copy and paste the given token at the second step above — it is in the terminal window

http://localhost:8000/

I hope this quick description was use-full for you!

in 5 mints: TensorFlow 2.0 in Practice

caner kilinc

Written by

Caner has a ~ 10-years of industrial experience. Currently Caner serves as a Senior Data Scientist as part of AI projects

in 5 mints: TensorFlow 2.0 in Practice

“Only when you explicitly understood something, you can briefly describe, simplify and even can teach it to your grandma “

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade