首页 > 其他分享 >ansible 安装jdk

ansible 安装jdk

时间:2022-09-27 15:26:06浏览次数:49  
标签:profile shell name jdk data etc ansible 安装

1、上传文件到ansible端上

/data/jdk/jdk-8u341-linux-x64.tar.gz(下载地址:)

2、编辑jdk.yml文件

vim jdk.yml

---
- hosts: 192.168.59.103
  remote_user: root

  tasks:
    - name: mkdir
      file: name=/data/jdk state=directory
    - name: copy file
      copy: src=/data/jdk/jdk-8u341-linux-x64.tar.gz dest=/data/jdk/
    - name: tar
      unarchive: src=/data/jdk/jdk-8u341-linux-x64.tar.gz dest=/usr/local/ copy=no

#不能用$JAVA_HOME参数,否则识别不出来
    - name: echo1
      shell: echo "JAVA_HOME=/usr/local/jdk1.8.0_341" >> /etc/profile
    - name: echo2
      shell: echo "CLASSPATH=/usr/local/jdk1.8.0_341/lib/" >> /etc/profile
    - name: echo3
      shell: echo "PATH=$PATH:/usr/local/jdk1.8.0_341/bin" >> /etc/profile
    - name: echo4
      shell: echo "export JAVA_HOME CLASSPATH PATH" >> /etc/profile
    - name: source
      shell: source /etc/profile

3、验证

  ansible-playbook jdk.yml

 

标签:profile,shell,name,jdk,data,etc,ansible,安装
From: https://www.cnblogs.com/leihongnu/p/16734652.html

相关文章

  • pip 离线安装 gdal 更改为清华源
    condaactivatefirst激活虚拟环境first。python-V查看python版本。https://www.lfd.uci.edu/~gohlke/pythonlibs/下载与python版本匹配的whl包。虚拟环境......
  • winehq ubuntu 22 安装
    安装按照官方的方法配置即可,如果遇到W:GPGerror:https://dl.winehq.org/...NO_PUBKEY76F1A20FF987672F的问题,请仔细阅读官方安装下面的提示,包括22目前没有stable版......
  • 使用polkadot.js在substrate frontier上安装ERC20token合约
    参考资料SubstrateFrontierNodeTemplategithub.com/substrate-developer-hub/frontier-node-templatefrontier-node-template/examples/contract-erc20/truffle/con......
  • ubuntu的apt源更新后只能装php8新版本,无法安装php7老版本了
    新电脑更新apt源以后,发现新装的都是php8.1,而且apt源update后,search也找不到php7了。于是找到了这篇文章然后按照他说的做sudoapt-getupdatesudoapt-yinstallsof......
  • 1. Windows机器安装配置freeSSHd服务
    1.      Windows机器安装配置freeSSHd服务第一步,官网下载http://www.freesshd.com/?ctt=download,选择freeSSHd.exe。 第二步,选择以管理员身份运行,使用administr......
  • ubuntu 22 安装fcitx输入法
    安装输入法会遇到的问题输入法不启动安装依赖冲突firefox输入无输入框,无选择框错误的安装方法从菜单选择LanguageSupport默认安装使用aptinstallfcitx5*全部安......
  • Python 安装
    进入Python官网选择安装包根据自己需要选择安装包,这里我选用的是Python3.10.7的完整安装包Windowsinstaller(64-bit),注意:embeddable:表示绿色免安装版本,可......
  • docker安装和登陆mysql
    1.docker是什么Docker是一个开源的应用容器引擎,基于Go语言并遵从Apache2.0协议开源。Docker可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器......
  • unity安装教程
     参考:https://baijiahao.baidu.com/s?id=1739504876410897821&wfr=spider&for=pc 加载地形。。切图加载3dtiles......
  • Cmake安装
    进入Cmake官网根据自己需要选择安装包下载后双击安装进入安装界面,点击【Next】同意协议,点击【Next】将Cmake添加进用户变量点击【Next注意:选择......