Thursday, 26 January 2017

LOCAL YUM REPOSITORY CREATION IN LINUX (Distributions - Redhat/Centos & Versions - 4 / 5 / 6 & 7)


Step 1: Now, check the mounted dvd or iso details in the server:

[root@onlineucator ~]# df -TH
If it is not showing,
then >> go to >> vmware >> settings >> cd/dvd >> add iso

After adding iso then check the details and mount as below:
[root@onlineucator ~]# df -TH

[root@onlineucator ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected, mounting read-only


Step 2: Now, create directory :

[root@onlineucator ~]# mkdir /rhel7


Step 3: Now, go to mounted directory:

[root@onlineucator ~]# cd /mnt/Packages/

Copy the files from /mnt/Packages/* to "/rhel7" directory:

Note: * means all files

[root@onlineucator Packages]# cp -prv * /rhel7/  

Cross check the size of the copied files:

[root@onlineucator Packages]# du -sh /rhel7/
3.1G    /rhel7/
------------------------------------------------------------

Step 4: Go to mounted path "/mnt/repodata/" and copy a file "76a190afa1c59e14d3a03f9b03c3eee31df0099f1193528ebb87d4d493d2b686-comps-Server.x86_64.xml /rhel7/comps-Server.x86_64.xml" to "/rhel7":

Step 5: Copy a file from "/rhel7/repodata/" and rename as below in "rhel7":
[root@onlineucator mnt]# cp -pv /mnt/repodata/76a190afa1c59e14d3a03f9b03c3eee31df0099f1193528ebb87d4d493d2b686-comps-Server.x86_64.xml /rhel7/comps-Server.x86_64.xml
------------------------------------------------------------

Step 6: Now, we need to install "createrepo" package.

Search below ".rpm" in "/rhel7/" directory:

ls -l deltarpm-3.6-3.el7.x86_64.rpm
ls -l python-deltarpm-3.6-3.el7.x86_64.rpm
ls -l createrepo-0.9.9-23.el7.noarch.rpm

Now, we need to install above 3 ".rpm" packages:

[root@onlineucator rhel7]# rpm -ivh deltarpm-3.6-3.el7.x86_64.rpm
warning: deltarpm-3.6-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:deltarpm-3.6-3.el7               ################################# [100%]

[root@onlineucator rhel7]# rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm
warning: python-deltarpm-3.6-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:python-deltarpm-3.6-3.el7        ################################# [100%]

[root@onlineucator rhel7]# rpm -ivh createrepo-0.9.9-23.el7.noarch.rpm
warning: createrepo-0.9.9-23.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:createrepo-0.9.9-23.el7          ################################# [100%]


Step 7: Create the repo database:

[root@onlineucator rhel7]# createrepo -vg comps-Server.x86_64.xml /rhel7/


Step 8: Now, go to following path "/etc/yum.repos.d/", 
and create a file and add the details as below: 

# vim test.repo

[rhel7_dvd]
name=test.repo
baseurl=file:///rhel7/
gpgcheck=0
enable=1

Step 9: Now, check the "yum" configuration:

[root@onlineucator ~]# yum clean all

[root@onlineucator ~]# yum group list

Try to install any one package and cross check your yum configuration:

[root@onlineucator ~]# yum install telnet* -y

Note: If you have installed the CUI server, then install "GUI" packages:

[root@onlineucator ~]# yum group list

[root@onlineucator ~]# yum group install "Server with GUI" -y

Now, restart the server, then your PC will load in GUI mode.

*************************** Keshav Kummari ***************************

No comments:

Post a Comment