code.gitea.io/gitea@v1.22.3/docs/content/usage/packages/vagrant.zh-cn.md (about)

     1  ---
     2  date: "2022-08-23T00:00:00+00:00"
     3  title: "Vagrant 软件包注册表"
     4  slug: "vagrant"
     5  sidebar_position: 120
     6  draft: false
     7  toc: false
     8  menu:
     9    sidebar:
    10      parent: "packages"
    11      name: "Vagrant"
    12      sidebar_position: 120
    13      identifier: "vagrant"
    14  ---
    15  
    16  # Vagrant 软件包注册表
    17  
    18  为您的用户或组织发布 [Vagrant](https://www.vagrantup.com/) 软件包。
    19  
    20  ## 要求
    21  
    22  要使用 Vagrant 软件包注册表,您需要安装 [Vagrant](https://www.vagrantup.com/downloads) 并使用类似于 `curl` 的工具进行 HTTP 请求。
    23  
    24  ## 发布软件包
    25  
    26  通过执行 HTTP PUT 请求将 Vagrant box 发布到注册表:
    27  
    28  ```
    29  PUT https://gitea.example.com/api/packages/{owner}/vagrant/{package_name}/{package_version}/{provider}.box
    30  ```
    31  
    32  | 参数              | 描述                                                               |
    33  | ----------------- | ------------------------------------------------------------------ |
    34  | `owner`           | 软件包的所有者                                                     |
    35  | `package_name`    | 软件包的名称                                                       |
    36  | `package_version` | 软件包的版本,兼容 semver 格式                                     |
    37  | `provider`        | [支持的提供程序名称](https://www.vagrantup.com/docs/providers)之一 |
    38  
    39  上传 Hyper-V box 的示例:
    40  
    41  ```shell
    42  curl --user your_username:your_password_or_token \
    43       --upload-file path/to/your/vagrant.box \
    44       https://gitea.example.com/api/packages/testuser/vagrant/test_system/1.0.0/hyperv.box
    45  ```
    46  
    47  如果已经存在相同名称、版本和提供程序的软件包,则无法发布软件包。您必须首先删除现有的软件包。
    48  
    49  ## 安装软件包
    50  
    51  要从软件包注册表安装软件包,请执行以下命令:
    52  
    53  ```shell
    54  vagrant box add "https://gitea.example.com/api/packages/{owner}/vagrant/{package_name}"
    55  ```
    56  
    57  | 参数           | 描述            |
    58  | -------------- | --------------- |
    59  | `owner`        | 软件包的所有者. |
    60  | `package_name` | 软件包的名称    |
    61  
    62  例如:
    63  
    64  ```shell
    65  vagrant box add "https://gitea.example.com/api/packages/testuser/vagrant/test_system"
    66  ```
    67  
    68  这将安装软件包的最新版本。要添加特定版本,请使用` --box-version` 参数。
    69  如果注册表是私有的,您可以将您的[个人访问令牌](development/api-usage.md#通过-api-认证)传递给 `VAGRANT_CLOUD_TOKEN` 环境变量。
    70  
    71  ## 支持的命令
    72  
    73  ```
    74  vagrant box add
    75  ```