Is there a way to add and remove packages at the same time with a single
yum command? For example, installing postfix and removing sendmail without running two separate commands/transactions.
yum shell will allow you to specify multiple commands that will happen simultaneously when
run is entered.
Newer versions of yum also have the
# yum swap -- install foo -- remove bar
As the accepted answer already says, you can use
yum shell to run multiple commands at once, which is fine for interactive use. But if you want to invoke this command from a script, you can also run it against a file, eg
yum shell translist.txt, where the file could contain, for example:
remove squid install squid34 run
-y switch to assume yes to confirmation prompts.