Chocolatey 설치

Intro

Chocolatey는 Windows용 패키지 관리자입니다. Chocolatey는 다양한 소프트웨어와 도구를 쉽게 설치, 업데이트 및 제거할 수 있도록 도와줍니다. Linux의 aptyum 같은 패키지 관리자의 역할을 Windows 환경에서 수행한다고 생각하면 됩니다.

주요 기능 및 장점

패키지 관리

  • 다양한 소프트웨어 패키지를 설치, 업데이트, 제거, 구성할 수 있습니다.
  • 패키지 목록을 관리하고 원하는 소프트웨어를 빠르게 설치할 수 있습니다.

자동화

  • 명령어 하나로 여러 패키지를 설치하거나 업데이트할 수 있습니다.
  • 스크립트를 사용해 일관된 환경을 쉽게 설정할 수 있습니다.

커뮤니티 지원

  • Chocolatey는 커뮤니티에 의해 유지 보수 되며, 수천 개의 패키지를 제공하고 있습니다.
  • 새로운 패키지를 쉽게 추가하고 공유할 수 있습니다.

사용자 정의 가능

  • 자신만의 패키지를 만들어 내부적으로 배포할 수 있습니다.
  • 사내 환경에 맞게 설정과 구성을 자동화할 수 있습니다.

설치 방법

Powershell 이용

  • Windows 검색창에 powershell을 입력한 후 Windows PowerShell을 우클릭하고 관리자 권한으로 실행을 선택합니다.
  • 관리자 권한으로 열린 PowerShell에서 아래 명령어를 입력하여 Chocolatey를 설치합니다
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
PS D:\playground> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
>>
경고: An existing Chocolatey installation was detected. Installation will not continue. This script will not overwrite
existing installations.
If there is no Chocolatey installation at 'C:\ProgramData\chocolatey', delete the folder and attempt the installation
again.
Please use choco upgrade chocolatey to handle upgrades of Chocolatey itself.
If the existing installation is not functional or a prior installation did not complete, follow these steps:
 - Backup the files at the path listed above so you can restore your previous installation if needed.
 - Remove the existing installation manually.
 - Rerun this installation script.
 - Reinstall any packages previously installed, if needed (refer to the lib folder in the backup).
Once installation is completed, the backup folder is no longer needed and can be deleted.
PS D:\playground>

직접 설치

Chocolatey 설치 파일 다운로드

  • 웹 브라우저를 사용하여 Chocolatey 설치 페이지로 이동합니다: Chocolatey 설치 페이지
  • 페이지에서 chocolatey.zip 파일을 다운로드합니다.
  • 다운로드한 chocolatey.zip 파일을 원하는 위치에 압축을 풉니다.
    • 예를 들어, D:\Playgroud\Ref 디렉토리에 압축을 풉니다.

환경 변수 추가

제거 방법

Remove-Item 'C:\ProgramData\chocolatey' -Recurse -Force

기본 명령어

패키지 설치

  • 예를 들어, Git을 설치하려면 아래 명령어를 사용합니다.
choco install git -confirm

패키지 업데이트

  • 설치된 패키지를 업데이트하려면 아래 명령어를 사용합니다
choco upgrade git

패키지 검색

  • 특정 패키지를 검색하려면 아래 명령어를 사용합니다.
choco search git

설치된 패키지 목록 확인

  • 설치된 패키지의 목록을 확인하려면 아래 명령어를 사용합니다
choco list --local-only

사용 예시

여러 패키지 한 번에 설치하기

스크립트를 작성하여 여러 패키지를 한 번에 설치할 수 있습니다. 예를 들어, 개발 환경을 설정하기 위해 Git 과 Hugo 를 함께 설치하는 스크립트는 다음과 같습니다.

# install-git-and-hugo.ps1
choco install git -confirm
choco install hugo -confirm

참고