Introduction to multi-version management tools under Linux-alternatives

Source: Internet
Author: User

Alternatives is an important version management tool under UNIX, which was first seen in the Debain system, because its powerful usability makes it a large number of porting in various UNIX environments, And we probably most often use the Java OPENJDK Toolkit in the usual version of the conversion, and in the alternatives implementation of multi-version is the replacement system using the command link to implement the version of the conversion, its default multi-version link file is placed in the/etc/ Under the alternatives path, he can be used to manage versions of different software in the system in real production.

Here is an example of using the OPENJDK Toolkit, the Java Virtual machine under the OPENJDK Toolkit will be used in a large number of simulated Java environments, where we can see the system files of the RPM package Java installed with Yum

[[email protected] ~]# ll $ (which Java) lrwxrwxrwx. 1 root root 22 December 12:02/usr/bin/java-/etc/alternatives/java

It can be seen that the Java path in the system is actually a link file, it is pointing to the system in the/etc/alternatives under the Java, now go to the/etc/alternatives path to see what the next thing

[Email protected] ~]# Cd/etc/alternatives[[email protected] alternatives]# ll javalrwxrwxrwx. 1 root root 46 December 12:02 Java-/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

Here you can see that the Java instructions in the system are pointed to the openjdk1.6 version, and we need to switch Java version is also very simple:

[Email protected] alternatives]# Alternatives--config java A total of 2 programs provide "java."           Select Command-----------------------------------------------* 1/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java + 2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java Press Enter to save the current selection [+], or type the selection number: 2

, here is a description of the alternatives parameter options

--install Link Name path priority: Used to add a file under an alternate system directive, which is to install a file in the replacement system into a link file--remove name path: Remove the relationship with alternatives management--set name Path manually adds a linked dependency, which is not a parameter in the original Debian--config name version modified for alternatives controlled software to manually specify the software version--auto Name is the automatic option version of the alternatives controlled software, which is generally the latest version of the option system--display name is used to show how the alternatives control software is replaced, replaced with those configuration files, versions, etc.

In short, the alternatives version controller is an important version management tool that allows you to quickly manage the software versions in your system to reduce the time it takes to modify a large number of environment variables.

This article from "Technical essay" blog, declined reprint!

Introduction to multi-version management tools under Linux-alternatives

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.