Cette page décrit comment ajouter, afficher et supprimer des packages RPM dans des dépôts Yum. Les dépôts Yum Artifact Registry sont compatibles avec Yum et DNF.
Avant de commencer
- Si le dépôt Yum cible n'existe pas, créez-en un.
- Configurez les VM pour qu'elles puissent accéder au dépôt.
- (Facultatif) Configurez des valeurs par défaut pour les commandes gcloud.
- Assurez-vous que les noms de vos packages dans les métadonnées respectent les consignes de nommage des packages Fedora et les consignes de gestion des versions des packages Fedora.
Ajouter des packages
Modes de dépôt: standard
Vous devez disposer des autorisations de lecture et d'écriture pour le dépôt afin d'y ajouter des packages.
Vous pouvez importer un package dans un dépôt à l'aide de Google Cloud CLI ou importer un package stocké dans Cloud Storage.
Les opérations d'importation ou d'importation très longues peuvent dépasser la période d'expiration du jeton que gcloud CLI utilise pour appeler l'API. Si vous devez ajouter un très grand nombre de packages, envisagez de les ajouter par lots plus petits afin que chaque opération d'importation ou d'importation puisse s'effectuer plus rapidement. Pour en savoir plus, consultez la documentation sur le dépannage des packages de système d'exploitation.
Importation directe
Utilisez la
gcloud artifacts yum upload commande
pour importer un package dans un dépôt Yum :
gcloud artifacts yum upload REPOSITORY \
--location=LOCATION \
--source=PACKAGES
Remplacez les valeurs suivantes :
REPOSITORYcorrespond au nom du dépôt Artifact Registry.-
LOCATIONcorrespond à l'emplacement régional du dépôt. PACKAGEScorrespond au chemin d'accès au package.
Par exemple, pour importer le package my-package.rpm dans le dépôt Yum
my-repo à l'emplacement u-france-east1, exécutez la commande suivante :
gcloud artifacts yum upload my-repo \
--location=u-france-east1 \
--source=my-package.rpm
Cloud Storage
- Importez les packages directement dans un bucket Cloud Storage.
- Exécutez la commande suivante :
gcloud artifacts yum import REPOSITORY \ --location=LOCATION \ --gcs-source=PACKAGES
Remplacez les valeurs suivantes :
REPOSITORYcorrespond au nom du dépôt Artifact Registry.-
LOCATIONcorrespond à l'emplacement régional du dépôt. PACKAGEScorrespond à une liste de packages séparés par des virgules dans Cloud Storage. Pour importer tous les packages d'un répertoire, utilisez un caractère générique de répertoire (*) ou utilisez un caractère générique de répertoire récursif (**) pour importer tous les packages de tous les sous-répertoires.
Par exemple, la commande suivante importe le package
package.rpmet tous les packages du répertoiredirectorydu bucketmy-bucketdans le dépôt Yummy-repoà l'emplacementu-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*
Une fois l'opération d'importation ou d'importation terminée, vous pouvez utiliser la Cloud de Confiance console ou gcloud CLI pour afficher les packages dans le dépôt et vérifier qu'ils ont bien été importés.
Si vous disposez d'un grand dépôt contenant de nombreux packages, la régénération de l'index des packages peut prendre plusieurs minutes afin que les nouveaux packages soient visibles pour le client Yum.
Afficher les packages
Modes de dépôt: standard
Pour afficher les packages, vous devez disposer des autorisations du rôle Lecteur Artifact Registry. Artifact Registry ne répertorie pas les fichiers à l'intérieur des packages.
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.
Installer des packages
Modes de dépôt: standard
Avant d'installer des packages, vérifiez que vous avez configuré la VM pour installer des packages à partir de votre dépôt Artifact Registry.
Pour installer un package, exécutez la commande suivante :
sudo yum --enablerepo=REPOSITORY install PACKAGE
Remplacez les valeurs suivantes :
PACKAGEcorrespond au nom du package.REPOSITORYcorrespond au nom du dépôt configuré dans le fichier.repo.
Par exemple, pour installer le package my-package à partir du dépôt my-repo, exécutez la commande suivante :
sudo yum --enablerepo=my-repo install my-package
Supprimer des packages
Modes de dépôt: standard
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.
Pour les grands dépôts, la régénération de l'index des packages Yum peut prendre quelques minutes pour refléter les suppressions.