Rabu, 27 Februari 2019

CentOS 7 : How to setup yum repository using locally mounted iso


1. Copy iso file to some directory. For example /home/iso/

   
# cd /home
# mkdir iso
# cd iso

   Copy iso file to prepare directory, what ever methode you use
   list file on it

# ls
   

2. Mount the CentOS 7 installation media ISO to some directory. For example /media/CentOS

# mkdir -p /media/CentOS

   Edit file /etc/fstab make add line like this
  
/home/iso/CentOS-7-1810.iso    /media/CentOS iso9660    loop,ro        0 0

   Mount iso file to prepare directory

# mount -a

   if No Error you can check on folder /media/CentOS
  
# cd /media/CentOS
# ls

3. remove/backup all repo on /etc/yum.repo.d/

# cd /etc/yum.repo.d
# mv *.repo /root/

   copy back file CentoOS-Media.repo to /etc/yum.repo.d/

# cd
# cp CentOS-Media.repo /etc/yum.repo.d/

   edit fiel /etc/yum.repo.d/CentOS-Media.repo
  
# vi /etc/yum.repo.d/CentOS-Media.repo

   edit like this

[c7-media]
name=CenOS-$releasever - Media
baseurl=file:///media/CentOS/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


4. Make sure you clear the related caches by yum clean all and subscription-manager clean once.
  
# yum clean all


Tidak ada komentar: