ฉันพยายามติดตั้ง terraform ในเดสก์ท็อป Ubuntu แต่ฉันได้รับข้อผิดพลาด:
bash: /usr/local/bin/terraform: cannot execute binary file: Exec format error"
ขั้นตอนเดียวกันนี้ทำงานกับเซิร์ฟเวอร์คลาวด์
ฉันพยายามติดตั้ง terraform ในเดสก์ท็อป Ubuntu แต่ฉันได้รับข้อผิดพลาด:
bash: /usr/local/bin/terraform: cannot execute binary file: Exec format error"
ขั้นตอนเดียวกันนี้ทำงานกับเซิร์ฟเวอร์คลาวด์
คำตอบ:
ขั้นตอนในการติดตั้ง Terraform บนเซิร์ฟเวอร์คลาวด์ Ubuntu / Ubuntu:
ติดตั้งเปิดเครื่องรูด
sudo apt-get install unzip
ยืนยันหมายเลขเวอร์ชั่นล่าสุดบนเว็บไซต์ terraform:
https://www.terraform.io/downloads.html
ดาวน์โหลด Terraform เวอร์ชั่นล่าสุด (แทนที่หมายเลขเวอร์ชั่นใหม่กว่านี้หากจำเป็น)
wget https://releases.hashicorp.com/terraform/0.12.7/terraform_0.12.7_linux_amd64.zip
แตกไฟล์เก็บถาวรที่ดาวน์โหลดมา
unzip terraform_0.12.7_linux_amd64.zip
ย้ายไฟล์ที่เรียกทำงานได้ไปยังไดเรกทอรีที่ค้นหาไฟล์ปฏิบัติการ
sudo mv terraform /usr/local/bin/
เรียกใช้
terraform --version
sudo install terraform /usr/local/bin/
มีความน่าเชื่อถือมากขึ้นจะช่วยให้มั่นใจว่าการเป็นเจ้าของและสิทธิ์ถูกต้อง
sudo install
เพิ่มที่นี่จริงหรือไม่ ฉันถามสิ่งนี้เพราะฉันได้รับ "ติดตั้ง: ไม่สามารถ stat 'terraform': ไม่มีไฟล์หรือไดเรกทอรีดังกล่าว" เมื่อพยายามเรียกใช้และไม่สามารถทำงานได้ตามที่ตั้งใจ ความรู้สึกที่น่าอึดอัดใจเกี่ยวกับการไม่ใช้คำสั่งนี้เคยเป็นมาก่อน ...
หากคุณใช้งาน Ubuntu พร้อมติดตั้ง snap เพียงโทร:
sudo snap install terraform
/snap/terraform/216/bin/terraform apply
ทำงานได้ดีถ้าผมติดตั้งกับสแน็ปแล้วโทรไบนารีผ่านเส้นทางที่เต็มไปด้วย แต่ฉันแค่ใช้terraform apply
และปล่อยให้ PATH ค้นหา/snap/bin/terraform
ไบนารีไม่สามารถใช้ ssh-agent ของฉันได้
ข้อผิดพลาดนี้เกิดขึ้นเมื่อคุณลองเรียกใช้ไฟล์ exec 64 บิตในระบบ 32 บิต ตรวจสอบระบบของคุณ:
uname -a
x86_64 หรือ i686 หมายถึง 64 หรือ 32 บิตตามลำดับ
หนึ่งซับของฉันเพื่อติดตั้งเวอร์ชันล่าสุด:
sudo echo ; zcat <( CURRR_VER=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version') ; curl -q "https://releases.hashicorp.com/terraform/${CURRR_VER#?}/terraform_${CURRR_VER#?}_linux_amd64.zip" ) | sudo tee /usr/local/bin/terraform > /dev/null ; sudo chmod +x /usr/local/bin/terraform
ใช้บรรทัดจากhttps://github.com/hashicorp/terraform/issues/9803#issuecomment-257903082
สิ่งที่เกี่ยวกับการใช้พื้นที่เก็บข้อมูล terraform deb คุณกว่าสามารถติดตั้งและปรับปรุง terraform apt
ใช้
https://tjend.github.io/repo_terraform/
แบบนี้:
wget -q -O - https://tjend.github.io/repo_terraform/repo_terraform.key | sudo apt-key add -
sudo echo 'deb [arch=amd64] https://tjend.github.io/repo_terraform stable main' >> /etc/apt/sources.list.d/terraform.list
sudo apt-get update
sudo apt-get install terraform
sudo apt-get install terraform
จากนั้นเรียกใช้คำสั่งsudo apt-get update
แล้วsudo apt-get upgrade
จะช่วยให้คุณได้รับเวอร์ชันที่เหมาะสมของ teraform ลงในฮาร์ดแวร์จำลองที่ดึงมาจากการติดตั้ง Ubuntu หรือรุ่น Linux ใด ๆ ที่ติดตั้งในระบบของคุณ