Friday 3 April 2020

Creating Local Repository | AppStream | BaseOS in CentOS and Red Hat

To create local YUM repository you need to copy DVD contents to your local directory on server

To mount the DVD First we need to find a correct CD/DVD block device. To do this execute a command blkid as root user
#blkid
/dev/sda1: UUID="2122c197-7d49-405c-a242-7ca82548952f" TYPE="ext4" PARTUUID="21d5a638-01"
/dev/sda2: UUID="wjkcLP-ULnh-yFdB-Q3HD-JHK2-UuOn-QljGW1" TYPE="LVM2_member" PARTUUID="21d5a638-02"
/dev/sr0: UUID="2020-01-03-21-42-40-00" LABEL="CentOS-8-1-1911-x86_64-dvd" TYPE="iso9660" PTUUID="087a73cc" PTTYPE="dos"


Take a note of the relevant block device eg. /dev/sr0 
2. Create Mount Point:
Mount point will be a directory where you wish to mount your CD/DVD drive. It can be any arbitrary directory. For example in this case we will be using
/software/iso as a directory mount point:
# mkdir /software/iso

3. Mount CD/DVD:
We are now ready to mount CD/DVD by using the mount command:

#mount /dev/sr0 /software/iso
mount: /software/iso: WARNING: device write-protected, mounted read-only.

At this point you should be able to access all files on your DVD drive
#ls
AppStream  BaseOS  EFI  images  isolinux  media.repo  TRANS.TBL

4. Now create a folder for YUM repository here I creating a folder called rpms in root directroty
# mkdir /rpms

5. and copy AppStream folder and BaseOS folder to /rpms folder

root@cent1 ~#cd /sofware/iso
root@cent1 iso#cp -R AppStream /rpms/
root@cent1 iso#cp -R BaseOS /rpms/
root@cent1 iso]# cp media.repo /etc/yum.repos.d/AppStream.repo 

6. Now edit the AppStream.repo file as below
7. and now copy the Appstream.repo file as BaseOS.repo and edit as below
Note: if you want, you can keep these AppStream and BaseOS settings in single .repo file

now clean the yum repository using yum clean all 
then you can install software with out internet connection which is located in /rpms/ folder 
you can see the repo list using the yum repolist as below. From below list top two repolists which we created.


 




 

No comments:

Post a Comment