|
| 1 | +--- |
| 2 | +title: "Excluding/Including the packages" |
| 3 | +--- |
| 4 | + |
| 5 | +Different Linux distributions handle recommended or weak dependencies uniquely. This provides instructions on how to include or exclude these dependencies during package installation. |
| 6 | + |
| 7 | +Adjusting these settings allows for more control over package installations, which can be particularly useful for creating minimal environments or reducing unnecessary package bloat. |
| 8 | + |
| 9 | +## RHEL/Rocky Linux/AlmaLinux |
| 10 | + |
| 11 | +**Exclude Weak Dependencies Temporarily:** |
| 12 | + |
| 13 | +To prevent DNF from installing weak dependencies during a single operation: |
| 14 | + |
| 15 | +```bash |
| 16 | +dnf --setopt=install_weak_deps=False install <package-name> |
| 17 | +``` |
| 18 | + |
| 19 | +**Exclude Weak Dependencies Permanently:** |
| 20 | + |
| 21 | +To disable the installation of weak dependencies system-wide: |
| 22 | + |
| 23 | +1. Open the DNF configuration file: |
| 24 | + |
| 25 | + ```bash |
| 26 | + sudo nano /etc/dnf/dnf.conf |
| 27 | + ``` |
| 28 | + |
| 29 | +2. Add the following line: |
| 30 | + |
| 31 | + ```ini |
| 32 | + install_weak_deps=False |
| 33 | + ``` |
| 34 | + |
| 35 | +This setting ensures that weak dependencies are not installed by default. |
| 36 | + |
| 37 | + |
| 38 | +## SLES |
| 39 | + |
| 40 | +**Exclude Recommended Packages Temporarily:** |
| 41 | + |
| 42 | +To install only the required packages without recommended ones: |
| 43 | + |
| 44 | +```bash |
| 45 | +zypper install --no-recommends <package-name> |
| 46 | +``` |
| 47 | + |
| 48 | +**Include Recommended Packages Explicitly:** |
| 49 | + |
| 50 | +To ensure both required and recommended packages are installed: |
| 51 | + |
| 52 | +```bash |
| 53 | +zypper install --recommends <package-name> |
| 54 | +``` |
| 55 | + |
| 56 | +**Configure Default Behavior:** |
| 57 | + |
| 58 | +To change the default behavior of Zypper regarding recommended packages: |
| 59 | + |
| 60 | +1. Edit the Zypper configuration file: |
| 61 | + |
| 62 | + ```bash |
| 63 | + sudo nano /etc/zypp/zypp.conf |
| 64 | + ``` |
| 65 | + |
| 66 | +2. Set the following option: |
| 67 | + |
| 68 | + ```ini |
| 69 | + solver.onlyRequires = true |
| 70 | + ``` |
| 71 | + |
| 72 | +This configuration ensures that only required packages are installed by default. |
| 73 | + |
| 74 | +## Debian/Ubuntu |
| 75 | + |
| 76 | +**Exclude Recommended Packages Temporarily:** |
| 77 | + |
| 78 | +To install a package without its recommended dependencies: |
| 79 | + |
| 80 | +```bash |
| 81 | +apt-get install --no-install-recommends <package-name> |
| 82 | +``` |
| 83 | + |
| 84 | +**Set Default Behavior:** |
| 85 | + |
| 86 | +To prevent APT from installing recommended packages by default: |
| 87 | + |
| 88 | +1. Create a new configuration file: |
| 89 | + |
| 90 | + ```bash |
| 91 | + sudo nano /etc/apt/apt.conf.d/99norecommends |
| 92 | + ``` |
| 93 | + |
| 94 | +2. Add the following lines: |
| 95 | + |
| 96 | + ```ini |
| 97 | + APT::Install-Recommends "false"; |
| 98 | + APT::Install-Suggests "false"; |
| 99 | + ``` |
| 100 | + |
| 101 | +This configuration disables the automatic installation of recommended and suggested packages. |
0 commit comments