En esta página, se describe cómo agregar, ver y borrar paquetes de Debian en repositorios de Apt.
Antes de comenzar
- Si el repositorio de Apt de destino no existe, crea uno nuevo.
- Configura las VMs para acceder al repositorio.
- (Opcional) Configura valores predeterminados para los comandos de gcloud.
- Asegúrate de que los nombres de tus paquetes en los metadatos cumplan con los estándares de nombres de paquetes de Debian.
Agrega paquetes
Modos de repositorio: estándar
Debes tener permisos de lectura y escritura para el repositorio para agregar paquetes.
Puedes subir un paquete a un repositorio con Google Cloud CLI o importar un paquete almacenado en Cloud Storage. Si compilas paquetes con Cloud Build, la compilación puede almacenarlos en Cloud Storage para que los importes.
Las operaciones de importación o carga muy largas pueden exceder el período de vencimiento del token que usa gcloud CLI para llamar a la API. Si tienes una gran cantidad de paquetes para agregar, considera agregarlos en lotes más pequeños para que cada operación de carga o importación pueda completarse en un período más corto. Consulta la documentación de solución de problemas de paquetes del SO para obtener más información.
Carga directa
Usa el
gcloud artifacts apt upload comando
para subir un paquete a un repositorio de Apt:
gcloud artifacts apt upload REPOSITORY \
--location=LOCATION \
--source=PACKAGES
Reemplaza los siguientes valores:
REPOSITORYes el nombre del repositorio de Artifact Registry.-
LOCATIONes la ubicación regional del repositorio. PACKAGESes la ruta de acceso al paquete.
Por ejemplo, para subir el paquete my-package.deb al repositorio de Apt
my-repo en la ubicación u-france-east1, ejecuta lo siguiente:
gcloud artifacts apt upload my-repo \
--location=u-france-east1 \
--source=my-package.deb
Cloud Storage
- Para subir los paquetes a Cloud Storage, haz lo siguiente:
- Sube paquetes directamente a un bucket de Cloud Storage.
- Ejecuta el siguiente comando:
gcloud artifacts apt import REPOSITORY \ --location=LOCATION \ --gcs-source=PACKAGES
Reemplaza los siguientes valores:
REPOSITORYes el nombre del repositorio de Artifact Registry.-
LOCATIONes la ubicación regional del repositorio. PACKAGESes una lista de paquetes separados por comas en Cloud Storage. Para subir todos los paquetes de un directorio, usa un comodín de directorio (*) o usa un comodín de directorio recursivo (**) para subir todos los paquetes en todos los subdirectorios.
Por ejemplo, para subir el paquete
package.deby todos los paquetes del directoriodirectorydel bucketmy-bucketal repositorio de Aptmy-repoen la ubicaciónu-france-east1, ejecuta lo siguiente:gcloud artifacts apt import my-repo \ --location=u-france-east1 \ --gcs-source=gs://my-bucket/path/to/package.deb,gs://my-bucket/directory*
Cuando se complete la operación de carga o importación, puedes usar la Cloud de Confiance consola o gcloud CLI para ver paquetes en el repositorio y confirmar que se subieron correctamente.
Si tienes un repositorio grande con muchos paquetes, es posible que tarde varios minutos en volver a generar el índice de paquetes para que los paquetes nuevos sean visibles para el cliente de Apt.
Visualiza paquetes
Modos de repositorio: estándarPara ver los paquetes, debes tener los permisos en el rol de lector de Artifact Registry . Artifact Registry no muestra los archivos dentro de los paquetes.
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.
Instala paquetes
Modos de repositorio: estándarAntes de instalar paquetes, verifica que hayas configurado correctamente el administrador de paquetes y el repositorio.
Para instalar un paquete en el repositorio, haz lo siguiente:
Actualiza la lista de paquetes disponibles:
sudo apt updateInstala el paquete y especifica el nombre del repositorio configurado en Apt.
sudo apt install PACKAGE/REPOSITORYReemplaza los siguientes valores:
PACKAGEes el nombre del paquete.REPOSITORYes el nombre del repositorio de Artifact Registry.
Por ejemplo, para instalar el paquete
my-packagedel repositoriomy-repo, ejecuta el siguiente comando:sudo apt install my-package -t my-repo
Borra paquetes
Modos de repositorio: estándar
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.
En el caso de los repositorios grandes, puede tardar unos minutos en volver a generar el índice de paquetes de Apt para reflejar las eliminaciones.