# Using a Package Manager in GitHub Actions

DevFeed: [Using a Package Manager in GitHub Actions](<https://devfeed.tech/articles/using-a-package-manager-in-github-actions-4527.md>)

Original publisher: [Read original article](<https://feeds.feedblitz.com/~/924134489/0/baeldung/ops~Using-a-Package-Manager-in-GitHub-Actions>)

Author: Sidrah Abdullah

Published: 2025-08-31T19:08:15Z

Content type: tutorial

Language: en

Sources: [Baeldung - Ops](<https://devfeed.tech/sources/baeldung-ops.md>)

Topics: [GitHub Actions](<https://devfeed.tech/topics/github-actions.md>), [Continuous integration](<https://devfeed.tech/topics/continuous-integration.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [reproducibility](<https://devfeed.tech/topics/reproducibility.md>)

Tags: [apt](<https://devfeed.tech/tags/apt.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [build-times](<https://devfeed.tech/tags/build-times.md>), [caching](<https://devfeed.tech/tags/caching.md>), [code-coverage](<https://devfeed.tech/tags/code-coverage.md>), [container-images](<https://devfeed.tech/tags/container-images.md>), [containers](<https://devfeed.tech/tags/containers.md>), [continuous-integration](<https://devfeed.tech/tags/continuous-integration.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [deployment-tools](<https://devfeed.tech/tags/deployment-tools.md>), [deployment-tools-git-docker-container-github-actions-package-management-ubuntu](<https://devfeed.tech/tags/deployment-tools-git-docker-container-github-actions-package-management-ubuntu.md>), [docker-container](<https://devfeed.tech/tags/docker-container.md>), [environment](<https://devfeed.tech/tags/environment.md>), [git](<https://devfeed.tech/tags/git.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [package](<https://devfeed.tech/tags/package.md>), [package-management](<https://devfeed.tech/tags/package-management.md>), [ubuntu](<https://devfeed.tech/tags/ubuntu.md>), [workflow](<https://devfeed.tech/tags/workflow.md>)

## AI overview

GitHub-hosted Ubuntu jobs start in clean environments, so workflows must install required system packages. The excerpt recommends `apt-get` for scripting and shows `sudo apt-get update` followed by `sudo apt-get install -y lcov`; `sudo` addresses the dpkg permission error, and `-y` avoids an interactive prompt. To reduce repeated installation overhead, group packages in one install command, cache downloaded `.deb` files with `cache-apt-pkgs-action` (using its version as a manual cache key), or use a custom container with dependencies preinstalled. Containers can improve speed and reproducibility, but require maintaining a separate image configuration and rebuilding when it changes. The excerpt also advises installing only needed packages, using noninteractive settings, pinning versions when stability matters, accounting for `ubuntu-latest` image changes, and considering language setup actions such as `actions/setup-python` or `actions/setup-node`, which it says are often faster and more reliable for those runtimes.

## Source excerpt

Learn how to safely and wisely use a package manager within GitHub Actions. Related Stories Get Files Modified in a PR in GitHub Actions Use Private Docker Image in GitHub Actions Using GitHub Actions to Create .env File in the Workflow