code: public void installFile(PackageFile packageFile) {
      File file = packageFile.getFile();
      if (!file.exists()) {
        throw new PackageManagerException("File does not exist: " + file.getAbsolutePath());
      }
  
      try (CloseableHttpClient httpClient = pkgmgr.getHttpClient()) {
  
        // before install: if bundles are still stopping/starting, wait for completion
        pkgmgr.waitForBundlesActivation(httpClient);
  
        if (packageFile.isInstall()) {
          log.info("Upload and install " + (packageFile.isForce() ? "(force) " : "") + file.getName() + " to " + props.getPackageManagerUrl());
        }
        else {
          log.info("Upload " + file.getName() + " to " + props.getPackageManagerUrl());
        }
  
        VendorPackageInstaller installer = VendorInstallerFactory.getPackageInstaller(props.getPackageManagerUrl());
        if (installer != null) {
          installer.installPackage(packageFile, pkgmgr, httpClient, props, log);
        }
      }
      catch (IOException ex) {
        throw new PackageManagerException("Install operation failed.", ex);
      }
    }
docs: Deploy file via package manager.
  @param packageFile AEM content package