red hat 下alternatives命令用法
来源:互联网 发布:r 读取股票数据 编辑:程序博客网 时间:2024/05/16 10:49
alternatives是Linux下的一个功能强大的命令。只能在root权限下执行。如系统中有几个命令功能十分类似,却又不能随意删除,那么可以用 alternatives 来指定一个全局的设置。
alternatives常用于同一个系统中安装同一软件的多个版本。比如为了开发需要,我需要安装JDK1.4.2,同时还需要JDK1.6.10,我怎么样才能忽略安装路径,按照我自己的意思,使用我想要的java版本呢?
下面为您一一道来。
alternatives的命令行执行如下:
[root@localhost tools]# alternatives
alternatives version 1.3.36 - Copyright (C) 2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.
usage: alternatives --install <link> <name> <path> <priority>
[--initscript <service>]
[--slave <link> <name> <path>]*
alternatives --remove <name> <path>
alternatives --auto <name>
alternatives --config <name>
alternatives --display <name>
alternatives --set <name> <path>
common options: --verbose --test --help --usage --version
--altdir <directory> --admindir <directory>
说明:
alternatives --install <link> <name> <path> <priority>
其中,
install表示安装
link是符号链接
name则是标识符
path是执行文件的路径
priority则表示优先级
以java的安装为例,我的Fedora 8下自带了两种java版本,分别如下:
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
我在目录/tools/jdk安装了java version "1.4.2_19"
[root@localhost test]# alternatives --install /usr/bin/java java /tools/jdk/bin/java 3
[root@localhost test]# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
3 /tools/jdk/bin/java
Enter to keep the current selection[+], or type selection number: 3
我还在目录/tools/jdk6下安装了java version "1.6.0_12"
[root@localhost test]# alternatives --install /usr/bin/java java /tools/jdk6/bin/java 4
[root@localhost test]# alternatives --config java
There are 4 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
+ 3 /tools/jdk/bin/java
4 /tools/jdk6/bin/java
Enter to keep the current selection[+], or type selection number: 4
alternatives常用于同一个系统中安装同一软件的多个版本。比如为了开发需要,我需要安装JDK1.4.2,同时还需要JDK1.6.10,我怎么样才能忽略安装路径,按照我自己的意思,使用我想要的java版本呢?
下面为您一一道来。
alternatives的命令行执行如下:
[root@localhost tools]# alternatives
alternatives version 1.3.36 - Copyright (C) 2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.
usage: alternatives --install <link> <name> <path> <priority>
[--initscript <service>]
[--slave <link> <name> <path>]*
alternatives --remove <name> <path>
alternatives --auto <name>
alternatives --config <name>
alternatives --display <name>
alternatives --set <name> <path>
common options: --verbose --test --help --usage --version
--altdir <directory> --admindir <directory>
说明:
alternatives --install <link> <name> <path> <priority>
其中,
install表示安装
link是符号链接
name则是标识符
path是执行文件的路径
priority则表示优先级
以java的安装为例,我的Fedora 8下自带了两种java版本,分别如下:
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
我在目录/tools/jdk安装了java version "1.4.2_19"
[root@localhost test]# alternatives --install /usr/bin/java java /tools/jdk/bin/java 3
[root@localhost test]# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
3 /tools/jdk/bin/java
Enter to keep the current selection[+], or type selection number: 3
我还在目录/tools/jdk6下安装了java version "1.6.0_12"
[root@localhost test]# alternatives --install /usr/bin/java java /tools/jdk6/bin/java 4
[root@localhost test]# alternatives --config java
There are 4 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
+ 3 /tools/jdk/bin/java
4 /tools/jdk6/bin/java
Enter to keep the current selection[+], or type selection number: 4
用alternatives --config java就可以选择你想要的Java版本。
出处
- red hat 下alternatives命令用法
- Red Hat下执行sh命令文件
- alternatives命令用法
- alternatives命令用法
- alternatives命令用法
- Red hat Linux下ifconfig命令不能使用
- Linux发行版Red-Hat下相关命令
- Red Hat 没有ifconfig命令
- red hat下安装oracle
- Red Hat下安装ethereal
- Red Hat下mysql 入门
- red hat 下使用openssh
- Red Hat下安装oracle
- red hat 下配置上网
- Debian下update-alternatives命令
- Red Hat linux命令集(1)
- Red Hat linux命令集(2)
- red hat as4 的一些命令
- Linux 之 shell 比较运算符
- 两个小点
- 序列化Serializable的理解
- Linux进程的实际用户ID和有效用户ID
- Mybatis
- red hat 下alternatives命令用法
- acm~北大oj分类
- Java io之音乐复制
- c++ delete的实质
- POJ1149——PIGS(网络流)
- 黑马程序员_java 网络编程-2
- 黑马程序员:基础----静态、单例设计模式
- 黑马程序员java学习第六天,static静态的使用及单例设计模式
- MFC中,如何获得对话框控件相对于父窗口(对话框窗口)的位置 及Invalidate(TRUE)的闪屏问题