Mac configuration log on using jupyter-notebook on a remote Linux

Machine: The server and anaconda ubuntu installed inside the notebook installed jupyter
IPython notebook Python data analysis tool is a browser-based, very easy to use, with a strong display of results interactively and rich text. jupyter is its upgraded version, it's also very easy to install, general Anaconda installation package will be built. Direct input jupyter notebook later installed you can use in your browser. But it can only be accessed locally by default, if you want to install it on the server, then the local remote access, you need the following configuration.

1. Log in to the remote server

ssh lynn@mylinux # ssh userName@hostName

2. Generate configuration files

$ jupyter notebook --generate-config

3. Generate password

Ipython open, creating a password in the ciphertext ipython environment:
the In [. 1]: Import from the passwd notebook.auth
the In [2]: the passwd ()
the Enter password:
the Verify password:
Out [2]: 'SHA1: ce23d945972f: 34769685a7ccd3d08c84a18c63968a41f1140274 '
the generated ciphertext' sha: ce ... 'copy down

4. Modify the default configuration file

$ vim ~/.jupyter/jupyter_notebook_config.py 

Modified as follows:
c.NotebookApp.ip = '*' # if there is a problem, is replaced by '0.0.0.0', I set '*' useless
c.NotebookApp.password = u'sha: ce ... just copied that ciphertext '
c.NotebookApp.open_browser = False
c.NotebookApp.port = just specify a port # 8888

5. Start jupyter notebook

$ jupyter notebook

6. Remote Access

At this point should be accessible directly from the local browser directly to http: // address_of_remote: 8888 jupyter you can see the login screen.

7. firewall issues

Previous done, access the browser to display the corresponding timeout ,, has not connect reasons: server firewall blocked, turn off the firewall on the server on the list.
There are many Linux firewall, generally refers to iptables.

  1. Linux firewall (Iptables) reboot the system to take effect
    open: chkconfig iptables on
    close: chkconfig iptables off
  2. Linux firewall (Iptables) with immediate effect, after the restart failed
    open: service iptables start
    shut down: service iptables stop
  3. Other linux firewall, please reference the documentation. For general service under Linux can be executed by the above command the opening and closing operation, while the firewall is usually run as a service, and therefore can be considered a generic way.

8. Establish secure ssh protocol channel

Prior browser access to first establish a secure ssh protocol channel, do a ip address mapping, so that you can directly access a.
If the login fails, there may be problems with the server firewall settings, then the easiest way is to build locally a ssh channel:
input ssh username @ address_of_remote -L127.0.0.1 in the local terminal: 1234: 127.0.0.1: 8888
will be at localhost: 1234 direct access to a remote jupyter.

9. Log and background processes

Above the start-up mode, it generates a log file in the current directory, I forgot to call the above names, along with short run jupyter notebook, log files will become increasingly large, if not important, you can not set the logging method is All output will be redirected to / dev / null 2> & 1 &
Furthermore, the above way to start is to start a foreground process, if the ssh connection is broken, jupyter notebook also fails, it needs to be jupyter notebook as a background process start in linux is nohup command.

#不启动ssl,不记录日志输出,作为后台进程启动jupyter notebook
nohup jupyter notebook >/dev/null 2>&1 &

Guess you like

Origin blog.csdn.net/Lynn_mg/article/details/86289110