Use Xshell to remotely connect to the jupyter notebook on the server

jupyter notebook is a very versatile interactive notebook. He can support more than 40 languages. And it is very helpful for solving the problem that the graphical interface cannot be displayed on the server. This article briefly introduces how to use x-shell to connect to jupyter on the server under windows.

1. Installation of jupyter

You can install jupyter notebook directly with Anaconda, which will not be repeated here.


2. Remote connection of jupyter of xshell

(1) Generate config file

Open the server and log in. After entering the required environment, enter:

jupyter notebook --generate-config

(2) Generate a password

Open python/ipython and create a ciphertext password:

from notebook.auth import passwd
passwd()
#Enter the password twice
#Enter password:
#Verify password:
# then appears
#'sha1:xxxxxxxxxxxxxxxxx'
Copy the quoted 'sha1:xxxxxxxx'

(3) Modify the config file

First enter the config file

vim ~/.jupyter/jupyter_notebook_config.py

Then make the following modifications (paste directly):

c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha:xxxxxx'# just copied
c.NotebookApp.open_browser = False
c.NotebookApp.port =7548 #Just specify one

(4) Modify the channel of x-shell

File - Open - Select Server - Right Click Properties - Tunnel:


If no configuration is performed, the point where the red arrow points is empty. Click "Add" where the blue arrow points to add ports.

The target port here needs to be filled with the port configured in config. The listening port can be filled in casually, of course, it can also be filled in the same. After the configuration is complete, it can be run.

(5) Run jupyter notebook

Go to a directory on the server (as the root directory) and enter jupyter notebook, as shown below:


Enter 127.0.0.1:1234 in the local browser, 1234 is the listening port set in the previous step , and modify the port number according to your own settings. After entering the password, you can use it normally~


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325605502&siteId=291194637