Come installare Terraform su Fedora 38/37/36/35/34/33
Questa guida ti aiuterà a installare Terraform su Fedora 38/37/36/35/34/33. Terraform è uno strumento di automazione dell'infrastruttura cloud-agnostic utilizzato per gestire risorse cloud e on-premise. Terraform può creare, modificare e modificare le versioni dell'infrastruttura distribuita sui provider di servizi più diffusi.
Con Terraform puoi gestire cloud computing, reti, bilanciatori del carico, DNS e così via utilizzando un semplice linguaggio di programmazione dichiarativo. Consulta l'elenco completo dei provider Terraform.
Esistono due metodi con cui possiamo installare terraform sul sistema Fedora Linux. Tratteremo l'installazione di Terraform sul nostro sistema Fedora dal repository YUM e l'installazione manuale.
Metodo 1: installa Terraform dal repository YUM
Il team di sviluppo di Terraform fornisce repository di pacchetti per distribuzioni Linux basate su RedHat Enterprise Linux come Fedora, CentOS, Rocky Linux e Amazon Linux.
sudo dnf clean all
sudo dnf makecache
Aggiungi il repository HashiCorp al tuo sistema eseguendo i seguenti comandi:
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
Conferma che il repository è stato aggiunto correttamente al sistema:
$ sudo dnf repolist
repo id repo name
fedora Fedora 38 - x86_64
fedora-cisco-openh264 Fedora 38 openh264 (From Cisco) - x86_64
fedora-modular Fedora Modular 38 - x86_64
hashicorp Hashicorp Stable - x86_64
updates Fedora 38 - x86_64 - Updates
updates-modular Fedora Modular 38 - x86_64 - Updates
Infine installa il pacchetto terraform sul sistema Fedora Linux:
sudo dnf install terraform
Esamina l'albero delle dipendenze e procedi con l'installazione:
....
Transaction Summary
======================================================================================================================================================================================================
Install 2 Packages
Total download size: 13 M
Installed size: 57 M
Is this ok [y/N]: y
Convalida l'installazione corretta di Terraform su Fedora controllando la versione:
$ terraform --version
Terraform v1.5.5
on linux_amd64
Metodo 2: installazione manuale di Terraform su Fedora
Il metodo di distribuzione principale di Terraform è un archivio .zip che contiene un singolo file eseguibile che puoi estrarre ed eseguire sul tuo sistema. Puoi controllare la versione più recente nella pagina delle versioni di Terraform prima di scaricarla di seguito.
Installa gli strumenti wget e curl sulla tua Fedora:
sudo dnf install wget curl
Quindi scarica l'ultima versione di Terraform nel formato di archivio .zip .
TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \"\,\v | awk '{$1=$1};1'`
wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip
Dopo il download, estrai l'archivio:
$ unzip terraform_${TER_VER}_linux_amd64.zip
Archive: terraform_xxxx_linux_amd64.zip
inflating: terraform
Sposta il binario terraform nella directory /usr/local/bin:
sudo mv terraform /usr/local/bin/
Ciò renderà lo strumento accessibile a tutti gli account utente.
$ which terraform
/usr/local/bin/terraform
Conferma la versione installata
$ terraform --version
Terraform v1.5.5
on linux_amd64
Verifica che lo strumento funzioni:
$ terraform
Usage: terraform [global options] <subcommand> [args]
The available commands for execution are listed below.
The primary workflow commands are given first, followed by
less common or more advanced commands.
Main commands:
init Prepare your working directory for other commands
validate Check whether the configuration is valid
plan Show changes required by the current configuration
apply Create or update infrastructure
destroy Destroy previously-created infrastructure
All other commands:
console Try Terraform expressions at an interactive command prompt
fmt Reformat your configuration in the standard style
force-unlock Release a stuck lock on the current workspace
get Install or upgrade remote Terraform modules
graph Generate a Graphviz graph of the steps in an operation
import Associate existing infrastructure with a Terraform resource
login Obtain and save credentials for a remote host
logout Remove locally-stored credentials for a remote host
output Show output values from your root module
providers Show the providers required for this configuration
refresh Update the state to match remote systems
show Show the current state or a saved plan
state Advanced state management
taint Mark a resource instance as not fully functional
test Experimental support for module integration testing
untaint Remove the 'tainted' state from a resource instance
version Show the current Terraform version
workspace Workspace management
Global options (use these before the subcommand, if any):
-chdir=DIR Switch to a different working directory before executing the
given subcommand.
-help Show this help output, or the help for a specified subcommand.
-version An alias for the "version" subcommand.
Prossimi passi
Ora che hai installato Terraform, è il momento di creare l'infrastruttura utilizzando un file di configurazione Terraform minimo. I casi d'uso di Terraform sono una pagina interessante da leggere.
- Come effettuare il provisioning delle VM su KVM con Terraform
Altre guide di installazione:
Per l'uso di Ubuntu:
- Come installare Terraform su Ubuntu
Gli utenti Windows possono seguire Installa e utilizza Terraform su Windows/Windows Server