【问题标题】:How do I install Anaconda with salt-stack on Ubuntu如何在 Ubuntu 上安装带有 salt-stack 的 Anaconda
【发布时间】:2014-12-29 18:10:46
【问题描述】:

由于Anaconda没有包,如何通过Salt进行安装和管理?

对于快速入门指南中描述的安装,我必须下载一个安装程序(例如 Anaconda-2.1.0-Linux-x86_64.sh),然后在 shell 中执行

bash <downloaded file>

我必须为 salt 编写一个花哨的 python 安装程序,还是有更简单的方法让 salt 知道如何安装 Anaconda?

【问题讨论】:

    标签: linux anaconda salt-stack


    【解决方案1】:

    我认为您最好的选择是使用此处记录的cmd.script 状态:http://docs.saltstack.com/en/latest/ref/states/all/salt.states.cmd.html#salt.states.cmd.script

    运行它的示例 Salt state 看起来像这样。 假设您已将 anaconda 安装程序复制到 Salt Master 上的此位置: /srv/salt/Anaconda-2.1.0-Linux-x86_64.sh

    /srv/salt/install_anaconda.sls的内容:

    run_anaconda_installer:
      cmd.script:
        - source: salt://Anaconda-2.1.0-Linux-x86_64.sh
        - creates: /usr/bin/anaconda     # This should be a path to a file or directory created by Anaconda-2.1.0-Linux-x86_64.sh. This will cause Salt not to rerun this install script if that file or directory already exist.
        - user: root
        - group: root
    

    【讨论】:

    • 非常感谢。这开始了安装。但是现在我遇到了问题,安装脚本要求用户输入并自动中止:“您批准许可条款吗?[yes|no] \\ [no] >>> 许可协议未获批准,中止安装.\\为了批准协议,您需要输入“是”。 - 我如何传递这些用户输入来自动化安装过程?
    • 您必须弄清楚如何传递这些选项,以便进行静默安装。
    • 到目前为止我尝试过的(没有成功):当我手动安装 anaconda 作为静默安装时,我会做这样的事情:>printf "\nyes\n[path]\nno\ n" | bash Anaconda-2.1.0-Linux-x86_64.sh
    【解决方案2】:

    我想自从最初提出问题以来这已经改变了,但现在您可以简单地将 -b 参数传递给脚本以在批处理模式下运行。我的 salt state 也以 root 身份安装在 /opt 下,如下所示:

    /opt/Miniconda2-latest-Linux-x86_64.sh:
      cmd.run:
        - name: >
            wget --continue
            https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
            -O /opt/Miniconda2-latest-Linux-x86_64.sh
        - creates: /opt/miniconda2
    
    /opt/miniconda:
      cmd.script:
        - name: /opt/Miniconda2-latest-Linux-x86_64.sh
        - args: -b -p /opt/miniconda2
        - creates: /opt/miniconda2
    

    他们都说他们创建了/opt/miniconda2 文件夹,这样我们就不会为此多次上网。

    【讨论】:

      猜你喜欢
      • 2013-11-19
      • 1970-01-01
      • 2017-11-19
      • 1970-01-01
      • 1970-01-01
      • 2020-02-27
      • 2017-06-26
      • 2019-07-11
      • 1970-01-01
      相关资源
      最近更新 更多