Use APT with JFrog CLI
Configure APT for Artifactory and run native package operations with JFrog CLI.
Use JFrog CLI to configure APT for a JFrog Artifactory Debian repository and run native APT operations with Artifactory authentication. APT support is available in JFrog CLI 2.118.0 and later.
Note
Artifactory stores Debian packages in a Debian repository. JFrog CLI uses APT to resolve packages from that repository. Use
jf setup aptandjf aptto configure sources and runapt-get. There is nojf debiancommand. To publish a.debfile and record Debian artifact details, usejf rt uploadwith--deb.
This topic covers the following tasks:
- Configure Persistent APT Access
- Run APT Operations
- Collect Build-Info for an APT Install
- Remove JFrog-Managed APT Configuration
When to Use
Use jf setup apt when you want native apt-get commands to use an Artifactory Debian repository across terminal sessions. The command creates a persistent source entry and an APT pinning file.
Use jf apt for either of these workflows:
- Run a one-off
apt-getoperation against Artifactory by passing--repoand--dist. JFrog CLI creates a temporary source file for the operation and removes it afterward. - Use a source previously created by
jf setup aptwithout passing the repository and distribution on every command.
jf apt doesn't upload .deb files. To publish a .deb file and record Debian artifact details (distribution, component, and architecture), use jf rt upload with --deb <DISTRIBUTION>/<COMPONENT>/<ARCHITECTURE>. For more information, see Upload Files. For repository creation, layouts, and Debian metadata behavior, see Debian Repositories.
After a successful jf apt install, you can collect dependency build-info locally with --build-name and --build-number, then publish that record with jf rt build-publish. For more information, see Collect Build-Info for an APT Install.
Prerequisites
- JFrog CLI 2.118.0 or later installed on a Debian or Ubuntu host.
- Native APT tools installed.
jf aptinvokesapt-getby default and can explicitly invokeapt-cacheordpkg-query. - A configured JFrog server. Run
jf config addorjf c add, then use the default server or pass--server-id. For more information, see Configure JFrog CLI. - An Artifactory Debian repository. Use a virtual repository for package resolution so you can resolve dependencies through one URL.
- Required host privileges. Writing under
/etc/apt/, updating package indexes, and installing packages normally require root privileges. If you usesudo, ensure that the elevated process can access the intended JFrog CLI server configuration. You can configure the same server for root or pass supported connection options tojf setup apt. - A repository signing key, unless you intentionally use
--trustedin a test environment.
Warning
Both persistent and temporary APT source files contain the username, password, or access token from the selected JFrog CLI server configuration. Persistent source files are created with mode
0600. Temporary source files are also created with mode0600and are removed after the command normally exits.Restrict access to the host and its backups. Rerun
jf setup aptwhen the stored credential changes or expires. If you terminate a process before cleanup, remove any remainingjfrog-apt-sources-*.listfile from the system temporary directory. A later one-offjf aptoperation also removes matching temporary files older than 1 hour on a best-effort basis.
Configure Persistent APT Access
jf setup apt creates a persistent APT source for an Artifactory Debian repository. It also creates an APT preference with pin priority 1001, which makes a package from the selected Artifactory host take precedence when that host contains the package.
Setup Command Synopsis
jf setup apt uses the following command syntax.
sudo jf setup apt \
[--server-id=<SERVER_ID>] \
--repo=<REPO_KEY> \
--dist=<DISTRIBUTION> \
[--component="<COMPONENT_LIST>"] \
[--import-key | --trusted]Where:
<SERVER_ID>: JFrog CLI server ID fromjf config add<REPO_KEY>: Artifactory Debian repository key<DISTRIBUTION>: Debian or Ubuntu distribution codename, such asbookworm,jammy, ornoble<COMPONENT_LIST>: One or more space-separated Debian components. The default ismain
Setup Options
The following table describes the jf setup apt options.
| Flag | Default | Description |
|---|---|---|
--server-id | Default server | JFrog CLI server configuration to use |
--repo | Interactive selection | Artifactory Debian repository key. In an interactive terminal, omitting this flag prompts for a virtual Debian repository |
--dist | Interactive prompt | Debian or Ubuntu distribution codename, such as bookworm, jammy, or noble. Required in non-interactive mode |
--component | main | One or more space-separated components, for example "main contrib non-free" |
--import-key | false | Download the repository GPG public key, install it under /etc/apt/keyrings/, and add signed-by to the source entry |
--trusted | false | Add trusted=yes and skip GPG signature verification. Use only for testing. Mutually exclusive with --import-key |
You can also provide connection flags accepted by jf setup, including --url, --user, --password, and --access-token. Prefer a named server configuration so credentials are managed consistently with other JFrog CLI commands.
To configure persistent APT access:
-
Complete the procedure that matches your environment:
- Configure with GPG Verification for a signed production repository
- Configure Multiple Components when you need more than the
maincomponent - Configure Interactively when you prefer prompts
- Test Without a Signing Key only for an unsigned test repository
Configure with GPG Verification
Use --import-key for a signed repository.
To configure persistent APT access with GPG verification:
-
Run:
sudo jf setup apt \ --server-id=<SERVER_ID> \ --repo=<REPO_KEY> \ --dist=<DISTRIBUTION> \ --component=<COMPONENT> \ --import-keyWhere:
<SERVER_ID>: JFrog CLI server ID fromjf config add<REPO_KEY>: Artifactory Debian repository key<DISTRIBUTION>: Debian or Ubuntu distribution codename<COMPONENT>: Debian component. The default ismain
For example:
sudo jf setup apt \ --server-id=my-server \ --repo=debian-virtual \ --dist=bookworm \ --component=main \ --import-keyExpected output includes:
Installed GPG public key at /etc/apt/keyrings/jfrog-debian-virtual-bookworm.asc Wrote /etc/apt/sources.list.d/jfrog-debian-virtual-bookworm.list Successfully configured apt to use JFrog Artifactory repository 'debian-virtual'.
JFrog CLI reads the repository configuration to identify its primary signing key. If no named primary key is available, the CLI requests the default Artifactory GPG public key. The source entry uses signed-by so trust is scoped to that repository source.
If you run setup again without --import-key and the matching key file still exists, JFrog CLI reuses that key. Pass --import-key again to refresh it.
Configure Multiple Components
Pass components as one quoted, space-separated value.
To configure multiple Debian components:
-
Run:
sudo jf setup apt \ --repo=<REPO_KEY> \ --dist=<DISTRIBUTION> \ --component="<COMPONENT_LIST>" \ --import-keyWhere:
<REPO_KEY>: Artifactory Debian repository key<DISTRIBUTION>: Debian or Ubuntu distribution codename<COMPONENT_LIST>: Space-separated Debian components
For example:
sudo jf setup apt \ --repo=debian-virtual \ --dist=bookworm \ --component="main contrib non-free" \ --import-key
Configure Interactively
To configure APT interactively:
-
Run the command without
--repoor--distin an interactive terminal:sudo jf setup aptJFrog CLI prompts for a virtual Debian repository and a distribution. When
--distis omitted in an interactive terminal, it also prompts for a component and GPG mode. The GPG prompt acceptsimport,trusted, or an empty value that writes nosigned-byortrusted=yesoption. Useimportfor a signed production repository.
In CI or another non-interactive environment, pass both --repo and --dist. Also pass --component and --import-key explicitly when you require those settings.
Generated Files
For repository <REPO_KEY> and distribution <DISTRIBUTION>, setup manages these files.
| File | Purpose | Mode |
|---|---|---|
/etc/apt/sources.list.d/jfrog-<REPO_KEY>-<DISTRIBUTION>.list | Authenticated Artifactory deb source | 0600 |
/etc/apt/preferences.d/jfrog-<REPO_KEY>-<DISTRIBUTION>.pref | Pins packages from the Artifactory host at priority 1001 | 0644 |
/etc/apt/keyrings/jfrog-<REPO_KEY>-<DISTRIBUTION>.asc | ASCII-armored repository public key, created with --import-key | 0644 |
After writing a changed source, JFrog CLI runs apt-get update against that source file only. It then runs a full apt-get update. If another configured APT source fails during the full refresh, setup still succeeds and JFrog CLI logs a warning. Re-running setup with an identical source is idempotent and reports that no changes are needed.
Warning
APT priority
1001permits downgrades. If Artifactory contains an older version of a package that is also available from another configured source, APT can select the Artifactory version. Review the generated preference file against your package-selection policy.
Test Without a Signing Key
If a test repository isn't signed, you can explicitly disable signature verification.
To skip signature verification in a test environment:
-
Run:
sudo jf setup apt \ --repo=<REPO_KEY> \ --dist=<DISTRIBUTION> \ --trustedWhere:
<REPO_KEY>: Artifactory Debian repository key<DISTRIBUTION>: Debian or Ubuntu distribution codename
For example:
sudo jf setup apt \ --repo=debian-test-virtual \ --dist=bookworm \ --trusted
--trusted generates a source with trusted=yes. Don't use it for production repositories.
Run APT Operations
jf apt forwards standard input, output, and errors to the native tool. For most arguments, it runs apt-get.
Run Command Synopsis
jf apt uses the following command syntax.
jf apt <APT_GET_COMMAND> <ARGS> <JFROG_OPTIONS>
jf apt apt-cache <ARGS> <JFROG_OPTIONS>
jf apt dpkg-query <ARGS> <JFROG_OPTIONS>Where:
<APT_GET_COMMAND>: Anapt-getoperation such asinstall,upgrade,remove, ordownload<ARGS>: Native arguments and options passed to the selected APT tool after JFrog-specific options are removed<JFROG_OPTIONS>: JFrog CLI flags such as--repo,--dist,--trusted,--skip-login,--from-file,--build-name, and--build-number
jf apt-get is an alias for jf apt.
Arguments
The following table describes the jf apt arguments.
| Argument | Required | Description |
|---|---|---|
<APT_GET_COMMAND> | Yes, unless selecting another native tool | An apt-get operation such as install, upgrade, remove, or download |
apt-cache | No | Selects the native apt-cache binary. Remaining arguments are passed to it |
dpkg-query | No | Selects the native dpkg-query binary. Remaining arguments are passed to it |
<ARGS> | No | Native arguments and options passed to the selected APT tool after JFrog-specific options are removed |
APT Options
The following table describes the JFrog-specific jf apt options.
| Flag | Default | Description |
|---|---|---|
--server-id | Default server | JFrog CLI server configuration used for temporary authentication |
--repo | None | Artifactory Debian repository used for a one-off source. Use with --dist |
--dist | None | Debian or Ubuntu distribution used for a one-off source. Use with --repo |
--component | main | One or more components for the temporary source |
--trusted | false | Skip GPG signature verification for the temporary source. Use only for testing |
--skip-login | false | Skip temporary Artifactory authentication and use the existing system APT configuration |
--from-file | None | Path to a package list for install. One package per line. Lines that start with # are comments. You can pin a version, for example curl=8.5.0 |
--build-name | JFROG_CLI_BUILD_NAME | Build name for local build-info after a successful install. Must be provided together with --build-number |
--build-number | JFROG_CLI_BUILD_NUMBER | Build number for local build-info after a successful install. Must be provided together with --build-name |
--module | None | Optional module ID in the build-info. Requires --build-name and --build-number |
--project | JFROG_CLI_BUILD_PROJECT | JFrog project key associated with the build-info |
To run APT operations:
-
Complete the procedure that matches your workflow:
- Run a One-Off Operation for a temporary Artifactory source
- Use Persistent Setup after
jf setup apt - Use Existing System Configuration to skip temporary authentication
- Run Read-Only Queries for
apt-cacheordpkg-query
Run a One-Off Operation
Pass both --repo and --dist with a valid default or explicit server configuration to create a temporary authenticated source.
The one-off source doesn't support --import-key and doesn't add signed-by. Use this mode only when the repository key is already trusted by APT, or pass --trusted in an isolated test environment. For production with repository-scoped signature verification, first run jf setup apt --import-key, then use the persistent workflow without --repo and --dist.
To run a one-off APT install in a test environment:
-
Run:
sudo jf apt install <PACKAGE> \ --server-id=<SERVER_ID> \ --repo=<REPO_KEY> \ --dist=<DISTRIBUTION> \ --component=<COMPONENT> \ --trustedWhere:
<PACKAGE>: Debian package name to install<SERVER_ID>: JFrog CLI server ID fromjf config add<REPO_KEY>: Artifactory Debian repository key<DISTRIBUTION>: Debian or Ubuntu distribution codename<COMPONENT>: Debian component. The default ismain
For example:
sudo jf apt install curl \ --server-id=my-server \ --repo=debian-virtual \ --dist=bookworm \ --component=main \ --trusted
For the temporary operation, JFrog CLI replaces the main source list with the temporary Artifactory source and disables the system sources.list.d directory. The selected Artifactory repository must therefore provide the requested packages and their dependencies.
Before install, upgrade, dist-upgrade, full-upgrade, or satisfy, JFrog CLI runs apt-get update against the temporary source. Other apt-get operations run without that automatic update.
Use Persistent Setup
After jf setup apt, you can omit --repo and --dist.
To install a package using persistent APT setup:
-
Run:
sudo jf apt install <PACKAGE>Where:
<PACKAGE>: Debian package name to install
For example:
sudo jf apt install curl
JFrog CLI detects a managed jfrog-*.list file and lets native apt-get use the persistent system configuration.
Use Existing System Configuration
Use --skip-login to bypass temporary source creation.
To skip temporary Artifactory authentication:
-
Run:
sudo jf apt install <PACKAGE> --skip-loginWhere:
<PACKAGE>: Debian package name to install
For example:
sudo jf apt install curl --skip-login
If you omit --repo and --dist and no persistent JFrog source exists, the command warns and runs apt-get with the existing system configuration.
Run Read-Only Queries
Place apt-cache or dpkg-query immediately after jf apt to invoke that binary.
To run a read-only APT query:
-
Run one of the following commands:
jf apt apt-cache policy <PACKAGE> jf apt dpkg-query -W <PACKAGE>Where:
<PACKAGE>: Debian package name to query
For example:
jf apt apt-cache policy curl jf apt dpkg-query -W curl
These query tools use the existing system configuration. JFrog CLI doesn't create a temporary source for them.
Collect Build-Info for an APT Install
After a successful jf apt install, JFrog CLI can save dependency build-info locally when --build-name and --build-number are both set, or when you export JFROG_CLI_BUILD_NAME and JFROG_CLI_BUILD_NUMBER. Other apt-get operations, including upgrade and remove, don't collect build-info. apt-cache and dpkg-query don't collect build-info.
JFrog CLI strips the build flags before it runs apt-get. The local record uses module type debian and dependency type deb. Collection failure is logged as a warning and doesn't fail the install.
This dependency record isn't a substitute for publishing .deb files. To record Debian artifact details for a package you deploy, use jf rt upload with --deb.
To collect build-info for an APT install:
-
Run:
sudo jf apt install <PACKAGE> \ --repo=<REPO_KEY> \ --dist=<DISTRIBUTION> \ --build-name=<BUILD_NAME> \ --build-number=<BUILD_NUMBER>Where:
<PACKAGE>: Debian package name to install<REPO_KEY>: Artifactory Debian repository key for a one-off source. Omit--repoand--distafterjf setup apt<DISTRIBUTION>: Debian or Ubuntu distribution codename<BUILD_NAME>: Logical build name<BUILD_NUMBER>: Build number or CI ID
For example:
sudo jf apt install curl \ --repo=debian-virtual \ --dist=bookworm \ --trusted \ --build-name=my-apt-build \ --build-number=1After a successful install, expected output includes:
Collecting apt build-info for my-apt-build/1 (1 package(s))JFrog CLI then prints
apt build-info collectedwith the recorded dependency count and ajf rt bp my-apt-build 1publish hint. -
Publish the local build-info to Artifactory:
jf rt build-publish <BUILD_NAME> <BUILD_NUMBER>For example:
jf rt build-publish my-apt-build 1
To install packages from a list file and collect build-info:
-
Create a text file with one package per line. You can pin versions and add comments.
# CI package list curl vim -
Run:
sudo jf apt install --from-file=<PACKAGE_LIST> \ --repo=<REPO_KEY> \ --dist=<DISTRIBUTION> \ --build-name=<BUILD_NAME> \ --build-number=<BUILD_NUMBER>Where:
<PACKAGE_LIST>: Path to the package list file
For example:
sudo jf apt install --from-file=packages.txt \ --repo=debian-virtual \ --dist=bookworm \ --trusted \ --build-name=my-apt-build \ --build-number=1
Note
Providing only
--build-nameor only--build-numberfails. Both flags are required together.
Remove JFrog-Managed APT Configuration
Use --remove to delete files created by jf setup apt.
To remove JFrog-managed APT configuration:
-
Run the command that matches the files you want to delete:
-
Remove every JFrog-managed APT source, preference, and key.
sudo jf setup apt --remove -
Remove configuration for one repository.
sudo jf setup apt --remove --repo=<REPO_KEY> -
Remove configuration for one distribution.
sudo jf setup apt --remove --dist=<DISTRIBUTION> -
Limit removal by both repository and distribution.
sudo jf setup apt --remove --repo=<REPO_KEY> --dist=<DISTRIBUTION>
Where:
<REPO_KEY>: Artifactory Debian repository key used during setup<DISTRIBUTION>: Debian or Ubuntu distribution used during setup
For example:
sudo jf setup apt --remove --repo=debian-virtual --dist=bookworm -
Removal is idempotent. If no matching JFrog-managed files exist, the command reports that no configuration was found.
Important Notes for APT Commands
--repoand--distmust be passed together for one-off authentication. If only one is passed, JFrog CLI warns that the partial flag was ignored.- A temporary source includes only the selected Artifactory repository. Use a virtual repository that can resolve transitive dependencies.
- A persistent source remains active for native
apt-getcommands, not only commands run throughjf apt. - Setup validates repository, distribution, and component values before using them in source lines or file paths.
- If setup can't write under
/etc/apt/, run it with sufficient privileges. jf aptdoesn't adddeb-srcentries.jf aptdoesn't upload.debfiles. Usejf rt uploadwith--debto publish a Debian package and record artifact details.jf apt installcollects local build-info only when both--build-nameand--build-numberare set. Publish that record withjf rt build-publish. A collection warning doesn't fail the install.
Troubleshooting
The following table lists common symptoms and how to resolve them.
| Symptom | Cause | Resolution |
|---|---|---|
--repo is required (non-interactive mode) | Repository selection can't prompt | Pass --repo=<REPO_KEY> |
--dist is required (non-interactive mode) | Distribution can't prompt | Pass --dist=<DISTRIBUTION> |
--trusted and --import-key are mutually exclusive | Both GPG modes were selected | Use --import-key for verification or --trusted only for testing |
| GPG key fetch reports no configured signing key | The repository has no primary or default GPG key | Configure repository signing in Artifactory, then rerun with --import-key. Use --trusted only in testing |
apt-get update failed after setup | Credentials, connectivity, source metadata, or host privileges are invalid | Verify the server configuration, repository, distribution, component, network access, and use sudo where required |
NO_PUBKEY during a one-off operation | Temporary sources don't support --import-key or signed-by | Use persistent setup with jf setup apt --import-key. Use --trusted only in testing |
| A package resolves from an unexpected version | The generated preference uses pin priority 1001 | Review /etc/apt/preferences.d/jfrog-<REPO_KEY>-<DISTRIBUTION>.pref and your repository contents |
jf apt warns that no authentication was injected | --repo and --dist weren't both set, and no persistent JFrog source exists | Pass both flags or run jf setup apt |
| Native tool not found | apt-get, apt-cache, or dpkg-query is missing from PATH | Install the native APT tools and rerun on Debian or Ubuntu |
| Persistent authentication stops working | The credential embedded by setup expired or changed | Refresh the JFrog CLI server configuration and rerun jf setup apt |
the build-name and build-number options cannot be provided separately | Only one of the build flags was passed | Pass both --build-name and --build-number |
apt build-info collection failed | Install succeeded, but dependency metadata couldn't be assembled | Check APT indexes and package names, then rerun install with the same build flags |
Enable debug logging when you need command-routing details:
export JFROG_CLI_LOG_LEVEL=DEBUGDebug output should be handled as sensitive operational data even though JFrog CLI masks known credential values.
Frequently Asked Questions
This section provides answers to frequently asked questions.
FAQs
Q: What is the difference between jf setup apt and jf apt?
jf setup apt and jf apt?A: jf setup apt writes persistent files under /etc/apt/. jf apt runs a native APT operation and can either use that persistent setup or create a temporary source when you pass --repo and --dist. For more information, see Configure Persistent APT Access and Run APT Operations.
Q: Does jf apt collect build-info?
jf apt collect build-info?A: Yes, after a successful jf apt install when both --build-name and --build-number are set. Other APT operations don't collect build-info. Publish the local record with jf rt build-publish. For more information, see Collect Build-Info for an APT Install.
Q: Can I upload a .deb file with jf apt?
.deb file with jf apt?A: No. jf apt is for package resolution, native APT queries, and install-time dependency build-info. Use jf rt upload <SOURCE_PATTERN> <TARGET_PATH> --deb <DISTRIBUTION>/<COMPONENT>/<ARCHITECTURE> to publish a .deb file and record Debian artifact details. For more information, see Upload Files.
Q: When should I use --trusted?
--trusted?A: Use --trusted only for a test repository with no signing key. For normal use, configure repository signing and run jf setup apt --import-key. For more information, see Test Without a Signing Key.
Q: Where does setup store credentials?
A: The managed .list file contains credentials in the Artifactory URL and is created with mode 0600. Protect the host and rerun setup whenever the stored credential changes. For more information, see Prerequisites.
Related Topics
Updated about 2 hours ago
