我有一个带有用户数据的 EC2 设置,可以在机器上设置 php,因为添加命令来安装 imagick 我的用户数据脚本在我安装 php-dev 包时开始挂起。
我努力了:
- 一个一个地执行包安装
- 在新的 Ubuntu 18.04 实例上的终端窗口中逐步运行脚本(我总是能成功安装)
我的用户数据:
sudo apt update
sudo apt install -y nginx
sudo apt install -y pkg-config
sudo apt install -y imagemagick
sudo apt install -y php7.2-fpm php-common php-mysql php-pear php-xml php-mbstring php-intl php-curl php-gd php-zip php-json php-simplexml php-dom
sudo apt install -y php-dev
sudo apt install -y php-imagick
sudo apt install -y composer
sudo apt install -y nodejs npm jq
每次我尝试这个时 EC2 的输出
...
[ 102.919299] cloud-init[1250]: Unpacking php-dev (1:7.2+60ubuntu1) ...
[ 102.949693] cloud-init[1250]: Selecting previously unselected package pkg-php-tools.
[ 102.961152] cloud-init[1250]: Preparing to unpack .../29-pkg-php-tools_1.35ubuntu1_all.deb ...
[ 102.972353] cloud-init[1250]: Unpacking pkg-php-tools (1.35ubuntu1) ...
[ 103.033142] cloud-init[1250]: Setting up libarchive-zip-perl (1.60-1ubuntu0.1) ...
[ 103.049041] cloud-init[1250]: Setting up libltdl-dev:amd64 (2.4.6-2) ...
[ 103.061142] cloud-init[1250]: Setting up libtimedate-perl (2.3000-2) ...
[ 103.074622] cloud-init[1250]: Processing triggers for install-info (6.5.0.dfsg.1-2) ...
[ 103.219307] cloud-init[1250]: Setting up shtool (2.0.8-9) ...
[ 103.233891] cloud-init[1250]: Setting up libarchive-cpio-perl (0.10-1) ...
[ 103.246200] cloud-init[1250]: Setting up m4 (1.4.18-1) ...
[ 103.257928] cloud-init[1250]: Setting up libcroco3:amd64 (0.6.12-2) ...
[ 103.269881] cloud-init[1250]: Setting up libsys-hostname-long-perl (1.5-1) ...
[ 103.283145] cloud-init[1250]: Setting up libmail-sendmail-perl (0.80-1) ...
[ 103.295856] cloud-init[1250]: Processing triggers for libc-bin (2.27-3ubuntu1) ...
[ 103.312484] cloud-init[1250]: Setting up autotools-dev (20180224.1) ...
[ 103.328905] cloud-init[1250]: Setting up libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.4) ...
[ 103.470751] cloud-init[1250]: Checking for services that may need to be restarted...done.
[ 103.495452] cloud-init[1250]: Checking for services that may need to be restarted...done.
[ 103.502489] cloud-init[1250]: Checking init scripts...
我找到了EC2 `UserData` execution hangs on `Checking init scripts...`但是那个问题的 OP 没有使用任何与我类似的软件包,也没有回答这个问题。
最佳答案
我是您之前提到的那个问题的作者。经过一番折腾,我很确定这取决于您可能正在使用的 AMI。例如我使用 ami-0727f3c2d4b0226d5
我以为是 Ubuntu 18.04 LTS eu-west-1
的一个版本,尽管我在任何 AMI 搜索中都找不到它。所以按照这个链接 -
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html
我运行以下命令以获得 Ubuntu 16:04 的“最新”版本-
aws ec2 describe-images --owners 099720109477 --filters 'Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-????????' 'Name=state,Values=available' --query 'reverse(sort_by(Images, &CreationDate))[:1].ImageId' --output text
这导致了
ami-0c224e30f7a997d9f
;当我使用这个新的 AMI 时,我神奇地消失了:-)您没有确切说明您使用的是什么 AMI,但就我而言,我怀疑我使用的 AMI 版本存在问题;所以我建议你可以尝试不同的 AMI 版本。祝你好运 :-)
关于php - EC2 用户数据卡在 "Checking init scripts..."ubuntu php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58219984/