[Ubuntu] update-alternatives(Symbolic Link 관리)



자바를 새로 설치시에  
/home/tech/jdk7 에 설치했다면 java 실행 파일은 /home/tech/jdk7/bin/java 이다.

기존에 리눅스의 기본 자바인 openJDK 를 새로 설치한 자바로 심볼릭링크 변경을 하려면 아래와 같다

# update-alternatives --list java
/usr/lib/jvm/java-6-openjdk-i386/jre/bin/java


# update-alternatives --install "/usr/bin/java" "java" "/home/tech/jdk7/bin/java" 1


# update-alternatives --config java
대체 항목 java에 대해 (/usr/bin/java 제공) 2개 선택이 있습니다.

  선택       경로                                                                 우선순     상태
---------------------------------------------------------------------------------------------
   0            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      자동 모드
* 1            /home/tech/jdk7/bin/java                                1            수동 모드
   2            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      수동 모드

기본 사항[*]을 사용하려면 엔터, 다른 것을 사용하려면 번호를 입력하십시오: 1

# java -version
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) Server VM (build 23.1-b03, mixed mode)

# which java
/usr/bin/java


# update-alternatives --help
사용법: update-alternatives [<옵션> ...] <명령>

Commands:
  --install <link> <name> <path> <priority>
    [--slave <link> <name> <path>] ...
                           add a group of alternatives to the system.
  --remove <name> <path>   remove <path> from the <name> group alternative.
  --remove-all <name>      remove <name> group from the alternatives system.
  --auto <name>            switch the master link <name> to automatic mode.
  --display <name>         display information about the <name> group.
  --query <name>           machine parseable version of --display <name>.
  --list <name>            display all targets of the <name> group.
  --get-selections         list master alternative names and their status.
  --set-selections         read alternative status from standard input.
  --config <name>          show alternatives for the <name> group and ask the
                           user to select which one to use.
  --set <name> <path>      set <path> as alternative for <name>.
  --all                    call --config on all alternatives.

<link> is the symlink pointing to /etc/alternatives/<name>.
  (e.g. /usr/bin/pager)
<name> is the master name for this link group.
  (e.g. pager)
<path> is the location of one of the alternative target files.
  (e.g. /usr/bin/less)
<priority> is an integer; options with higher numbers have higher priority in
  automatic mode.

Options:
  --altdir <directory>     change the alternatives directory.
  --admindir <directory>   change the administrative directory.
  --log <file>             change the log file.
  --force                  allow replacing files with alternative links.
  --skip-auto              skip prompt for alternatives correctly configured
                           in automatic mode (relevant for --config only)
  --verbose                verbose operation, more output.
  --quiet                  quiet operation, minimal output.
  --help                   show this help message.
  --version                show the version.

댓글 없음:

댓글 쓰기

깔끔 테마. Powered by Blogger.