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.
Instructions:
install means installation
link is a symbolic link
name is the identifier
path is the path to the executable file
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 java2. 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 4Explanation:
/usr/bin/java is the path of the java command, use which java to view, the corresponding parameter java corresponding parameter3. 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 successful3: 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 theFour: Use java -version to view the selected version
The above is the detailed content of How to use the alternatives command in Linux to replace the selected software version method. For more information, please follow other related articles on the PHP Chinese website!