If Linux repository is not configured on the system, then installing of rpm’s is difficult part. We need to spend lot of time in finding dependencies in between rpm’s. Using yum repository will overcome this problem and it simplifies the rpm installation. But by default yum repository is configured to use oracle public repository and server should have connection to the internet. In most environments servers will not be connected to internet, in such situation we can configure YUM repository locally on the file system using the packages media.
In this post we will see how quickly we can configure the repository on the local file system using Linux Media.
– Create Directory
[root@racnode2]#mkdir -p /OEL/repo
Copy “Packages” from media to “/OEM/repo” directory
– verify createrepo package exists on the system:
If this rpm doesn’t exist then we should install it.
[root@racnode2 repo]# rpm -ivh createrepo-0.9.9-24.el6.noarch.rpm warning: createrepo-0.9.9-24.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY error: Failed dependencies: python-deltarpm is needed by createrepo-0.9.9-24.el6.noarch [root@racnode2 repo]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY error: Failed dependencies: deltarpm = 3.5-0.5.20090913git.el6 is needed by python-deltarpm-3.5-0.5.20090913git.el6.x86_64 [root@racnode2 repo]#
– If you encounter dependencies while installing this rpm then follow the below sequence of rpm installation.
[root@racnode2 repo]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY Preparing... ########################################### [100%] 1:deltarpm ########################################### [100%] [root@racnode2 repo]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY Preparing... ########################################### [100%] 1:python-deltarpm ########################################### [100%] [root@racnode2 repo]# rpm -ivh createrepo-0.9.9-24.el6.noarch.rpm warning: createrepo-0.9.9-24.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY Preparing... ########################################### [100%] 1:createrepo ########################################### [100%] [root@racnode2 repo]#
– Run createrepo command for creation of repository:
[root@racnode2 repo]# createrepo -v /OEL/repo/ Spawning worker 0 with 3934 pkgs Worker 0: reading tuned-0.2.19-16.el6.noarch.rpm Worker 0: reading cyrus-imapd-2.3.16-13.el6_6.x86_64.rpm Worker 0: reading kde-i18n-Hungarian-3.5.10-11.el6.noarch.rpm Worker 0: reading samba-3.6.23-33.0.1.el6.x86_64.rpm Worker 0: reading wpa_supplicant-0.7.3-8.el6.x86_64.rpm Worker 0: reading libICE-1.0.6-1.el6.i686.rpm Worker 0: reading sat4j-2.2.0-4.0.el6.noarch.rpm Worker 0: reading gnome-icon-theme-2.28.0-8.el6.noarch.rpm Worker 0: reading xmltex-20020625-16.el6.noarch.rpm Worker 0: reading sblim-cmpi-nfsv4-1.1.0-1.el6.x86_64.rpm Worker 0: reading python-libs-2.6.6-64.0.1.el6.i686.rpm Worker 0: reading pcsc-lite-openct-0.6.19-4.el6.x86_64.rpm Worker 0: reading gzip-1.3.12-22.el6.x86_64.rpm ---- ---- Worker 0: reading xorg-x11-fonts-misc-7.2-11.el6.noarch.rpm Workers Finished Gathering worker results Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Starting other db creation: Sun Oct 30 13:35:05 2016 Ending other db creation: Sun Oct 30 13:35:06 2016 Starting filelists db creation: Sun Oct 30 13:35:07 2016 Ending filelists db creation: Sun Oct 30 13:35:11 2016 Starting primary db creation: Sun Oct 30 13:35:11 2016 Ending primary db creation: Sun Oct 30 13:35:13 2016 Sqlite DBs complete [root@racnode2 repo]#
– Configure the repository file:
[root@racnode2 repo]# vi /etc/yum.repos.d/myrepo.repo [root@racnode2 repo]# cat /etc/yum.repos.d/myrepo.repo [Local_Repo] name=myrepo baseurl=file:/OEL/repo enabled=1 gpgcheck=0 [root@racnode2 repo]#
– Check the configured repositories:
[root@racnode2 repo]# yum list Loaded plugins: refresh-packagekit, security, ulninfo Local_Repo | 2.9 kB 00:00 ... Local_Repo/primary_db | 4.1 MB 00:00 ... http://yum.oracle.com/repo/OracleLinux/OL6/UEKR4/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'yum.oracle.com'" Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: public_ol6_UEKR4. Please verify its path and try again [root@racnode2 repo]#
Still its listing the old oracle public repository. We should remove this repository from the list.
– remove repository:
[root@racnode2 yum.repos.d]# ls myrepo.repo old [root@racnode2 yum.repos.d]# mv public-yum-ol6.repo old^C [root@racnode2 yum.repos.d]# cd old [root@racnode2 old]# ls packagekit-media.repo public-yum-ol6.repo [root@racnode2 old]#
– Check the repositories:
[root@racnode2 yum.repos.d]# yum repolist Loaded plugins: refresh-packagekit, security, ulninfo repo id repo name status Local_Repo myrepo 3,934 repolist: 3,934 [root@racnode2 yum.repos.d]#
Now its listing only locally configured repository and we are ready to use this repository for installing required rpm’s.