YET ANOTHER YUM REPOSITORY
Here’s a super easy and fast way of setting up a Yum Repository for all your Linux based infrastructure. You can leverage NFS and effectively have a Yum Repository in matter of minutes.
First, mount the Red Hat 6 media distribution from an ISO or from the DVD media. Next, copy the the entire contents of the DVD to a location on the NAS or a local file system that you wish to be exported to other servers.
On the Red Hat media, look for a file called .discinfo on the root directory of the media. In my example, here’s what the contents of .discinfo looks like:
[root@rh64a yum.repos.d]# cat "/media/RHEL_6.4 x86_64 Disc 1"/.discinfo 1359576196.686790 Red Hat Enterprise Linux 6.4 x86_64 1
The line that you are interested in is the first line with all the numbers: 1359576196.686790
We will need that number to build our repository definition file: /etc/yum.repos.d/viscosity.repo
In this file, we will add the full numeric value for our mediaaid line. The other tidbit of information that you need to provide is the root file system location for the Red Hat media where you copied everything to. In our example, we copied the entire media to the /shared/rhel64.dvd directory. We will fill out the baseurl value with this location.
# cat /etc/yum.repos.d/viscosity.repo [viscosity] mediaid=1359576196.686790 name=Local Viscosity Repo baseurl=file:///nfs/rhel64.dvd/ enabled=1 gpgcheck=no
From the server that will act as our Yum Repository, add the entries to /etc/exports:
[root@rh64b yum.repos.d]# cat /etc/exports /nfs *(rw,sync)
You can selective qualify the list of servers that you want to present the share to for added security. You may need to start the NFS service with the “service hfs start” or restart the NFS service with the “service nfs restart” command.
On the target server where you wish to mount the /nfs share, you will issue the mount command with the -nfs option. In this example, we will mount the share from the rh64b server on the rh64a server. rh64b will serve as our utility server that will house the Yum Repository, DNS server, etc.
mount -t nfs rh64b:/nfs /nfs
The yum package manager does not discriminate between a network or local file system. From rh64a server, let’s take a test drive and install the screen RPM over NFS.
[root@rh64a Server]# yum install screen Loaded plugins: product-id, refresh-packagekit, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. viscosity | 3.9 kB 00:00 ... Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package screen.x86_64 0:4.0.3-16.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================== Package Arch Version Repository Size ================================================================================================================== Installing: screen x86_64 4.0.3-16.el6 viscosity 494 k Transaction Summary ================================================================================================================== Install 1 Package(s) Total download size: 494 k Installed size: 795 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : screen-4.0.3-16.el6.x86_64 1/1 Verifying : screen-4.0.3-16.el6.x86_64 1/1 Installed: screen.x86_64 0:4.0.3-16.el6 Complete!
Automation is what we our end goal is. We want to automate RPM package installations. To automatically answer “Y” to the “Is this ok [y/N]:” question, we can pass the -y flag to our yum install command:
[root@rh64d ~]# yum -y install ksh Loaded plugins: product-id, refresh-packagekit, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. viscosity | 3.9 kB 00:00 ... Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package ksh.x86_64 0:20100621-19.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================== Package Arch Version Repository Size =============================================================================================================================== Installing: ksh x86_64 20100621-19.el6 viscosity 686 k Transaction Summary =============================================================================================================================== Install 1 Package(s) Total download size: 686 k Installed size: 1.5 M Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : ksh-20100621-19.el6.x86_64 1/1 Verifying : ksh-20100621-19.el6.x86_64 1/1 Installed: ksh.x86_64 0:20100621-19.el6 Complete!
【下一篇】CREATE ORACLE 12C RAC DATABASES IN SILENT MODE