Ubuntu Jupyter Notebook configuration

This is the 11th day of my participation in the August More Text Challenge. For details, see:August is more challenging

Install jupyter:

Prerequisite: Install PIP

 pip install jupyter
Copy the code

Jupyter Notebook configuration:

  1. Generate a configuration file:

     jupyter notebook --generate-config
    Copy the code
  2. Create password: ipython

    In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: ****** Verify password: ****** Out [2]: 'sha1:... 'Copy the code

    Save the key after out;

  3. Modify the configuration file:

     vim ~/.jupyter/jupyter_notebook_config.py
    Copy the code

    Make the following changes in the file or add them directly to the end of the file:

    Password = u'sha:.. password = u'sha:.. password = u'sha:.. Open_browser = False # Disable automatic opening of the browser. C. port =8888 # Specify a portCopy the code
  4. Change the default file storage path:

    In the above jupyter configuration file

    ## The default URL to redirect from '/' ## The default URL to redirect from '/' #Copy the code

Start the jupyter notebook:

Terminal input:

 jupyter notebook
Copy the code

Background run:

 nohup jupyter notebook >~/jupyter.log 2>&1 &
Copy the code

“Explanation:”

  1. nohupNo hang up. After the command is executed, the service does not stop even if the terminal exits.
  2. And specify the log file path as/jupyter/jupyter.log.

Note: If the access is not possible, you need to add the port in the security rules of ali Cloud server.

Adding a Java kernel

Install Java:

Configure the Java environment in Ubuntu:

Download the Java Development Kit JDK

The JDK download address is: http://www.oracle.com/technetwork/java/javase/downloads/index.html. Click the JDK Download link in the red box.

On the download page, select the corresponding JDK version based on your operating system. This section uses Ubuntu 20.04 LTS (64bits) as an example to download the JDK -14.0.1_linux-x64_bin.tar.gz.

Installation steps

Move the DOWNLOADED JDK to your desktop and install it as follows:

Sudo cp /home/ym/desktop/jdk-14.0.1_linux-x64_bin.tar. gz /opt # Copy the JDK to the specified JDK installation directory CD /opt # Sudo tar -xzvf JDK -14.0.1_linux-x64_bin.tar.gz sudo tar -xzvf JDK -14.0.1_linux-x64_bin.tar.gz sudo tar -xzvf JDK -14.0.1_linux-x64_bin.tar.gz Sudo rm jdk-14.0.1_linux-x64_bin.tar.gz sudo rm jdk-14.0.1_linux-x64_bin.tar.gzCopy the code

At this point, the JDK installation is half complete. The next step is to configure the JDK.

JAVA_HOME=/opt/jdk-14.0.1 # CLASSPATH=. PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME CLASSPATH PATH # Make the modified configuration effective source /etc/profilecCopy the code

To view the environment variables created or updated, run the following command:

Echo $JAVA_HOME echo $CLASSPATH echo $PATHCopy the code

Test whether the JDK is installed successfully

Open a terminal;

Enter the Java -version and javac -version commands. If the following information about Java and the Java compiler version is displayed, the JDK is successfully installed and the system environment variables are successfully configured.

The above is provided by the literature:

 https://www.jb51.net/article/192807.htm
Copy the code

Note: I am too lazy to type, the author has written very detailed

Java Kernel installation

  1. Download the Java kernel package
Wget HTTP: / / https://github.com/SpencerPark/IJava/releases/download/v1.2.0/ijava-1.2.0.zipCopy the code
  1. Decompress the downloaded package
Unzip ijava - 1.2.0. ZipCopy the code

You get a install.py file and a Java folder

  1. Installing the Java Kernel

In the folder decompressed in step 2, run the following command to install:

 python install.py --sys-prefix
Copy the code

Make sure the Python version is 3, or python3 is fine

  1. Testing the Java kernel
 jupyter console --kernel=java
Copy the code

Testing:

 In [1]: String helloWorld = "Hello world!" In [2]: helloWorld Out[2]: "Hello world!"
Copy the code

References:

Blog.csdn.net/Bolview/art…

The end:

If you see here or just to help you, I hope you can point to follow or recommend, thank you;

If there are any errors, please point them out in the comments and the author sees them will be corrected.