jupyter notebook Remote Access Configuration
The first is to install Anaconda.
By default, after installation Anaconda open jupyter notebook, access to local localhost:8888
can be.
But if you want to access another machine, such as notebook on a remote server, the default is not supported 172.104.105.119:8888 such access, the need for additional configuration.
Set jupyter notebook remotely accessible official guide here, do the following on the remote server:
1. Create a profile notebook
By default, the configuration file ~/.jupyter/jupyter_notebook_config.py
does not exist, you need to create your own. Use the following command to generate the configuration file:
jupyter notebook --generate-config
If the root user executes the above command, a problem occurs:
Running as root it not recommended. Use --allow-root to bypass.
Obviously message, plus the time required to perform the root user --allow-root
options.
jupyter notebook --generate-config --allow-root
After successful execution, the following message appears:
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
2. Generate password
- Automatic generated
Starting jupyter notebook version 5.0, provides a command to set the password: jupyter notebook password
generated password is stored in jupyter_notebook_config.json
.
$ jupyter notebook password
Enter password: ****
Verify password: ****
[NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json
- Manual generation
In addition to using the commands provided, you can also manually install, I use the manual installation, because jupyter notebook password
out of a pile content, impatient look. Open ipython perform the following contents:
ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed
In this string it is to jupyter_notebook_config.py
add a password.
c.NotebookApp.password = u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
3. Modify the configuration file
In jupyter_notebook_config.py
Locate the following line, uncomment and modify.
c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha:ce...刚才复制的那个密文'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888 #可自行指定一个端口, 访问时使用该端口
After completion of the above settings you can start jupyter notebook on the server, jupyter notebook
, root user jupyter notebook --allow-root
. Open IP: the specified port, enter the password to access.
Note that jupyter notebook can not be started in a hidden directory (to. The beginning of the directory), or can not properly access the file.