Halaman ini menjelaskan cara menambahkan, melihat, dan menghapus paket RPM di repositori Yum. Repositori Yum Artifact Registry mendukung Yum dan DNF.
Sebelum memulai
- Jika repositori Yum target tidak ada, buat repositori baru.
- Konfigurasi VM untuk mengakses repositori.
- (Opsional) Konfigurasi default untuk perintah gcloud.
- Pastikan nama paket Anda dalam metadata memenuhi panduan penamaan paket Fedora dan panduan pembuatan versi paket Fedora.
Menambahkan paket
Mode repositori: standar
Anda harus memiliki izin baca dan tulis untuk repositori agar dapat menambahkan paket.
Anda dapat mengupload paket ke repositori menggunakan Google Cloud CLI, atau Anda dapat mengimpor paket yang disimpan di Cloud Storage.
Operasi impor atau upload yang sangat panjang mungkin melebihi periode masa berlaku untuk token yang digunakan gcloud CLI untuk memanggil API. Jika Anda memiliki paket yang sangat banyak untuk ditambahkan, sebaiknya tambahkan paket dalam batch yang lebih kecil sehingga setiap operasi upload atau impor dapat diselesaikan dalam waktu yang lebih singkat. Lihat dokumentasi pemecahan masalah paket OS untuk mengetahui informasi selengkapnya.
Upload langsung
Gunakan
gcloud artifacts yum upload perintah
untuk mengupload paket ke repositori Yum:
gcloud artifacts yum upload REPOSITORY \
--location=LOCATION \
--source=PACKAGES
Ganti nilai berikut:
REPOSITORYadalah nama repositori Artifact Registry.-
LOCATIONadalah lokasi regional repositori. PACKAGESadalah jalur ke paket.
Misalnya, untuk mengupload paket my-package.rpm ke repositori Yum
my-repo di lokasi u-france-east1, jalankan:
gcloud artifacts yum upload my-repo \
--location=u-france-east1 \
--source=my-package.rpm
Cloud Storage
- Unggah paket langsung ke bucket Cloud Storage.
- Jalankan perintah berikut:
gcloud artifacts yum import REPOSITORY \ --location=LOCATION \ --gcs-source=PACKAGES
Ganti nilai berikut:
REPOSITORYadalah nama repositori Artifact Registry.-
LOCATIONadalah lokasi regional repositori. PACKAGESadalah daftar paket yang dipisahkan koma di Cloud Storage. Untuk mengupload semua paket dari direktori, gunakan karakter pengganti direktori (*) atau gunakan karakter pengganti direktori rekursif (**) untuk mengupload semua paket di semua subdirektori.
Misalnya, perintah berikut mengupload paket
package.rpmdan semua paket di direktoridirectorydari bucketmy-bucketke repositori Yummy-repodi lokasiu-france-east1:gcloud artifacts yum import my-repo \ --location=u-france-east1 \ --gcs-source=gs://my-bucket/path/to/package.rpm,gs://my-bucket/directory*
Setelah operasi upload atau impor selesai, Anda dapat menggunakan Cloud de Confiance konsol atau gcloud CLI untuk melihat paket di repositori dan mengonfirmasi bahwa paket berhasil diupload.
Jika Anda memiliki repositori besar dengan banyak paket, mungkin perlu waktu beberapa menit untuk membuat ulang indeks paket sehingga paket baru dapat dilihat oleh klien Yum.
Melihat paket
Mode repositori: standar
Untuk melihat paket, Anda harus memiliki izin dalam peran Pembaca Artifact Registry. Artifact Registry tidak mencantumkan file di dalam paket.
To view packages and package versions using the Cloud de Confiance console
or gcloud:
Console
Open the Repositories page in the Cloud de Confiance console.
In the repository list, click the appropriate repository.
The Packages page lists the packages in the repository.
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:
REPOSITORYis the name of the repository. If you configured a default repository, you can omit this flag to use the default.-
LOCATIONis the 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:
PACKAGEis the ID of the package or fully qualified identifier for the package.REPOSITORYis the name of the repository. If you configured a default repository, then you can omit this flag to use the default.-
LOCATIONis the 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.
Menginstal paket
Mode repositori: standar
Sebelum menginstal paket, pastikan Anda telah mengonfigurasi VM untuk menginstal paket dari repositori Artifact Registry.
Untuk menginstal paket, jalankan perintah berikut:
sudo yum --enablerepo=REPOSITORY install PACKAGE
Ganti nilai berikut:
PACKAGEadalah nama paketREPOSITORYadalah nama repositori yang dikonfigurasi dalam file.repo.
Misalnya, untuk menginstal paket my-package dari repositori my-repo, jalankan perintah:
sudo yum --enablerepo=my-repo install my-package
Menghapus paket
Mode repositori: standar
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
Open the Repositories page in the Cloud de Confiance console.
In the repository list, click the appropriate repository.
The Packages page lists the packages in the repository.
Select the package that you want to delete.
Click DELETE.
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:
PACKAGEis the name of the package in the repository.REPOSITORYis the name of the repository. If you configured a default repository, then you can omit this flag to use the default.-
LOCATIONis the 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
Open the Repositories page in the Cloud de Confiance console.
In the repository list, click the appropriate repository.
The Packages page lists the packages in the repository.
Click a package to view versions of that package.
Select versions that you want to delete.
Click DELETE.
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:
VERSIONis the name of the version to delete.PACKAGEis the name of the package in the repository.REPOSITORYis the name of the repository. If you configured a default repository, then you can omit this flag to use the default.-
LOCATIONis the 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.
Untuk repositori besar, mungkin perlu waktu beberapa menit untuk membuat ulang indeks paket Yum agar penghapusan dapat ditampilkan.