Download .deb with dependencies
Good for offline install.
Bash
PACKAGES="python2"
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests \
--no-conflicts --no-breaks --no-replaces --no-enhances \
${PACKAGES} | grep "^\w" | grep -v "i386")
With no-pre-depends
Bash
PACKAGES="mysql-server-8.0"
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests \
--no-conflicts --no-breaks --no-replaces --no-enhances \
--no-pre-depends ${PACKAGES} | grep "^\w" | grep -v "i386")
Both amd64 and i386
Bash
PACKAGES="mysql-server-8.0"
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests \
--no-conflicts --no-breaks --no-replaces --no-enhances \
--no-pre-depends ${PACKAGES} | grep "^\w")
If you only need specific package (without dependencies)
Bash
aptitude clean
aptitude --download-only install <your_package_here>
cp /var/cache/apt/archives/*.deb <your_directory_here>
RHEL - Download .rpm using yum
You need:
Download: