code.gitea.io/gitea@v1.22.3/docs/content/usage/packages/debian.en-us.md (about)

     1  ---
     2  date: "2023-01-07T00:00:00+00:00"
     3  title: "Debian Package Registry"
     4  slug: "debian"
     5  draft: false
     6  toc: false
     7  menu:
     8    sidebar:
     9      parent: "packages"
    10      name: "Debian"
    11      sidebar_position: 35
    12      identifier: "debian"
    13  ---
    14  
    15  # Debian Package Registry
    16  
    17  Publish [Debian](https://www.debian.org/distrib/packages) packages for your user or organization.
    18  
    19  ## Requirements
    20  
    21  To work with the Debian registry, you need to use a HTTP client like `curl` to upload and a package manager like `apt` to consume packages.
    22  
    23  The following examples use `apt`.
    24  
    25  ## Configuring the package registry
    26  
    27  To register the Debian registry add the url to the list of known apt sources:
    28  
    29  ```shell
    30  echo "deb [signed-by=/etc/apt/keyrings/gitea-{owner}.asc] https://gitea.example.com/api/packages/{owner}/debian {distribution} {component}" | sudo tee -a /etc/apt/sources.list.d/gitea.list
    31  ```
    32  
    33  | Placeholder    | Description |
    34  | -------------- | ----------- |
    35  | `owner`        | The owner of the package. |
    36  | `distribution` | The distribution to use. |
    37  | `component`    | The component to use. |
    38  
    39  If the registry is private, provide credentials in the url. You can use a password or a [personal access token](development/api-usage.md#authentication):
    40  
    41  ```shell
    42  echo "deb [signed-by=/etc/apt/keyrings/gitea-{owner}.asc] https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/debian {distribution} {component}" | sudo tee -a /etc/apt/sources.list.d/gitea.list
    43  ```
    44  
    45  The Debian registry files are signed with a PGP key which must be known to apt:
    46  
    47  ```shell
    48  sudo curl https://gitea.example.com/api/packages/{owner}/debian/repository.key -o /etc/apt/keyrings/gitea-{owner}.asc
    49  ```
    50  
    51  Afterwards update the local package index:
    52  
    53  ```shell
    54  apt update
    55  ```
    56  
    57  ## Publish a package
    58  
    59  To publish a Debian package (`*.deb`), perform a HTTP `PUT` operation with the package content in the request body.
    60  
    61  ```
    62  PUT https://gitea.example.com/api/packages/{owner}/debian/pool/{distribution}/{component}/upload
    63  ```
    64  
    65  | Parameter      | Description |
    66  | -------------- | ----------- |
    67  | `owner`        | The owner of the package. |
    68  | `distribution` | The distribution may match the release name of the OS, ex: `bionic`. |
    69  | `component`    | The component can be used to group packages or just `main` or similar. |
    70  
    71  Example request using HTTP Basic authentication:
    72  
    73  ```shell
    74  curl --user your_username:your_password_or_token \
    75       --upload-file path/to/file.deb \
    76       https://gitea.example.com/api/packages/testuser/debian/pool/bionic/main/upload
    77  ```
    78  
    79  If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
    80  
    81  You cannot publish a package if a package of the same name, version, distribution, component and architecture already exists. You must delete the existing package first.
    82  
    83  The server responds with the following HTTP Status codes.
    84  
    85  | HTTP Status Code  | Meaning |
    86  | ----------------- | ------- |
    87  | `201 Created`     | The package has been published. |
    88  | `400 Bad Request` | The package is invalid. |
    89  | `409 Conflict`    | A package file with the same combination of parameters exists already. |
    90  
    91  ## Delete a package
    92  
    93  To delete a Debian package perform a HTTP `DELETE` operation. This will delete the package version too if there is no file left.
    94  
    95  ```
    96  DELETE https://gitea.example.com/api/packages/{owner}/debian/pool/{distribution}/{component}/{package_name}/{package_version}/{architecture}
    97  ```
    98  
    99  | Parameter         | Description |
   100  | ----------------- | ----------- |
   101  | `owner`           | The owner of the package. |
   102  | `package_name`    | The package name. |
   103  | `package_version` | The package version. |
   104  | `distribution`    | The package distribution. |
   105  | `component`       | The package component. |
   106  | `architecture`    | The package architecture. |
   107  
   108  Example request using HTTP Basic authentication:
   109  
   110  ```shell
   111  curl --user your_username:your_token_or_password -X DELETE \
   112       https://gitea.example.com/api/packages/testuser/debian/pools/bionic/main/test-package/1.0.0/amd64
   113  ```
   114  
   115  The server responds with the following HTTP Status codes.
   116  
   117  | HTTP Status Code  | Meaning |
   118  | ----------------- | ------- |
   119  | `204 No Content`  | Success |
   120  | `404 Not Found`   | The package or file was not found. |
   121  
   122  ## Install a package
   123  
   124  To install a package from the Debian registry, execute the following commands:
   125  
   126  ```shell
   127  # use latest version
   128  apt install {package_name}
   129  # use specific version
   130  apt install {package_name}={package_version}
   131  ```