RPM 패키지 관리

이 페이지에서는 Yum 저장소에서 RPM 패키지를 추가, 보기, 삭제하는 방법을 설명합니다. Artifact Registry Yum 저장소는 Yum 및 DNF를 지원합니다.

시작하기 전에

  1. 대상 Yum 저장소가 없으면 새 저장소를 만듭니다.
  2. 저장소에 액세스하도록 VM을 구성합니다.
  3. (선택사항) gcloud 명령어의 기본값을 구성합니다.
  4. 메타데이터의 패키지 이름이 Fedora 패키지 이름 지정 가이드라인Fedora 패키지 버전 관리 가이드라인을 충족하는지 확인합니다.

패키지 추가

저장소 모드: 표준

패키지를 추가하려면 저장소에 대한 읽기 및 쓰기 권한이 모두 있어야 합니다.

Google Cloud CLI를 사용하여 저장소에 패키지를 업로드하거나 Cloud Storage에 저장된 패키지를 가져올 수 있습니다.

Cloud Build를 사용하여 패키지를 빌드하는 경우 빌드는 패키지를 가져올 수 있도록 Cloud Storage에 저장할 수 있습니다.

가져오기 또는 업로드 작업이 매우 길면 gcloud CLI에서 API를 호출하는 데 사용하는 토큰의 만료 기간을 초과할 수 있습니다. 추가할 패키지가 너무 많으면 각 업로드 또는 가져오기 작업을 더 짧은 시간 내에 완료할 수 있도록 패키지를 더 작은 배치로 추가하는 것을 고려하세요. 자세한 내용은 OS 패키지 문제 해결 문서를 참조하세요.

직접 업로드

gcloud artifacts yum upload 명령어를 사용하여 Yum 저장소에 패키지를 업로드합니다.

gcloud artifacts yum upload REPOSITORY \
    --location=LOCATION \
    --source=PACKAGES

다음 값을 바꿉니다.

  • REPOSITORY는 Artifact Registry 저장소 이름입니다.
  • LOCATION는 저장소의 리전 또는 멀티 리전 위치입니다.
  • PACKAGES는 패키지의 경로입니다.

예를 들어 my-package.rpm 패키지를 us-west1 위치에 있는 Yum 저장소 my-repo에 업로드하려면 다음을 실행합니다.

gcloud artifacts yum upload my-repo \
    --location=us-west1 \
    --source=my-package.rpm

Cloud Storage

  1. 다음 방법 중 하나로 패키지를 Cloud Storage에 업로드합니다.
    • Cloud Storage 버킷에 직접 패키지를 업로드
    • Cloud Build로 패키지를 빌드하고 버킷에 저장
  2. 다음 명령어를 실행합니다.
    gcloud artifacts yum import REPOSITORY \
      --location=LOCATION \
      --gcs-source=PACKAGES
    

    다음 값을 바꿉니다.

    • REPOSITORY는 Artifact Registry 저장소 이름입니다.
    • LOCATION는 저장소의 리전 또는 멀티 리전 위치입니다.
    • PACKAGES는 Cloud Storage의 패키지의 쉼표로 구분된 목록입니다. 디렉터리에서 모든 패키지를 업로드하려면 디렉터리 와일드 카드 (*)를 사용하거나 재귀 디렉터리 와일드 카드(**)를 사용하여 모든 하위 디렉터리의 모든 패키지를 업로드합니다.

    예를 들어 다음 명령어는 package.rpm 패키지와 directory 디렉터리의 모든 패키지를 my-bucket 버킷에서 us-west1 위치의 Yum 저장소 my-repo에 업로드합니다.

    gcloud artifacts yum import my-repo \
      --location=us-west1 \
      --gcs-source=gs://my-bucket/path/to/package.rpm,gs://my-bucket/directory*
    

업로드 또는 가져오기 작업이 완료되면Google Cloud 콘솔 또는 gcloud CLI를 사용하여 저장소의 패키지를 하고 업로드가 성공적으로 완료되었는지 확인할 수 있습니다.

패키지가 많은 대용량 저장소가 있는 경우 새 패키지가 Yum 클라이언트에 표시되도록 패키지 색인을 다시 생성하는 데 몇 분 정도 걸릴 수 있습니다.

패키지 보기

저장소 모드: 표준, 원격(미리보기)

패키지를 보려면 Artifact Registry 리더 역할의 권한이 있어야 합니다. Artifact Registry는 패키지 내의 파일을 나열하지 않습니다.

To view packages and package versions using the Google Cloud console or gcloud:

Console

  1. Open the Repositories page in the Google Cloud console.

    저장소 페이지 열기

  2. In the repository list, click the appropriate repository.

    The Packages page lists the packages in the repository.

  3. Click a package to view versions of the package.

gcloud

To list packages in a repository, run the following command:

gcloud artifacts packages list [--repository=REPOSITORY] [--location=LOCATION]

Replace the following:

  • REPOSITORY is the name of the repository. If you configured a default repository, you can omit this flag to use the default.
  • LOCATION is the regional or multi-regional location of the repository. If you configured a default location, then you can omit this flag to use the default.

To view versions of a package, run the following command:

gcloud artifacts versions list --package=PACKAGE \
    [--repository=REPOSITORY] [--location=LOCATION]

Replace the following:

  • PACKAGE is the ID of the package or fully qualified identifier for the package.
  • REPOSITORY is the name of the repository. If you configured a default repository, then you can omit this flag to use the default.
  • LOCATION is the regional or multi-regional location of the repository. Use this flag to view repositories in a specific location. If you configured a default location, then you can omit this flag to use the default.

패키지 설치

저장소 모드: 표준, 원격(미리보기)

패키지를 설치하기 전에 Artifact Registry 저장소에서 패키지를 설치하도록 VM을 구성했는지 확인합니다.

패키지를 설치하려면 다음 명령어를 실행합니다.

sudo yum --enablerepo=REPOSITORY install PACKAGE

다음 값을 바꿉니다.

  • PACKAGE는 패키지 이름입니다.
  • REPOSITORY.repo 파일에 구성된 저장소의 이름입니다.

예를 들어 my-repo 저장소에서 my-package 패키지를 설치하려면 다음 명령어를 실행합니다.

sudo yum --enablerepo=my-repo install my-package

패키지 삭제

저장소 모드: 표준

Before you delete a package or package version, verify that any you have communicated or addressed any important dependencies on it.

To delete a package:

Console

  1. Open the Repositories page in the Google Cloud console.

    저장소 페이지 열기

  2. In the repository list, click the appropriate repository.

    The Packages page lists the packages in the repository.

  3. Select the package that you want to delete.

  4. Click DELETE.

  5. In the confirmation dialog box, click DELETE.

gcloud

Run the following command:

gcloud artifacts packages delete PACKAGE \
    [--repository=REPOSITORY] [--location=LOCATION] [--async]

Replace the following:

  • PACKAGE is the name of the package in the repository.
  • REPOSITORY is the name of the repository. If you configured a default repository, then you can omit this flag to use the default.
  • LOCATION is the regional or multi-regional location of the repository. Use this flag to view repositories in a specific location. If you configured a default location, then you can omit this flag to use the default.

The --async flag causes the command to return immediately, without waiting for the operation in progress to complete.

To delete versions of a package:

Console

  1. Open the Repositories page in the Google Cloud console.

    저장소 페이지 열기

  2. In the repository list, click the appropriate repository.

    The Packages page lists the packages in the repository.

  3. Click a package to view versions of that package.

  4. Select versions that you want to delete.

  5. Click DELETE.

  6. In the confirmation dialog box, click DELETE.

gcloud

Run the following command:

gcloud artifacts versions delete VERSION \
    --package=PACKAGE \
    [--repository=REPOSITORY] [--location=LOCATION] \
    [--async]

Replace the following:

  • VERSION is the name of the version to delete.
  • PACKAGE is the name of the package in the repository.
  • REPOSITORY is the name of the repository. If you configured a default repository, then you can omit this flag to use the default.
  • LOCATION is the regional or multi-regional location of the repository. Use this flag to view repositories in a specific location. If you configured a default location, then you can omit this flag to use the default.

The --async flag causes the command to return immediately, without waiting for the operation in progress to complete.

대규모 저장소의 경우 삭제를 반영하도록 Yum 패키지 색인을 다시 생성하는 데 몇 분 정도 걸릴 수 있습니다.

다음 단계