一、安装
[root@master ~]# yum install zip unzip -y
[root@master ~]#curl -s "https://get.sdkman.io" | bash
[root@master ~]#source "$HOME/.sdkman/bin/sdkman-init.sh"
验证安装
[root@master ~]# sdk version
#网络状态会很慢,建议offline enable
[root@master ~]# sdk offline enable
Offline mode enabled.
[root@master ~]# sdk version
SDKMAN 5.7.4+362
[root@master ~]# sdk help
Usage: sdk <command> [candidate] [version]sdk offline <enable|disable>commands:install or i <candidate> [version] [local-path]uninstall or rm <candidate> <version>list or ls [candidate]use or u <candidate> <version>default or d <candidate> [version]current or c [candidate]upgrade or ug [candidate]version or vbroadcast or bhelp or hoffline [enable|disable]selfupdate [force]updateflush <broadcast|archives|temp>candidate : the SDK to install: groovy, scala, grails, gradle, kotlin, etc.use list command for comprehensive list of candidateseg: $ sdk listversion : where optional, defaults to latest stable if not providedeg: $ sdk install groovylocal-path : optional path to an existing local installationeg: $ sdk install groovy 2.4.13-local /opt/groovy-2.4.13
二、常规使用
本地安装,必须在offline disable状态下才能安装成功
[root@master soft]# sdk offline enable
Offline mode enabled.
[root@master soft]# sdk install java java1.81 /usr/local/jdk1.81
Stop! java java1.81 is not available while offline.
[root@master soft]# sdk uninstall java test
Unselecting java test...
Uninstalling java test...
[root@master soft]# sdk uninstall java system
Uninstalling java system...
[root@master soft]# sdk ls java
Offline: only showing installed java versions
--------------------------------------------------------------------------------None installed!
--------------------------------------------------------------------------------
* - installed
> - currently in use
------------------------------
[root@master soft]# sdk offline disable
Online mode re-enabled!
[root@master soft]# sdk ls java
================================================================================
Available Java Versions
================================================================================Vendor | Use | Version | Dist | Status | Identifier
--------------------------------------------------------------------------------AdoptOpenJDK | | 13.0.2.j9 | adpt | | 13.0.2.j9-adpt | | 13.0.2.hs | adpt | | 13.0.2.hs-adpt | | 12.0.2.j9 | adpt | | 12.0.2.j9-adpt | | 12.0.2.hs | adpt | | 12.0.2.hs-adpt | | 11.0.6.j9 | adpt | | 11.0.6.j9-adpt | | 11.0.6.hs | adpt | | 11.0.6.hs-adpt | | 8.0.242.j9 | adpt | | 8.0.242.j9-adpt | | 8.0.242.hs | adpt | | 8.0.242.hs-adpt Amazon | | 11.0.6 | amzn | | 11.0.6-amzn | | 8.0.242 | amzn | | 8.0.242-amzn Azul Zulu | | 13.0.2 | zulu | | 13.0.2-zulu | | 12.0.2 | zulu | | 12.0.2-zulu | | 11.0.6 | zulu | | 11.0.6-zulu | | 11.0.5.fx | zulu | | 11.0.5.fx-zulu | | 10.0.2 | zulu | | 10.0.2-zulu | | 9.0.7 | zulu | | 9.0.7-zulu | | 8.0.242 | zulu | | 8.0.242-zulu | | 8.0.232.fx | zulu | | 8.0.232.fx-zulu | | 7.0.242 | zulu | | 7.0.242-zulu | | 6.0.119 | zulu | | 6.0.119-zulu BellSoft | | 13.0.2.fx | librca | | 13.0.2.fx-librca | | 13.0.2 | librca | | 13.0.2-librca | | 12.0.2 | librca | | 12.0.2-librca | | 11.0.6.fx | librca | | 11.0.6.fx-librca | | 11.0.6 | librca | | 11.0.6-librca | | 8.0.242.fx | librca | | 8.0.242.fx-librca | | 8.0.242 | librca | | 8.0.242-librca GraalVM | | 19.3.1.r11 | grl | | 19.3.1.r11-grl | | 19.3.1.r8 | grl | | 19.3.1.r8-grl | | 19.3.0.r11 | grl | | 19.3.0.r11-grl | | 19.3.0.r8 | grl | | 19.3.0.r8-grl | | 19.3.0.2.r11 | grl | | 19.3.0.2.r11-grl | | 19.3.0.2.r8 | grl | | 19.3.0.2.r8-grl | | 19.2.1 | grl | | 19.2.1-grl | | 19.1.1 | grl | | 19.1.1-grl | | 19.0.2 | grl | | 19.0.2-grl | | 1.0.0 | grl | | 1.0.0-rc-16-grl Java.net | | 15.ea.8 | open | | 15.ea.8-open | | 14.ea.34 | open | | 14.ea.34-open | | 12.0.2 | open | | 12.0.2-open | | 11.0.6 | open | | 11.0.6-open | | 10.0.2 | open | | 10.0.2-open | | 9.0.4 | open | | 9.0.4-open | | 8.0.242 | open | | 8.0.242-open SAP | | 13.0.2 | sapmchn | | 13.0.2-sapmchn | | 12.0.2 | sapmchn | | 12.0.2-sapmchn | | 11.0.6 | sapmchn | | 11.0.6-sapmchn
================================================================================
Use the Identifier for installation:$ sdk install java 11.0.3.hs-adpt
================================================================================
三、卸载 SDKMAN
[root@master ~]# tar zcvf ~/sdkman-backup_$(date +%F-%kh%M).tar.gz -C ~/ .sdkman
[root@master ~]# rm -rf ~/.sdkman
————Blueicex 2020/2/12 12:45 blueice1980@126.com