mirror of
https://gitea.com/gitea/docs.git
synced 2026-07-22 12:37:42 +00:00
Update zh tw languages and fix some broken links (#455)
--------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <2021+silverwind@noreply.gitea.com> Reviewed-on: https://gitea.com/gitea/docs/pulls/455 Reviewed-by: silverwind <2021+silverwind@noreply.gitea.com>
This commit is contained in:
@@ -3,51 +3,51 @@ date: "2023-01-07T00:00:00+00:00"
|
||||
slug: "debian"
|
||||
---
|
||||
|
||||
# Debian 軟體包註冊表
|
||||
# Debian 套件註冊表
|
||||
|
||||
為您的使用者或組織發佈 [Debian](https://www.debian.org/distrib/packages) 軟體包。
|
||||
為您的使用者或組織發佈 [Debian](https://www.debian.org/distrib/packages) 套件。
|
||||
|
||||
## 要求
|
||||
|
||||
要使用 Debian 註冊表,您需要使用类似于 `curl` 的 HTTP 客户端進行上传,並使用类似于 `apt` 的軟體包管理器消费軟體包。
|
||||
要使用 Debian 註冊表,您需要使用類似於 `curl` 的 HTTP 客戶端進行上傳,並使用類似於 `apt` 的套件管理器消費套件。
|
||||
|
||||
以下示例使用 `apt`。
|
||||
以下範例使用 `apt`。
|
||||
|
||||
## 配置軟體包註冊表
|
||||
## 設定套件註冊表
|
||||
|
||||
要注册 Debian 註冊表,請将 URL 添加到已知 `apt` 源列表中:
|
||||
要註冊 Debian 註冊表,請將 URL 添加到已知 `apt` 源列表中:
|
||||
|
||||
```shell
|
||||
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
|
||||
```
|
||||
|
||||
| 占位符 | 描述 |
|
||||
| 佔位符 | 描述 |
|
||||
| -------------- | -------------- |
|
||||
| `owner` | 軟體包的所有者 |
|
||||
| `distribution` | 要使用的发行版 |
|
||||
| `component` | 要使用的组件 |
|
||||
| `owner` | 套件的所有者 |
|
||||
| `distribution` | 要使用的發行版 |
|
||||
| `component` | 要使用的元件 |
|
||||
|
||||
如果註冊表是私有的,請在 URL 中提供凭据。您可以使用密碼或[个人访问令牌](development/api-usage.md#通過-api-認證):
|
||||
如果註冊表是私有的,請在 URL 中提供憑據。您可以使用密碼或[個人存取權杖](development/api-usage.md#透過-api-認證):
|
||||
|
||||
```shell
|
||||
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
|
||||
```
|
||||
|
||||
Debian 註冊表文件使用 PGP 密钥進行签名,`apt` 必須知道該密钥:
|
||||
Debian 註冊表文件使用 PGP 密鑰進行簽名,`apt` 必須知道該密鑰:
|
||||
|
||||
```shell
|
||||
sudo curl https://gitea.example.com/api/packages/{owner}/debian/repository.key -o /etc/apt/keyrings/gitea-{owner}.asc
|
||||
```
|
||||
|
||||
然后更新本地軟體包索引:
|
||||
然後更新本地套件索引:
|
||||
|
||||
```shell
|
||||
apt update
|
||||
```
|
||||
|
||||
## 發佈軟體包
|
||||
## 發佈套件
|
||||
|
||||
要發佈一个 Debian 軟體包(`*.deb`),執行 HTTP `PUT` 操作,並将軟體包内容放入請求主體中。
|
||||
要發佈一個 Debian 套件(`*.deb`),執行 HTTP `PUT` 操作,並將套件內容放入請求主體中。
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/debian/pool/{distribution}/{component}/upload
|
||||
@@ -55,11 +55,11 @@ PUT https://gitea.example.com/api/packages/{owner}/debian/pool/{distribution}/{c
|
||||
|
||||
| 參數 | 描述 |
|
||||
| -------------- | ----------------------------------------------------- |
|
||||
| `owner` | 軟體包的所有者 |
|
||||
| `distribution` | 发行版,可能与操作系统的发行版名稱匹配,例如 `bionic` |
|
||||
| `component` | 组件,可用于分组軟體包,或僅為 `main` 或类似的组件。 |
|
||||
| `owner` | 套件的所有者 |
|
||||
| `distribution` | 發行版,可能與操作系統的發行版名稱匹配,例如 `bionic` |
|
||||
| `component` | 元件,可用於分組套件,或僅為 `main` 或類似的元件。 |
|
||||
|
||||
使用 HTTP 基本身份驗證的示例請求:
|
||||
使用 HTTP 基本身份驗證的範例請求:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
@@ -67,20 +67,20 @@ curl --user your_username:your_password_or_token \
|
||||
https://gitea.example.com/api/packages/testuser/debian/pool/bionic/main/upload
|
||||
```
|
||||
|
||||
如果您使用 2FA 或 OAuth,請使用[个人访问令牌](development/api-usage.md#通過-api-認證)替代密碼。
|
||||
您無法向軟體包中多次發佈具有相同名稱的文件。您必須首先删除現有的軟體包版本。
|
||||
如果您使用 2FA 或 OAuth,請使用[個人存取權杖](development/api-usage.md#透過-api-認證)替代密碼。
|
||||
您無法向套件中多次發佈具有相同名稱的文件。您必須首先刪除現有的套件版本。
|
||||
|
||||
服务器将使用以下 HTTP 状态代码進行響應。
|
||||
伺服器將使用以下 HTTP 狀態程式碼進行響應。
|
||||
|
||||
| HTTP 状态码 | 意义 |
|
||||
| HTTP 狀態碼 | 意義 |
|
||||
| ----------------- | ---------------------------------------- |
|
||||
| `201 Created` | 軟體包已發佈 |
|
||||
| `400 Bad Request` | 軟體包名稱、版本、发行版、组件或架构無效 |
|
||||
| `409 Conflict` | 具有相同參數组合的軟體包文件已经存在 |
|
||||
| `201 Created` | 套件已發佈 |
|
||||
| `400 Bad Request` | 套件名稱、版本、發行版、元件或架構無效 |
|
||||
| `409 Conflict` | 具有相同參數組合的套件文件已經存在 |
|
||||
|
||||
## 删除軟體包
|
||||
## 刪除套件
|
||||
|
||||
要删除 Debian 軟體包,請執行 HTTP `DELETE` 操作。如果没有文件留下,这将同时删除軟體包版本。
|
||||
要刪除 Debian 套件,請執行 HTTP `DELETE` 操作。如果沒有文件留下,這將同時刪除套件版本。
|
||||
|
||||
```
|
||||
DELETE https://gitea.example.com/api/packages/{owner}/debian/pool/{distribution}/{component}/{package_name}/{package_version}/{architecture}
|
||||
@@ -88,30 +88,30 @@ DELETE https://gitea.example.com/api/packages/{owner}/debian/pool/{distribution}
|
||||
|
||||
| 參數 | 描述 |
|
||||
| ----------------- | -------------- |
|
||||
| `owner` | 軟體包的所有者 |
|
||||
| `package_name` | 軟體包名稱 |
|
||||
| `package_version` | 軟體包版本 |
|
||||
| `distribution` | 軟體包发行版 |
|
||||
| `component` | 軟體包组件 |
|
||||
| `architecture` | 軟體包架构 |
|
||||
| `owner` | 套件的所有者 |
|
||||
| `package_name` | 套件名稱 |
|
||||
| `package_version` | 套件版本 |
|
||||
| `distribution` | 套件發行版 |
|
||||
| `component` | 套件元件 |
|
||||
| `architecture` | 套件架構 |
|
||||
|
||||
使用 HTTP 基本身份驗證的示例請求:
|
||||
使用 HTTP 基本身份驗證的範例請求:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_token_or_password -X DELETE \
|
||||
https://gitea.example.com/api/packages/testuser/debian/pools/bionic/main/test-package/1.0.0/amd64
|
||||
```
|
||||
|
||||
服务器将使用以下 HTTP 状态代码進行響應。
|
||||
伺服器將使用以下 HTTP 狀態程式碼進行響應。
|
||||
|
||||
| HTTP 状态码 | 含义 |
|
||||
| HTTP 狀態碼 | 含義 |
|
||||
| ---------------- | ------------------ |
|
||||
| `204 No Content` | 成功 |
|
||||
| `404 Not Found` | 找不到軟體包或文件 |
|
||||
| `404 Not Found` | 找不到套件或文件 |
|
||||
|
||||
## 安裝軟體包
|
||||
## 安裝套件
|
||||
|
||||
要从 Debian 註冊表安裝軟體包,請執行以下命令:
|
||||
要從 Debian 註冊表安裝套件,請執行以下命令:
|
||||
|
||||
```shell
|
||||
# use latest version
|
||||
|
||||
Reference in New Issue
Block a user