Linux alternatives

From John Freier
Jump to: navigation, search

Alternatives is a new fedora way of linking system libraries.

example, if you have java 1.7 and java 1.8 installed, Alternatives will allow you to switch between them pretty easy.

Config

This parameter will allow you to set the version or path of the file/app

 # alternatives --config java

output:

 There are 3 programs which provide 'java'.
 
   Selection    Command
 -----------------------------------------------
 *  1           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79-2.5.5.0.fc20.x86_64/jre/bin/java
    2           /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
  + 3           /opt/jdk1.8.0_60/bin/java
 
 Enter to keep the current selection[+], or type selection number: 


Install

To install a new location to the alternatives directory, use install.

 # alternatives --install /usr/bin/java java /opt/jdk1.8.0_60/bin/java 2

The above command will add the /opt/jdk1.8.0_60/bin/java to the list of options when configuring.