1

我正在尝试在 Elastic Beanstalk 上安装 GhostScript 9.10,因为目前只有 Ghostscript 8.70 可以通过 yum 包获得。

安装在 EC2 实例上通过 SSH 进行,但配置文件总是失败,我不明白是什么原因。

这是我的 .ebextensions 配置文件:

commands:
    01_admin_rights:
        command: "sudo su"
    02_get_gs:
        command: "curl -O http://downloads.ghostscript.com/public/old-gs-releases/ghostscript-9.10.tar.gz"
    03_extract_gs:
        command: "tar -xzf  ghostscript-9.10.tar.gz"
    04_cd_gs:
        command: "cd ghostscript-9.10"
    05_configure_gs:
        command: "bash configure"
    06_install_gs:
        command: "make install"
    07_so_gs:
        command: "make so"
    08_reboot:
        command: "reboot"

这里是弹性豆茎错误日志部分:

[2016-06-21T12:22:52.720Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 01_admin_rights] : Starting activity...
[2016-06-21T12:22:52.757Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 01_admin_rights] : Completed activity.
[2016-06-21T12:22:52.757Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 02_get_gs] : Starting activity...
[2016-06-21T12:22:53.524Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 02_get_gs] : Completed activity. Result:
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed

0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 33.6M  100 33.6M    0     0  49.2M      0 --:--:-- --:--:-- --:--:-- 49.2M

[2016-06-21T12:22:53.524Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 03_extract_gs] : Starting activity...
[2016-06-21T12:22:55.066Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 03_extract_gs] : Completed activity.
[2016-06-21T12:22:55.066Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 04_cd_gs] : Starting activity...
[2016-06-21T12:22:55.069Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 04_cd_gs] : Completed activity.
[2016-06-21T12:22:55.070Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 05_configure_gs] : Starting activity...
[2016-06-21T12:22:55.073Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 05_configure_gs] : Activity execution failed, because: bash: configure: No such file or directory
 (ElasticBeanstalk::ExternalInvocationError)
[2016-06-21T12:22:55.073Z] INFO  [24703] - [Application update Come on #15@25/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_2__Staging/Command 05_configure_gs] : Activity failed.

我知道命令 5 失败,因为该文件不存在。但是,当我通过 SSH 手动执行这些步骤时,文件存在并且所有命令都可以按此顺序执行。

我想念什么?

编辑:我玩弄了 configure 参数并尝试了:

/bin/bash: ./configure

。/配置

重击 ./配置

所有参数都失败并出现相同的错误“没有这样的文件或目录”。如果我通过 SSH 连接并输入配置命令之一,那么它可以正常工作。

有人知道这里发生了什么吗?

4

1 回答 1

0

我认为这可能是因为单独的命令不会使环境或当前目录在它们之间保持一致。您的命令之一是cd,但我认为更改后的目录不会持续到下一个命令。尝试将所有命令合二为一,如下所示:

command: |
  cd directory
  ./configure

此外,ebextensions 以 root 身份运行,因此您一开始可能不需要sudo su

于 2018-01-19T17:58:33.457 回答