Sometimes we do not have internet connection in our servers or VMs to install some libs and the dependencies. In this situation, one of the solution is create our local repository where will move all the libs required, we can download all the libs from another machine with internet connetion.
How to create our local repository:
- First download the libs required from a VM with internet connection.
- You can download the libs required and the dependencies with the next command.
- yum install –downloadonly –downloaddir=
- Example
- yum install –downloadonly –downloaddir=/home/test/libs glibc-2.17-157.el7_3.1.x86_64
- Example
- yum install –downloadonly –downloaddir=
- You can download the libs required and the dependencies with the next command.
- Create the local repository
- yum install createrepo
- Create the folder where you are going to create the repositry
- mkdir -p /opt/localRedHatRepo
- Create the repository
- createrepo /opt/localRedHatRepo
- Move the libs that you need it in this folder.
- createrepo –update /opt/localRedHatRepo
- cd /etc/yum.repos.d/
- vi localRedHatRepo.repo
- [LOCAL]
baseurl=file:///opt/localRedHatRepo
enabled=1
gpgcheck=0
name=localRedHatRepo
- [LOCAL]
- yum clean all
- yum update
- yum repolist
Now you can install all the libs from your local repositoy: yum install
- If you need to add more libs
- Move the new libs to /opt/localRedHatRepo
- createrepo –update /opt/localRedHatRepo
- yum clean all
- yum update
- yum repolist
Another solution is to install the libs from the ISO/CD OS, let see how to use the repository from the ISO/CD OS.
How to use the ISO/CD OS repository:
- Create a cdrom folder where mount the ISO
- mkdir -p /media/cdrom
- Mount the cd
- mount /dev/cdrom /media/cdrom
- Create the Repo file
- cd /etc/yum.respos.d
- vi cd.repo
- [CD]
baseurl=file:///media/cdrin
enabled=1
gpgcheck=0
name=CD Repo
- [CD]
- Update repository
- yum repolist