![Learning DevOps](https://wfqqreader-1252317822.image.myqcloud.com/cover/384/36698384/b_36698384.jpg)
上QQ阅读APP看书,第一时间看更新
Installing Packer by script on Linux
The installation script for a Linux machine is as follows:
PACKER_VERSION="1.4.3" #Update with your desired version
curl -Os https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip \
&& curl -Os https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_SHA256SUMS \
&& curl https://keybase.io/hashicorp/pgp_keys.asc | gpg --import \
&& curl -Os https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_SHA256SUMS.sig \
&& gpg --verify packer_${PACKER_VERSION}_SHA256SUMS.sig packer_${PACKER_VERSION}_SHA256SUMS \
&& shasum -a 256 -c packer_${PACKER_VERSION}_SHA256SUMS 2>&1 | grep "${PACKER_VERSION}_linux_amd64.zip:\sOK" \
&& unzip -o packer_${PACKER_VERSION}_linux_amd64.zip -d /usr/local/bin
The code of this script is also available here: https://github.com/PacktPublishing/Learning_DevOps/blob/master/CHAP04/install_packer.sh.
This script performs the following actions:
- Download the Packer version 1.4.0 package and check the checksum.
- Unzip and copy the package into a local directory, /usr/local/bin (by default, this folder is in the PATH environment variable).
The following is a screenshot of the execution of the script for installing Packer on Linux:
![](https://epubservercos.yuewen.com/A085E6/19470376308796106/epubprivate/OEBPS/Images/4b13dd81-e356-4494-bac5-183e7a5074fb.png?sign=1739533521-KxpgXy0hkhzo80ZMTrHxqbt7wXOOgMoW-0-13d8a903ead7e2e3b07abb0416c95572)