How to start when you want to open from the web without a screen such as executing on the server. This time it runs on EC2 (amazon linux2)
#password setting(If you don't give a password, skip it)
$ ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[3]: 'sha1:...' #Make a copy of the encrypted string
#Login as root user
$ sudo su -
$ mkdir /root/.jupyter
$ cd /root/.jupyter
$ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key-out mycert.pem
#jupyter notebook initial settings
$ vi /root/.jupyter/jupyter_notebook_config.py
c = get_config()
c.NotebookApp.ip='0.0.0.0' #Can be accessed from any IP address
c.NotebookApp.password = u'sha1:...' #The copied character string(If you don't give a password, don't write)
c.NotebookApp.open_browser=False #Do not open browser automatically when jupyter starts
c.NotebookApp.port=8888 #Server port this time 8888
c.NotebookApp.certfile = u'/root/.jupyter/mycert.pem' #Server certificate
c.NotebookApp.keyfile = u'/root/.jupyter/mykey.key' #Private key
c.NotebookApp.notebook_dir = '/root/work' #Arbitrary folder
#open jupyter notebook
$ jupyter notebook --ip='0.0.0.0' --allow-root &
#After starting, "http~~~/~~token=I think that "xxxxxxxxxxx" will appear in the standard output, so copy the xxxxxxxxxx part
Launch IE and enter the IP and port in the url field to launch it.
http://xxx.xxx.xxx.xxx(EC2 Global IP):yyyy/
xxx.xxx.xxx.xxx: EC2 global IP
yyyy:jupyter_notebook_config.Port set to py(Is the default 8888?)
Recommended Posts