Can I Use “yum” or “dnf” to Install Applications?

0
6
Asked By CuriousCoder42 On

I'm working on a script that I want to make universal across different systems. I want to know if the command `yum update xyz` (or the equivalent `dnf` command) will actually install the package 'xyz' if it isn't already on the system, or will it just give me an error that 'xyz' cannot be found? Thanks in advance!

5 Answers

Answered By GrumpyGamer On
Answered By FedoraFanatic On

Have you actually tried it out? It shouldn't be too complicated.

Answered By LinuxLover99 On

I think there's a bit of confusion about the term 'universal.' Many distributions aren't based on Red Hat, which uses `yum` or `dnf`. If you're running into package management issues, maybe consider addressing those instead.

Answered By TechieTinker On

Using `yum update` or `dnf update` is mainly for updating already installed packages, not installing new ones. If you want to ensure that the application is installed, you could use a command like `yum install -y xyz` instead. It's designed to install packages if they're not present. However, if you really want to check if the package is there before trying to install it, a little one-liner like `rpm -q --quiet $NAME && yum -y update $NAME || yum install -y $NAME` would do the trick.

Answered By ScriptingSage On

It really depends on whether the script you're making targets repositories that actually have the applications you want. If you package it correctly, it can be a smooth process.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.