|
| 1 | +# Configuring Multiple Package Repositories |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The OS Image Composer supports adding multiple custom package repositories to your image builds through the `packageRepositories` section in image template files. This feature allows you to include packages from additional repositories beyond the default OS repositories, enabling you to integrate specialized software, proprietary packages, or packages from specific vendors into your custom images. |
| 6 | + |
| 7 | +## How It Works |
| 8 | + |
| 9 | +Package repositories are configured during the image build process and are added to the package manager configuration before any packages are installed. This ensures that packages from custom repositories are available during the package installation phase, allowing you to install packages from multiple sources in a single build. |
| 10 | + |
| 11 | +## Configuration Structure |
| 12 | + |
| 13 | +The `packageRepositories` section should be placed at the root level of your image template YAML file, alongside other top-level configuration sections: |
| 14 | + |
| 15 | +```yaml |
| 16 | +image: |
| 17 | + name: your-image-name |
| 18 | + version: "1.0" |
| 19 | + |
| 20 | +target: |
| 21 | + os: ubuntu |
| 22 | + dist: ubuntu24 |
| 23 | + arch: x86_64 |
| 24 | + imageType: raw |
| 25 | + |
| 26 | +# Package repositories are configured before any other operations |
| 27 | +packageRepositories: |
| 28 | + - codename: "EdgeAI" |
| 29 | + url: "https://yum.repos.intel.com/edgeai/" |
| 30 | + pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg" |
| 31 | + |
| 32 | +disk: |
| 33 | + name: .... |
| 34 | + # .... other disk configuration |
| 35 | + |
| 36 | +systemConfig: |
| 37 | + name: .... |
| 38 | + packages: |
| 39 | + - ubuntu-minimal |
| 40 | + - edge-ai-package # This package comes from the EdgeAI repository |
| 41 | + # .... other packages |
| 42 | +``` |
| 43 | + |
| 44 | +## Repository Configuration Properties |
| 45 | + |
| 46 | +Each repository entry supports the following properties: |
| 47 | + |
| 48 | +- **codename** (required): A unique identifier for the repository |
| 49 | +- **url** (required): The base URL of the package repository |
| 50 | +- **pkey** (optional but recommended): URL to the GPG public key for repository authentication, or `[trusted=yes]` to bypass GPG verification |
| 51 | + |
| 52 | +## Complete Template Structure |
| 53 | + |
| 54 | +Here's how the packageRepositories section fits within a complete image template: |
| 55 | + |
| 56 | +```yaml |
| 57 | +image: |
| 58 | + name: multi-repo-image |
| 59 | + version: "1.0" |
| 60 | + |
| 61 | +target: |
| 62 | + os: ubuntu |
| 63 | + dist: ubuntu24 |
| 64 | + arch: x86_64 |
| 65 | + imageType: raw |
| 66 | + |
| 67 | +# Multiple package repositories configuration |
| 68 | +packageRepositories: |
| 69 | + - codename: "EdgeAI" |
| 70 | + url: "https://yum.repos.intel.com/edgeai/" |
| 71 | + pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg" |
| 72 | + |
| 73 | + - codename: "edge-base" |
| 74 | + url: "https://files-rs.edgeorchestration.intel.com/files-edge-orch/microvisor/rpms/3.0/base" |
| 75 | + pkey: "https://raw.githubusercontent.com/open-edge-platform/edge-microvisor-toolkit/refs/heads/3.0/SPECS/edge-repos/INTEL-RPM-GPG-KEY" |
| 76 | + |
| 77 | +disk: |
| 78 | + name: .... |
| 79 | + # .... disk configuration |
| 80 | + |
| 81 | +systemConfig: |
| 82 | + name: .... |
| 83 | + description: .... |
| 84 | + |
| 85 | + packages: |
| 86 | + - ubuntu-minimal |
| 87 | + - openvino-toolkit # From OpenVINO repository |
| 88 | + - edge-ai-runtime # From EdgeAI repository |
| 89 | + - microvisor-base # From edge-base repository |
| 90 | + # .... other packages from various repositories |
| 91 | + |
| 92 | + kernel: |
| 93 | + version: .... |
| 94 | + # .... kernel configuration |
| 95 | + |
| 96 | + configurations: |
| 97 | + # .... custom configurations |
| 98 | +``` |
| 99 | + |
| 100 | +## Real-World Example |
| 101 | + |
| 102 | +A comprehensive multi-repository configuration for edge computing and AI workloads: |
| 103 | + |
| 104 | +```yaml |
| 105 | +packageRepositories: |
| 106 | + - codename: "EdgeAI" |
| 107 | + url: "https://yum.repos.intel.com/edgeai/" |
| 108 | + pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg" |
| 109 | + |
| 110 | + - codename: "edge-base" |
| 111 | + url: "https://files-rs.edgeorchestration.intel.com/files-edge-orch/microvisor/rpms/3.0/base" |
| 112 | + pkey: "https://raw.githubusercontent.com/open-edge-platform/edge-microvisor-toolkit/refs/heads/3.0/SPECS/edge-repos/INTEL-RPM-GPG-KEY" |
| 113 | + |
| 114 | + - codename: "OpenVINO" |
| 115 | + url: "https://yum.repos.intel.com/openvino/" |
| 116 | + pkey: "https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" |
| 117 | + |
| 118 | + - codename: "mariner" |
| 119 | + url: "https://packages.microsoft.com/yumrepos/cbl-mariner-2.0-prod-extended-x86_64/" |
| 120 | + pkey: "https://packages.microsoft.com/azurelinux/3.0/prod/base/x86_64/repodata/repomd.xml.key" |
| 121 | +``` |
| 122 | +
|
| 123 | +## Repository Configuration Examples |
| 124 | +
|
| 125 | +### Intel Edge AI Stack |
| 126 | +
|
| 127 | +```yaml |
| 128 | +packageRepositories: |
| 129 | + - codename: "EdgeAI" |
| 130 | + url: "https://yum.repos.intel.com/edgeai/" |
| 131 | + pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg" |
| 132 | + |
| 133 | + - codename: "OpenVINO" |
| 134 | + url: "https://yum.repos.intel.com/openvino/" |
| 135 | + pkey: "https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" |
| 136 | + |
| 137 | +systemConfig: |
| 138 | + packages: |
| 139 | + - openvino-toolkit |
| 140 | + - edge-ai-runtime |
| 141 | + - intel-media-driver |
| 142 | + # .... |
| 143 | +``` |
| 144 | + |
| 145 | +### Microsoft and Intel Integration |
| 146 | + |
| 147 | +```yaml |
| 148 | +packageRepositories: |
| 149 | + - codename: "mariner" |
| 150 | + url: "https://packages.microsoft.com/yumrepos/cbl-mariner-2.0-prod-extended-x86_64/" |
| 151 | + pkey: "https://packages.microsoft.com/azurelinux/3.0/prod/base/x86_64/repodata/repomd.xml.key" |
| 152 | + |
| 153 | + - codename: "edge-base" |
| 154 | + url: "https://files-rs.edgeorchestration.intel.com/files-edge-orch/microvisor/rpms/3.0/base" |
| 155 | + pkey: "https://raw.githubusercontent.com/open-edge-platform/edge-microvisor-toolkit/refs/heads/3.0/SPECS/edge-repos/INTEL-RPM-GPG-KEY" |
| 156 | + |
| 157 | +systemConfig: |
| 158 | + packages: |
| 159 | + - mariner-base-packages |
| 160 | + - microvisor-runtime |
| 161 | + - edge-orchestration-tools |
| 162 | + # .... |
| 163 | +``` |
| 164 | + |
| 165 | +### Development Environment |
| 166 | + |
| 167 | +```yaml |
| 168 | +packageRepositories: |
| 169 | + - codename: "docker-ce" |
| 170 | + url: "https://download.docker.com/linux/ubuntu" |
| 171 | + pkey: "https://download.docker.com/linux/ubuntu/gpg" |
| 172 | + |
| 173 | + - codename: "nodejs" |
| 174 | + url: "https://deb.nodesource.com/node_18.x" |
| 175 | + pkey: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" |
| 176 | + |
| 177 | +systemConfig: |
| 178 | + packages: |
| 179 | + - docker-ce |
| 180 | + - docker-ce-cli |
| 181 | + - nodejs |
| 182 | + - npm |
| 183 | + # .... |
| 184 | +``` |
| 185 | + |
| 186 | +### Trusted Repository (No GPG Verification) |
| 187 | + |
| 188 | +```yaml |
| 189 | +packageRepositories: |
| 190 | + - codename: "internal-repo" |
| 191 | + url: "https://internal.company.com/packages" |
| 192 | + pkey: "[trusted=yes]" # Bypasses GPG verification |
| 193 | + |
| 194 | + - codename: "test-repo" |
| 195 | + url: "https://test.example.com/packages" |
| 196 | + pkey: "[trusted=yes]" # Use with caution - no signature verification |
| 197 | + |
| 198 | +systemConfig: |
| 199 | + packages: |
| 200 | + - internal-package |
| 201 | + - test-package |
| 202 | + # .... |
| 203 | +``` |
| 204 | + |
| 205 | +## Execution Process |
| 206 | + |
| 207 | +### Repository Setup Phase |
| 208 | + |
| 209 | +The build process follows this sequence when multiple repositories are configured: |
| 210 | + |
| 211 | +1. **Repository Configuration**: All repositories in `packageRepositories` are added to the package manager |
| 212 | +2. **GPG Key Import**: Public keys are downloaded and imported for repository authentication (skipped for `[trusted=yes]` repositories) |
| 213 | +3. **Repository Refresh**: Package lists are updated from all configured repositories |
| 214 | +4. **Package Installation**: Packages from all repositories become available for installation |
| 215 | + |
| 216 | +### Package Resolution |
| 217 | + |
| 218 | +When packages are installed: |
| 219 | + |
| 220 | +- The package manager searches all configured repositories |
| 221 | +- Dependencies can be resolved across multiple repositories |
| 222 | +- Repository priority may affect package selection when conflicts exist |
| 223 | + |
| 224 | +## Best Practices |
| 225 | + |
| 226 | +### 1. Always Include GPG Keys |
| 227 | + |
| 228 | +Include GPG keys for repository authentication and security: |
| 229 | + |
| 230 | +```yaml |
| 231 | +packageRepositories: |
| 232 | + # Good - includes GPG key for security |
| 233 | + - codename: "secure-repo" |
| 234 | + url: "https://example.com/packages" |
| 235 | + pkey: "https://example.com/gpg-key.pub" |
| 236 | + |
| 237 | + # Use trusted=yes only for internal/trusted repositories |
| 238 | + - codename: "internal-repo" |
| 239 | + url: "https://internal.company.com/packages" |
| 240 | + pkey: "[trusted=yes]" |
| 241 | + |
| 242 | + # Avoid - missing pkey entirely reduces security |
| 243 | + - codename: "insecure-repo" |
| 244 | + url: "https://example.com/packages" |
| 245 | +``` |
| 246 | +
|
| 247 | +### 2. Use Descriptive Codenames |
| 248 | +
|
| 249 | +Choose clear, descriptive codenames that indicate the repository purpose: |
| 250 | +
|
| 251 | +```yaml |
| 252 | +packageRepositories: |
| 253 | + # Good - descriptive codenames |
| 254 | + - codename: "EdgeAI" |
| 255 | + - codename: "OpenVINO" |
| 256 | + - codename: "docker-ce" |
| 257 | + |
| 258 | + # Avoid - unclear codenames |
| 259 | + - codename: "repo1" |
| 260 | + - codename: "custom" |
| 261 | +``` |
| 262 | +
|
| 263 | +### 3. Verify Repository URLs |
| 264 | +
|
| 265 | +Ensure repository URLs are correct and accessible: |
| 266 | +
|
| 267 | +```yaml |
| 268 | +packageRepositories: |
| 269 | + # Verify these URLs are accessible during build |
| 270 | + - codename: "EdgeAI" |
| 271 | + url: "https://yum.repos.intel.com/edgeai/" |
| 272 | + pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg" |
| 273 | +``` |
| 274 | +
|
| 275 | +### 4. Document Repository Sources |
| 276 | +
|
| 277 | +Add comments to document repository purposes: |
| 278 | +
|
| 279 | +```yaml |
| 280 | +packageRepositories: |
| 281 | + # Intel Edge AI packages for computer vision and inference |
| 282 | + - codename: "EdgeAI" |
| 283 | + url: "https://yum.repos.intel.com/edgeai/" |
| 284 | + pkey: "https://yum.repos.intel.com/edgeai/GPG-PUB-KEY-INTEL-DLS.gpg" |
| 285 | + |
| 286 | + # Microsoft CBL-Mariner extended packages |
| 287 | + - codename: "mariner" |
| 288 | + url: "https://packages.microsoft.com/yumrepos/cbl-mariner-2.0-prod-extended-x86_64/" |
| 289 | + pkey: "https://packages.microsoft.com/azurelinux/3.0/prod/base/x86_64/repodata/repomd.xml.key" |
| 290 | +``` |
| 291 | +
|
| 292 | +## Security Considerations |
| 293 | +
|
| 294 | +### Repository Trust |
| 295 | +
|
| 296 | +- Only add repositories from trusted sources |
| 297 | +- Always include GPG keys for repository authentication when available |
| 298 | +- Use `pkey: "[trusted=yes]"` only for internal or highly trusted repositories where GPG verification is not available or needed |
| 299 | +- Regularly review and update repository configurations |
| 300 | +- Be cautious with repositories that don't provide GPG keys |
| 301 | + |
| 302 | +### Network Security |
| 303 | + |
| 304 | +- Use HTTPS URLs when available |
| 305 | +- Consider using local repository mirrors for improved security and performance |
| 306 | +- Validate GPG key fingerprints when possible |
| 307 | + |
| 308 | +## Related Documentation |
| 309 | + |
| 310 | +- [Image Template Format](../architecture/image-template-format.md) |
| 311 | +- [Understanding the OS Image Build Process](../architecture/os-image-composer-build-process.md) |
| 312 | +- [Configuring Custom Commands During Image Build](configure-additional-actions-for-build.md) |
0 commit comments