3

I have been installing quite a number of software using yum with my virtual machine.

I would like to find out if there is a way to obtain the rpm and dependencies rpm for offline install.

This is because the server which I am going to perform the installation does not have internet access due to security reasons.

Is there anyway I can specify the rpm to be downloaded as well ?

3 Answers 3

6

This comes from a blog post I wrote some time ago.

You can have yum fetch all the packages and their dependencies on your VM, then create a repo from them which will then be used by your server.

Note that the VM should have just the minimal packages required for it to run; since you don't know what's installed on the server, you want yum to download as many dependencies as possible.

On the VM:

# mkdir /root/tmppkg
# yum --downloadonly --downloaddir=/root/tmppkg install <packages>
# chown -R root:root /root/tmppkg
# createrepo /root/tmppkg
# chmod -R 755 /root/tmppkg

Transfer the tmppkg directory on the server, let's say in /opt. Then create a file /etc/yum.repos.d/local.repo on the server as such:

[local]
name=Local repository
baseurl=file:///opt/tmppkg
enabled=1
gpgcheck=0
protect=1

Now run on the server:

# yum install <packages>

and the packages will be installed from the local repo. Once yum has finished, you can delete /etc/yum.repos.d/local.repo and /opt/tmppkg to save space.

2
  • I have several servers which will require the same set of software and rpm dependencies, how do I create a "repository server", for all other servers to download since you are using file:// for the baseurl Dec 1, 2016 at 3:58
  • That's too long to answer in a comment, please see here: access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/… In short, you have to change the baseurl to fetch the packages via HTTP or FTP, depending on how you set up your repo server.
    – dr_
    Dec 1, 2016 at 7:51
0

Yes yumdownloader (part of the package yum-utils) can download the needed packages. To download a package and its dependencies for offline installation you can use this command

yumdownloader --resolve <package name>

The order of installing them is determined by yum:

yum install ./*rpm 

you can run this command in the folder with your downloaded packages that include all dependencies.

0

You can use tool called youdownloader like that:

 yumdownloader <package name>

it will install the package in rpm format. and for downloading dependencies

yumdownloader --resolve <package name>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .