Linux
View all Worklets
LinuxLinux

Add Repository

Add package repositories to yum or apt-get on Linux endpoints for centralized software sources

Worklet Details

What the Repository Manager does

This Automox Worklet™ enforces the presence of specified package repositories on Linux endpoints. The Worklet adds repositories to either yum/dnf or apt-get repository lists depending on your distribution.

For yum-based systems like RHEL, CentOS, and Fedora, the Worklet uses yum-config-manager or dnf config-manager to add and enable repositories. For apt-based systems like Debian and Ubuntu, the Worklet uses add-apt-repository to add PPA or standard repositories.

The Worklet detects which package manager is present and applies the appropriate configuration method. You configure the target repository by setting variables in the script before deployment.

Why manage repositories through Automox

Manual repository configuration across Linux fleets is time-consuming and error-prone, leading to inconsistent software sources between endpoints. Administrators SSH into each server individually to add repositories, missing endpoints or making typos in repository URLs. Different endpoints end up with different software versions, complicating troubleshooting when some systems have updated packages while others use outdated versions. Users cannot install required software because the necessary repositories are missing from their endpoints.

This Automox Worklet centralizes repository management by adding specified repositories across your entire Linux fleet simultaneously. You deploy internal repositories for proprietary software, add third-party vendors like Ansible or Docker, or enable specific distribution repositories with consistent configuration. The Worklet detects when repositories are removed and restores them automatically through scheduled policy runs, maintaining ongoing compliance. You eliminate manual SSH sessions and maintain uniform software source availability across all endpoints.

How repository configuration works

  1. Evaluation phase: The Worklet detects the package manager by checking for /usr/bin/yum or /usr/bin/apt-get. It then queries enabled repositories using yum repolist enabled or by reading /etc/apt/sources.list files. If the specified repository name is not found in the enabled list, the endpoint is flagged for remediation.

  2. Remediation phase: Based on the aptOrYum variable setting, the Worklet adds the repository using the appropriate method. For yum systems, it runs yum-config-manager --add-repo or dnf config-manager --add-repo. For apt systems, it runs add-apt-repository --yes --update with the specified repository string.

Repository configuration requirements

  • Linux endpoint with yum/dnf (RHEL/CentOS/Fedora) or apt (Debian/Ubuntu) package manager

  • Root or sudo privileges for repository configuration

  • Network access to the repository URL or PPA location

  • Set the repo variable in evaluation.sh with the repository name to check

  • Set aptOrYum and repo variables in remediation.sh with the target system type and repository URL/PPA

Expected state after repository configuration

After completion, the specified repository appears in the endpoint's enabled repository list and packages become available for installation. On yum-based systems, the repository appears when running yum repolist or dnf repolist with an enabled status. On apt-based systems, the repository entry exists in /etc/apt/sources.list.d/ as a separate .list file or in /etc/apt/sources.list as an added line.

Verify the repository by running yum search <package-name> or apt-cache search <package-name> to find packages from the new source. Test installation with yum install <package-name> or apt-get install <package-name> for packages exclusively available in the added repository. Check repository metadata with yum repoinfo <repo-name> on RHEL-based systems or apt-cache policy on Debian-based systems. The repository remains active across reboots and system updates unless manually removed or the repository URL becomes unavailable.

How to validate add repository changes

  1. Run this Worklet on a pilot Linux endpoint and review evaluation output for add repository.

  2. Confirm Automox activity logs show successful completion and exit code 0.

  3. Verify endpoint state using checks aligned to evaluation script logic, such as elif, exit.

  4. Validate remediation effects from script operations such as yum-config-manager, elif, dnf, then rerun evaluation for compliance.

View in app
evalutation image
remediation image

Consider Worklets your easy button

What's a Worklet?

A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

do more with worklets