How to create Linux local repo using iso image
Create local repository using iso image to installation oracle rpm.
This blog will cover the local repository creation using iso image. Most environment customers are not exposing their servers to internet due to many security reasons. So we need to find a way to installed required rpm using yum. This is article is all about addressing this rpm installation from yum repo. default yum repos are working with internet. But we can create local repo to run yum commands with out using internet.
In this scenario, we are using cdrom to mount the iso image and create a local repository using the iso image.
For this testing we are using virtual box to mount the iso image.
First change the boot priority and mount the image to virtual cdrom.
Change the boot priority as mentioned below.
After mounting this to virtual machine. run df -h to verify that cdrom is mounted to linux machine.
[root@crs01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 1.8G 4.0K 1.8G 1% /dev/shm
tmpfs 1.8G 9.5M 1.8G 1% /run
tmpfs 1.8G 0 1.8G 0% /sys/fs/cgroup
/dev/mapper/ol-root 38G 5.4G 32G 15% /
/dev/mapper/oradatavg-oradatalv 19G 45M 18G 1% /oradata
/dev/mapper/orabinvg-orabinlv 29G 45M 27G 1% /u01
/dev/mapper/ol-home 19G 33M 19G 1% /home
/dev/sda1 1014M 235M 780M 24% /boot
tmpfs 365M 28K 365M 1% /run/user/0
/dev/sr0 4.5G 4.5G 0 100% /run/media/root/OL-7.9 Server.x86_64
[root@crs01 ~]#
1. Create a soft link to cdrom
[root@crs01 cdrom]# mkdir /cdrom
[root@crs01 cdrom]# ln -s '/run/media/root/OL-7.9 Server.x86_64' /cdrom/ -- As this has space we have to use quotations
[root@crs01 cdrom]# cd /cdrom/
[root@crs01 cdrom]# ls -lrth
total 0
lrwxrwxrwx. 1 root root 36 Sep 22 14:51 OL-7.9 Server.x86_64 -> /run/media/root/OL-7.9 Server.x86_64
1.1 Install create repo package.
[root@crs01 OL-7.9 Server.x86_64]# cd Packages/
[root@crs01 Packages]# ls -l createrepo*
-rw-rw-r--. 1 root root 95344 May 27 2017 createrepo-0.9.9-28.el7.noarch.rpm
[root@crs01 Packages]# rpm -ivh createrepo-0.9.9-28.el7.noarch.rpm
warning: createrepo-0.9.9-28.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ################################# [100%]
package createrepo-0.9.9-28.el7.noarch is already installed
[root@crs01 Packages]#
1.2 Create repo
1.3 Add entry to yum.repos.d
There will be more repo entries that use internet to download rpm files. so you can move this files to get clean output for yum repolist output.
######## create yum reportformat
[root@crs01 Packages]# cat /etc/yum.repos.d/cdrom.repo
[cdrom]
name=OL7.9
baseurl=file:///cdrom
gpgcheck=0
enable=0
[root@crs01 Packages]#
-- move yum entries as mention below.
root@crs01 Packages]# cd /etc/yum.repos.d/
[root@crs01 yum.repos.d]# ls -lrth
total 20K
-rw-r--r--. 1 root root 226 Jul 1 2020 virt-ol7.repo
-rw-r--r--. 1 root root 2.6K Jul 1 2020 uek-ol7.repo
-rw-r--r--. 1 root root 4.2K Jul 1 2020 oracle-linux-ol7.repo
-rw-r--r--. 1 root root 61 Sep 22 14:56 cdrom.repo
[root@crs01 yum.repos.d]# mv virt-ol7.repo virt-ol7.repo.ori
[root@crs01 yum.repos.d]# mv uek-ol7.repo uek-ol7.repo.ori
[root@crs01 yum.repos.d]# mv oracle-linux-ol7.repo oracle-linux-ol7.repo.ori
1.4 Verification.
[root@crs01 yum.repos.d]# yum repolist
Loaded plugins: langpacks, ulninfo
repo id repo name status
cdrom OL7.9 5,320
repolist: 5,320
2 Install oracle pre requisite packages to 19c.
[root@crs01 yum.repos.d]# yum install -y oracle-database-preinstall-19c
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-19c.x86_64 0:1.0-2.el7 will be installed
--> Processing Dependency: libaio-devel for package: oracle-database-preinstall-19c-1.0-2.el7.x86_64
--> Processing Dependency: ksh for package: oracle-database-preinstall-19c-1.0-2.el7.x86_64
--> Running transaction check
---> Package ksh.x86_64 0:20120801-142.0.1.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================================================================
Installing:
oracle-database-preinstall-19c x86_64 1.0-2.el7 cdrom 19 k
Installing for dependencies:
ksh x86_64 20120801-142.0.1.el7 cdrom 882 k
libaio-devel x86_64 0.3.109-13.el7 cdrom 12 k
Transaction Summary
=============================================================================================================================================================================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 914 k
Installed size: 3.2 M
Downloading packages:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 105 MB/s | 914 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : ksh-20120801-142.0.1.el7.x86_64 1/3
Installing : libaio-devel-0.3.109-13.el7.x86_64 2/3
Installing : oracle-database-preinstall-19c-1.0-2.el7.x86_64 3/3
Verifying : oracle-database-preinstall-19c-1.0-2.el7.x86_64 1/3
Verifying : libaio-devel-0.3.109-13.el7.x86_64 2/3
Verifying : ksh-20120801-142.0.1.el7.x86_64 3/3
Installed:
oracle-database-preinstall-19c.x86_64 0:1.0-2.el7
Dependency Installed:
ksh.x86_64 0:20120801-142.0.1.el7 libaio-devel.x86_64 0:0.3.109-13.el7
Complete!