download via yum command

Latest response

how to download-only updates from the yum update command instead of installing so as to make my own repository for my client VMs

Responses

Hello!

 

Basically, this is against Red Hat's idea of patch distribution. If you have multiple servers or workstations you should have an appropriate license for your system landscape.

When you install patches using Yum and the RHN plugin (which is the only way to receive updates by internet), the RPM files are deleted after the installation to avoid local package caching.

If you have a large amount of systems and you want to save bandwith, you might want to have a look at RHN satellite server. This server also offers a proxy module for this common requirement.

It seems that there is also an open tool called mrepo. Its description says, that it supports RHN caching - maybe this also helps you. But remember - this tool is not supported by Red Hat.

There is also a yum plugin for downloading RPM packages instead of installing - but I'm not sure if this works with RHN channels:

# yum install yum-plugin-downloadonly
# yum install --downloadonly httpd

 

Best regards,

Christian.

There are tools/utilities specifically for this task.  And there are legitimate uses for the utils outside of scope of Red Hat packages - such as, Dell OMSA packages, Oracle Repo, etc...

If you are specifically asking about patching your Red Hat ENTERPRISE hosts Operating System files, I highly recommend that you look into Red Hat Network Satellite.  I would also ask your Red Hat sales or technical resource to provide you information regarding Satellite - as it is an extremely capable product with robust road map and there is a lot of information to try and figure out on your own when you first look at it.

My experience with this task is to populate my own Satellite with 3rd-party repos.  So, you are going to need to work through a few things on your own as I won't know the specifics on those steps.

So - all that said... to pull down an entire repo (or part of a repo - which I will show).

  • Install the yum repo definition on the system doing the distribution.  /etc/yum.repos.d/srvadmin (I believe is Dell's)
  • Update that new repo file to set the channel to not enabled (enable=0).  I'll show the entire repo file below.
  • Install yum-utils anc createrepo (yum install yum-utils createrepo)
  • Make a directory to be the base of your repo which is web-accessible on your host.
  • run reposync - to pull down the files from the external repo
  • run createrepo - to generate your local repo files.  such as, repomd.xml
  • -- at this point I would run spacewalk-repo-sync to push my new repo up to my Satellite
  • You will have to create your own file to provide your clients which points to the web-accessible directory you created before.

Example repo file (with updates)

[root@mysatsrvr cron.daily]# cat /etc/yum.repos.d/srvadmin.repo
[srvadmin-base]
name=Dell OMSA repository - Hardware independent
baseurl=http://linux.dell.com/repo/hardware/latest/platform_independent/rh50_64/
gpgcheck=1
gpgkey=http://linux.dell.com/repo/hardware/latest/RPM-GPG-KEY-dell
       http://linux.dell.com/repo/hardware/latest/RPM-GPG-KEY-libsmbios
enabled=0
includepkgs=srvadmin-*,OpenIPMI*,dell-omsa-*
excludepkgs=*
includepkgorder=excludepkg,includepkg

I have a script that I use to do reposync's daily... here are some chunks

#############
# DELL PLATFORM INDEPENDENT RHEL 5
#############
CHANNEL_LABEL=dell-om-platform_independent-rhel-x86_64-server-5 # Name of Channel in Satellite
ARCH=x86_64
REPOID=srvadmin-base # name of repo (from /etc/yum.repos.d/srvadmin.repo)
syncrepo() {
  PKGDIR=/repos/$ARCH/$REPOID
  echo
  if [ ! -d $PKGDIR ]
  then
    mkdir -p $PKGDIR
  fi
  echo "# NOTE: Syncing - ${REPOID}-${ARCH}"
  echo "reposync -a $ARCH --repoid=${REPOID} -p /repos/$ARCH/ -n"
  reposync -a $ARCH --repoid=${REPOID} -p /repos/$ARCH/ -n

  echo "cd $PKGDIR"
  cd $PKGDIR

  echo "createrepo $PKGDIR"
  createrepo $PKGDIR

  echo "cd $PWD"
  cd $PWD

  echo "spacewalk-repo-sync --channel $CHANNEL_LABEL --url file://$PKGDIR --type yum > /dev/null"
  spacewalk-repo-sync --channel $CHANNEL_LABEL --url file://$PKGDIR --type yum > /dev/null
  echo
}

syncrepo

 

Overall, it depends on what you're trying to do.

If you're looking to get around your entitlements limitations, then asking on vendor-run forum probably isn't the best place to ask those sorts of questions.

 

If, on the other hand, you're running a fully-entitled environment but your environment's systems are too ephemeral to warrant having to constantly register and de-register them (common with lab environments and/or demand-based environments and/or environments where your enterprise's licensing team doesn't want to delegate sufficient access):

  • If you're simply looking to create small bundles of RPMs to push out to  VMs, then Yum's "downloadonly" plugin will likely be sufficient. Yum's man pages should be sufficient to get your sorted out on this method.
  • If you're looking to do a light-weight, "dumb" repository (that doesn't require you to add/remove clients from a database) you can always use tools like rsync, mrepo or the like to create an NFS, CIFS or HTTP-sharable RPM directory. Google should turn up lots of results for this.

Hello

# yum install yum-utils

# yumdownloader <packagename>

 

Best Regards.

reposync might be another tool to look at.

this only works for the channels your download server is entitled too.

E.g. a RHEL 6 server will not download any RHEL 5 packages.

But this would not happen with yum --downloadonly either.