How to Simulate Package Installation with YUM Like apt-get –simulate in RHEL/CentOS


2 views

When managing production servers running Red Hat Enterprise Linux (RHEL) or CentOS, it's crucial to preview package installation changes before actually executing them. Unlike Debian/Ubuntu's apt-get --simulate command, YUM requires different approaches for dry-run operations.

For modern YUM versions (4.x+), you can use:

yum install --assumeno package-name
yum install -n package-name

For older YUM versions (like 3.2.22 in RHEL 5.6), try these alternatives:

yum install package-name --downloadonly --setopt=tsflags=test

Or use the verbose mode with transaction check:

yum -v install package-name

Let's examine what would happen when installing httpd:

yum -v install httpd

The output will show:

Dependencies Resolved
================================================================================
 Package         Arch      Version                 Repository             Size
================================================================================
Installing:
 httpd           i386      2.2.3-92.el5            rhel-x86_64-server-5  1.2 M
Installing for dependencies:
 apr             i386      1.2.7-11                rhel-x86_64-server-5  123 k
 apr-util        i386      1.2.7-11.el5            rhel-x86_64-server-5   84 k

For more detailed dependency analysis, install and use repoquery:

yum install yum-utils
repoquery --requires --resolve package-name

1. Always test in staging first
2. For critical systems, consider creating a snapshot or backup
3. The --downloadonly option actually downloads packages, so use with caution
4. Combine with yum history to track changes

If none of these work on your RHEL 5.6 system, you might need to:

yum -C makecache
yum -q list package-name

This approach at least lets you see available versions without installing.


When managing production RHEL systems, it's crucial to preview package installation impacts. While Ubuntu/Debian users have apt-get --simulate install, YUM (particularly older versions like 3.2.x) requires different approaches.

For modern YUM installations (v4+), use:

yum install --assumeno package_name
# Or alternatively:
yum install -n package_name

For RHEL 5.x systems with YUM 3.2.22, these methods work:

Method 1: check-update + repoquery

yum check-update package_name
repoquery --requires --resolve package_name

Method 2: Combined dry-run command

yum -d 3 install package_name | grep -A10 "Dependencies Resolved"

To see what would change during Apache installation:

# For newer systems:
yum install -n httpd

# For legacy systems:
yum -d 3 install httpd | grep -iE "install|upgrade|remove"

Add this to your ~/.bashrc for quick simulations:

alias yum-simulate='yum -d 3 install $@ | grep -iE "install|upgrade|remove|dependencies"'

Usage: yum-simulate package_name