[HashiCorp] Packer 설치 및 소개

유형욱·2022년 2월 8일
0

개요

본 글에서는 Packer에 대한 간단한 소개 및 설치 방법에 대해서 알아본다.

Packer 소개

Packer는 Hashicorp사에서 제공하는 오픈소스 도구이다. 이를 이용하여 사용자는 멀티 클라우드 플랫폼에서 동일한 머신 이미지(서버 이미지) 생성을 자동화할 수 있다.
한마디로 "골든 이미지"를 만들기 위해 자동화 도구이다.

제공되는 다양한 플러그인

  • Builders
  • Provisioners
  • Post-processors
  • Data sources

Packer 설치

💡 참고 : HashiCorp 공식 홈페이지의 Packer 설치가이드

Packer를 설치하는 방법에 대해서 소개한다. Packer는 다음과 같은 3가지 방식에 대한 설치를 제공한다.

  • Using a precompiled binary. We release binaries for all supported platforms and architectures. This method is recommended for most users. (권장)

  • Installing from source. This method is only recommended for advanced users.

  • Using your system's package manager. (본 글에서 사용)

사전 환경

  • Windows 10
  • WSL Ubuntu 20.04

설치

필자는 편의상 WSL 환경에서 APT를 사용하여 설치해보았다.

  1. Add the HashiCorp GPG key.
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
[sudo] password for hyungwook: 
OK
 hyungw
  1. Add the official HashiCorp Linux repository.
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
...
Fetched 3729 kB in 7s (542 kB/s)
Reading package lists... Done
  1. Update and install.
sudo apt-get update && sudo apt-get install packer
...
Preparing to unpack .../packer_1.7.10_amd64.deb ...
Unpacking packer (1.7.10) ...

설치 확인

정상적으로 설치되었는지 확인해보자.
새 명령 프롬프트 또는 콘솔을 열고 packer 명령으로 확인해본다.

packer
Usage: packer [--version] [--help] <command> [<args>]

Available commands are:
    build           build image(s) from template
    console         creates a console for testing variable interpolation
    fix             fixes templates from old versions of packer
    fmt             Rewrites HCL2 config files to canonical format
    hcl2_upgrade    transform a JSON template into an HCL2 configuration
    init            Install missing plugins or upgrade plugins
    inspect         see components of a template
    validate        check that a template is valid
    version         Prints the Packer version

간략한 소개 및 설치 방법에 대해서 알아보았다.
다음 글에서는 Packer를 사용하여 AWS AMI를 생성하는 방법에 알아볼 예정이다.

profile
DevOps를 꿈꾸는 엔지니어 입니다.

0개의 댓글