DEV Community

Start a Jupyter notebook server

  • A Jupyter notebook server must be running in order to create and run Jupyter notebooks.
  • This post don't explain how to install the Jupyter notebook server or packages for machine learning in the AWS AMI.
  • In this post, you will start a Jupyter notebook server.

Step 1

In your SSH shell, enter the following command to start the Jupyter notebook server in the background:

nohup jupyter notebook &
Enter fullscreen mode Exit fullscreen mode
  • The nohup command, stands for no hangup and allows the Jupyter notebook server to continue running even if your SSH connection is terminated.
  • After a couple seconds a message about writing output for the process to the nohup.out file will be displayed:

Image description

Press enter to return to the shell prompt.

This will allow you to continue to enter commands at the shell prompt.

Step 2

Press enter to move to a clean command prompt, and tail the notebook's log file to watch for when the notebook is ready to connect to:

tail -f nohup.out
Enter fullscreen mode Exit fullscreen mode

Step 3

Press ctrl+c to stop tailing the log file.

Step 4

Enter the following to get an authenticated URL for accessing the Jupyter notebook server:

jupyter notebook list
Enter fullscreen mode Exit fullscreen mode
  • By default, Jupyter notebooks prevent access to anonymous users. - After all, you can run arbitrary code through the notebook interface.
  • The token URL parameter is one way to authenticate yourself when accessing the notebook server.

Image description

  • The /home/ubuntu at the end of the command indicates the working directory of the server.

  • The Jupyter notebook server is now up and running.

Image description

  • However, you can't connect to the server If there is a security group containing the virtual machine doesn't allow access to port 8888.
  • To maintain a secure environment, only port 22 (SSH) is open. You will learn how to access the notebook server in the next post.


Top comments (0)