apt
A reference page for the apt resource
The apt resource manages packages on Debian-based Linux systems using the APT (Advanced Package Tool) package manager. APT is the standard package manager for Ubuntu, Debian, Linux Mint, and other Debian-based distributions.
Parameters:
-
install: (array[string]) A list of packages to install using apt. Each entry is a string with the package name, optionally including a version constraint using the
name=versionsyntax (e.g."nodejs=20.*"). Codify adds packages that are missing and removes packages that are no longer listed. -
update: (boolean) Whether to run
apt-get updatebefore installing packages to refresh the package index. Defaults totrue. Set tofalseto skip the update step if you have recently refreshed your package lists.
Example usage:
Install packages by name
[
{
"type": "apt",
"os": ["linux"],
"install": [
"curl",
"git",
"vim",
"build-essential"
]
}
]Pin specific package versions
Use the name=version syntax to install a particular version. Wildcards (*) are supported.
[
{
"type": "apt",
"os": ["linux"],
"install": [
"curl",
"nodejs=20.*",
"python3=3.12.*"
]
}
]Skip the update step
[
{
"type": "apt",
"os": ["linux"],
"install": [
"jq",
"htop"
],
"update": false
}
]Notes:
- The apt resource requires
sudoprivileges to install and remove packages. Codify handles privilege escalation automatically. - APT is only available on Debian-based Linux distributions. For Red Hat-based systems, use the yum or dnf resources instead.
- The
installlist is stateful — Codify tracks which packages it installed and removes them when they are taken off the list. Packages installed outside of Codify are not affected. - Package names must match those available in your configured APT repositories. Use
apt-cache search <package>to find available packages andapt-cache policy <package>to see available versions. - The
osfield should be set to["linux"]when combining this resource with macOS-only resources in the same configuration file, so Codify only applies it on Linux systems.