Detailed explanation of how to use Linux alternatives command to replace the version of selected software

黄舟
Release: 2017-05-28 11:29:58
Original
2516 people have browsed it

The following editor will bring you an article on how to use the alternatives command of Linux to replace the selected software version. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let's follow the editor and take a look.

When I installed search engine Elasticsearch last week, I was asked to install a newer java version. I chose java 1.8.0 , after successfully installing java, use java -version and find that the version used is still 1.6.0.

query some information and find that you can use the Linux alternatives command to replace the selected software version.

Instructions:

alternatives --install < priority>


Among them,


install means installation

link is a symbolic link

name is the identifier

path is the path to the executable file

priority means priority

1: Let’s first look at the current java version

2: Use Linux alternatives command to install java 1.8.0

1. First use alternatives to view the current situation What java versions are there in the system?

alternatives --config java

2. Use the alternatives command to install java 1.8.0

alternatives --install /usr/bin/java java /usr/local/java/jre1.8.0_131/bin/java 4

Explanation:

/usr/bin/java is the path of the java command, use which java to view, the corresponding parameter

java corresponding parameter

/usr/local/java/jre1.8.0_131/bin/java corresponds to , indicating the path of the java command of java1.8.0

The number 4 corresponds to the parameter , because there is already 3 programs provide java, so you need to write 4

3. Use alternatives --config java to check whether the installation of java 1.8.0 is successful

The java underlined in red is the one I just installed, indicating that the installation was successful

3: Select the java version

alternatives --config The result seen by java

is the same as the result of 2(3). Pay attention to the last sentence in English: Enter to keep the

current selection[+], or type selection number, which translates to press Enter key to save the current selection [+], or to step through the selected number. I type the number 4 to indicate that I choose to use java 1.8.0

Four: Use java -version to view the selected version

The above is the detailed content of Detailed explanation of how to use Linux alternatives command to replace the version of selected software. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template