Installing an RPM under CentOS from a local repository
The problem with the standard -Uvh install of an RPM is that it doesn’t resolve any dependencies. For example, the iperf package from:
needs a boatload of other packages. You could add the dependencies one at a time, but you’d be doing that all afternoon. Using yum and a local repository will do the heavy lifting.
- Create a directory for you local repository, e.g.
- Put a copy of the RPM into that directory.
- Fix the ownership and files permissions if root doesn’t own the repository directory:
# chown -R root.root /root/repo
- Install the
createrepopackage if not installed yet, and then run:
# createrepo /root/repo # chmod -R o-w+r /root/repo
- Make a repository configuration file in
[local] name=My local repository baseurl=file:///root/repo enabled=1 gpgcheck=0
- Install the package (iperf in this case) using:
# yum install iperf
- Once the local repository is setup, you can add other RPMs to the repository directory without need to rerun the repository creation or configuration steps.