code.gitea.io/gitea@v1.22.3/docs/content/usage/packages/rpm.en-us.md (about) 1 --- 2 date: "2023-03-08T00:00:00+00:00" 3 title: "RPM Package Registry" 4 slug: "rpm" 5 draft: false 6 toc: false 7 menu: 8 sidebar: 9 parent: "packages" 10 name: "RPM" 11 sidebar_position: 105 12 identifier: "rpm" 13 --- 14 15 # RPM Package Registry 16 17 Publish [RPM](https://rpm.org/) packages for your user or organization. 18 19 ## Requirements 20 21 To work with the RPM registry, you need to use a package manager like `yum`, `dnf` or `zypper` to consume packages. 22 23 The following examples use `dnf`. 24 25 ## Configuring the package registry 26 27 To register the RPM registry add the url to the list of known sources: 28 29 ```shell 30 dnf config-manager --add-repo https://gitea.example.com/api/packages/{owner}/rpm/{group}.repo 31 ``` 32 33 | Placeholder | Description | 34 | ----------- | ----------- | 35 | `owner` | The owner of the package. | 36 | `group` | Optional: Everything, e.g. empty, `el7`, `rocky/el9`, `test/fc38`. | 37 38 Example: 39 40 ```shell 41 # without a group 42 dnf config-manager --add-repo https://gitea.example.com/api/packages/testuser/rpm.repo 43 44 # with the group 'centos/el7' 45 dnf config-manager --add-repo https://gitea.example.com/api/packages/testuser/rpm/centos/el7.repo 46 ``` 47 48 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): 49 50 ```shell 51 dnf config-manager --add-repo https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/rpm/{group}.repo 52 ``` 53 54 You have to add the credentials to the urls in the created `.repo` file in `/etc/yum.repos.d` too. 55 56 ## Publish a package 57 58 To publish a RPM package (`*.rpm`), perform a HTTP PUT operation with the package content in the request body. 59 60 ``` 61 PUT https://gitea.example.com/api/packages/{owner}/rpm/{group}/upload 62 ``` 63 64 | Parameter | Description | 65 | --------- | ----------- | 66 | `owner` | The owner of the package. | 67 | `group` | Optional: Everything, e.g. empty, `el7`, `rocky/el9`, `test/fc38`. | 68 69 Example request using HTTP Basic authentication: 70 71 ```shell 72 # without a group 73 curl --user your_username:your_password_or_token \ 74 --upload-file path/to/file.rpm \ 75 https://gitea.example.com/api/packages/testuser/rpm/upload 76 77 # with the group 'centos/el7' 78 curl --user your_username:your_password_or_token \ 79 --upload-file path/to/file.rpm \ 80 https://gitea.example.com/api/packages/testuser/rpm/centos/el7/upload 81 ``` 82 83 If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. 84 You cannot publish a file with the same name twice to a package. You must delete the existing package version first. 85 86 The server responds with the following HTTP Status codes. 87 88 | HTTP Status Code | Meaning | 89 | ----------------- | ------- | 90 | `201 Created` | The package has been published. | 91 | `400 Bad Request` | The package is invalid. | 92 | `409 Conflict` | A package file with the same combination of parameters exist already in the package. | 93 94 ## Delete a package 95 96 To delete an RPM package perform a HTTP DELETE operation. This will delete the package version too if there is no file left. 97 98 ``` 99 DELETE https://gitea.example.com/api/packages/{owner}/rpm/{group}/package/{package_name}/{package_version}/{architecture} 100 ``` 101 102 | Parameter | Description | 103 | ----------------- | ----------- | 104 | `owner` | The owner of the package. | 105 | `group` | Optional: The package group. | 106 | `package_name` | The package name. | 107 | `package_version` | The package version. | 108 | `architecture` | The package architecture. | 109 110 Example request using HTTP Basic authentication: 111 112 ```shell 113 # without a group 114 curl --user your_username:your_token_or_password -X DELETE \ 115 https://gitea.example.com/api/packages/testuser/rpm/package/test-package/1.0.0/x86_64 116 117 # with the group 'centos/el7' 118 curl --user your_username:your_token_or_password -X DELETE \ 119 https://gitea.example.com/api/packages/testuser/rpm/centos/el7/package/test-package/1.0.0/x86_64 120 ``` 121 122 The server responds with the following HTTP Status codes. 123 124 | HTTP Status Code | Meaning | 125 | ----------------- | ------- | 126 | `204 No Content` | Success | 127 | `404 Not Found` | The package or file was not found. | 128 129 ## Install a package 130 131 To install a package from the RPM registry, execute the following commands: 132 133 ```shell 134 # use latest version 135 dnf install {package_name} 136 # use specific version 137 dnf install {package_name}-{package_version}.{architecture} 138 ```