cfctl 설치

cfctl은 SpaceONE 서비스를 제어하고 관리하기 위한 강력한 CLI (Command Line Interface) 도구입니다. cfctl을 통해 SpaceONE 리소스를 간편하게 관리할 수 있도록 설계되었습니다.

01. Homebrew를 이용한 설치 (추천)

Homebrew 를 사용하는 경우 Homebrew를 이용하여 cfctl을 설치할 수 있습니다.


brew tap cloudforet-io/tap brew install cfctl

02. 수동 설치

또는 운영체제마다 아래의 명령어를 통해 수동으로 cfctl을 설치할 수 있습니다.

2.1. macOS

Intel Mac
wget "https://github.com/cloudforet-io/cfctl/releases/latest/download/cfctl_Darwin_x86_64.tar.gz"

tar xvf cfctl_Darwin_x86_64.tar.gz chmod +x cfctl mv cfctl /usr/local/bin/
Apple Silicon Mac
wget "https://github.com/cloudforet-io/cfctl/releases/latest/download/cfctl_Darwin_arm64.tar.gz"

tar xvf cfctl_Darwin_arm64.tar.gz chmod +x cfctl mv cfctl /usr/local/bin/

2.2. Linux

x86_64
wget "https://github.com/cloudforet-io/cfctl/releases/latest/download/cfctl_Linux_x86_64.tar.gz"

tar xvf cfctl_Linux_x86_64.tar.gz chmod +x cfctl mv cfctl /usr/local/bin/
ARM64
wget "https://github.com/cloudforet-io/cfctl/releases/latest/download/cfctl_Linux_arm64.tar.gz"

tar xvf cfctl_Linux_arm64.tar.gz chmod +x cfctl mv cfctl /usr/local/bin/

2.3. Docker

Docker를 이용하면, 로컬 환경에 직접 설치하지 않고도 cfctl을 사용할 수 있습니다. 다만, 매번 컨테이너를 생성하고 삭제하는 과정이 반복되기 때문에, 실행 속도나 자원 사용 측면에서 약간의 오버헤드가 발생할 수 있습니다.

컨테이너 이미지 다운로드
docker pull cloudforet/cfctl:latest
Alias 설정(옵션)
bash
echo 'alias cfctl="docker run --rm -it -v $HOME/.cfctl:/root/.cfctl cloudforet/cfctl:latest"' >> ~/.bashrc source ~/.bashrc
zsh
echo 'alias cfctl="docker run --rm -it -v $HOME/.cfctl:/root/.cfctl cloudforet/cfctl:latest"' >> ~/.zshrc source ~/.zshrc
fish
echo 'alias cfctl="docker run --rm -it -v $HOME/.cfctl:/root/.cfctl cloudforet/cfctl:latest"' >> ~/.config/fish/config.fish source ~/.config/fish/config.fish

2.4. Go

Go 가 설치되어 있는 경우, Go를 이용하여 cfctl을 설치할 수 있습니다.

Step 1

Go 1.23+ 를 설치합니다. Go 다운로드

[Optional] Step 2

Go 환경변수를 설정합니다.

  • bash 또는 zsh
~/.bashrc 또는 ~/.zshrc
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
  • fish
~/.config/fish/config.fish
set -gx GOPATH $HOME/go
set -gx GOBIN $HOME/go/bin
set -gx PATH $PATH /usr/local/go/bin (go env GOBIN)

각 Shell에 맞게 source 명령어를 입력하거나, 터미널을 종료 후 다시 실행합니다.

Step 3

cfctl을 설치합니다.


go install github.com/cloudforet-io/cfctl@latest

2.5. Windows

  1. Releases 페이지에서 최신 Windows 버전을 다운로드합니다.
  2. ‘cfctl_Windows_x86_64.zip’ 파일을 압축 해제합니다.
  3. 압축 해제한 디렉터리를 시스템의 PATH 환경 변수에 추가합니다.
  4. PowerShell 또는 Command Prompt를 열어 설치 여부를 확인합니다.

03. 설치 확인

cfctl이 정상적으로 설치되었는지 확인하기 위해 아래 명령어를 실행합니다.


cfctl
WARNING  No valid configuration found.
INFO  Please run 'cfctl setting init' to set up your configuration.
cfctl controls the SpaceONE services.
  Find more information at:
    - https://github.com/cloudforet-io/cfctl
    - https://docs.spaceone.megazone.io/developers/setup/cfctl (English)
    - https://docs.spaceone.megazone.io/ko/developers/setup/cfctl (Korean)

Usage:
  cfctl [command]

Available Commands:

Other Commands:
  alias         Manage command aliases
  api_resources Displays supported API resources
  apply         Apply a configuration to a resource using a file
  login         Login to SpaceONE
  setting       Manage cfctl setting file

Additional Commands:
  completion    Generate the autocompletion script for the specified shell
  help          Help about any command

Flags:
  -h, --help   help for cfctl

Use "cfctl [command] --help" for more information about a command.
  • 현재는 설정 파일이 없기 때문에 WARNING 메시지가 출력됩니다.
  • 다음 페이지에서는 cfctl setting 명령어를 알아보고, cfctl setting init 명령어를 통해 설정 파일을 생성하는 방법에 대해 알아봅시다.