Manage different versions of software in Linux

Source: Internet
Author: User

Update-alternative in Ubuntu/Debian is used to manage the same software of different versions in the system. For example, the GNU Java compiler and SUN Java compiler may be installed in the system. You can use update-alternatives to set which of them is currently used.

The principle is to create a link in/usr/bin to point to a file in/etc/alternatives, and some files are a link pointing to the current command. For example, the java command is as follows:

$ Which java

/Usr/bin/java

$ Ls-l/usr/bin/java

Lrwxrwxrwx/usr/bin/java->/etc/alternatives/java

$ Ls-l/etc/alternatives/java

Lrwxrwxrwx/etc/alternatives/java->/usr/lib/j2re1.5-sun/bin/java

$ Ls-l/usr/lib/j2re1.5-sun/bin/java

-Rwxr-xr-x/usr/lib/j2re1.5-sun/bin/java

Parameter -- display can be the current configuration of a software, such:

$/Usr/sbin/update-alternatives -- display java

Java-status is auto.

Link currently points to/usr/lib/j2re1.5-sun/bin/java

/Usr/lib/kaffe/bin/java-priority 300

Slave java.1.gz:/usr/share/man/man1/java.kaffe.1.gz

/Usr/lib/j2re1.5-sun/bin/java-priority 315

Slave java.1.gz:/usr/lib/j2re1.5-sun/man/man1/java.1.gz

Current 'best' version is/usr/lib/j2re1.5-sun/bin/java.

Status can be set to auto or manual. Once the user changes the system's default settings, it changes to manual. In the auto status, the system determines which configuration should be used based on the priority of several configurations.

Multiple links can be set for each set of configurations, which are called slave. In the above example, there are two sets of java configurations. One is/usr/lib/kafe/bin/java, and the other is/usr/lib/j2re1.5-sun/bin/java, each with a slave. In some examples, these slave settings are the manual of the java command. When the configuration is changed, the help displayed by the man command is changed accordingly.

The -- config parameter can be used to change the current configuration.

$ Sudo/usr/sbin/update-alternatives -- config java

There are 2 alternatives which provide 'java '.

Selection Alternative

-----------------------------------------------

1/usr/lib/kaffe/bin/java

* + 2/usr/lib/j2re1.5-sun/bin/java

Press enter to keep the default *, or type selection number: 1

Using '/usr/lib/kaffe/bin/Java' to provide 'java '.

The -- install parameter is used to set a new configuration.

Related Articles]

  • Linux downloads Ubuntu 7.10
  • Install the Virtual Machine VMware Server in Ubuntu 7.04
  • User settings for shared folders in Ubuntu Linux
  • Ubuntu Chinese open source channel (Special topics)

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.