apt
A reference page for the apt resource
The apt resource reference. This 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 | object]) A list of packages to install using apt. Each package can be specified as:
- A simple string with the package name (e.g.,
"curl") - An object with
nameand optionalversionfields for version-specific installations
- A simple string with the package name (e.g.,
-
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've recently updated your package lists.
Example usage:
Installing packages with simple names
[
{
"type": "apt",
"install": [
"curl",
"git",
"vim",
"build-essential"
]
}
]Installing specific package versions
[
{
"type": "apt",
"install": [
"curl",
{
"name": "nginx",
"version": "1.18.0-0ubuntu1"
},
{
"name": "postgresql",
"version": "12+214ubuntu0.1"
}
]
}
]Skipping the update step
[
{
"type": "apt",
"install": [
"jq",
"htop"
],
"update": false
}
]Notes:
- The apt resource requires sudo privileges to install packages. Codify will prompt for your password when needed.
- APT is only available on Debian-based Linux distributions. For Red Hat-based systems, use the yum or dnf resources instead.
- Package names must match those available in your configured APT repositories. Use
apt search <package>to find available packages. - When specifying versions, use the exact version string as shown by
apt-cache policy <package>.