How to create yum repos from ISO

Environment

  • rhel-mirror.on.ec

Version information

  • RHEL 7.3

Copy pakages to local

In rhel-mirror

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# copy rhel-server-7.3-x86_64-dvd.iso into rhel-mirro
mkdir -p /media/cdrom/
mv rhel-server-7.3-x86_64-dvd.iso /media/cdrom
# Mount rhel-server-7.3-x86_64-dvd.iso
mkdir -p /media/rh73
mount -o loop /media/cdrom/rhel-server-7.3-x86_64-dvd.iso /media/rhel73
# Copy Packages to local
mkdir -p /repos/centos/7/3
cp -arv /media/rhel73/Packages/* /repos/centos/7/3
# Create Repo metadata in local
yum install httpd createrepo
cd /repos/centos/7/3 && createrepo .
# Setup httpd
ln -s /repos/centos /var/www/html/centos
firewall-cmd --zone=public --add-service=http
# For SELinux Enable
chcon -R -t httpd_sys_content_t /reops/centos
chcon -R -t httpd_sys_content_t /var/www/html/centos
# Clean
umount /media/rhel73
rm -rf /media/rhel73

Configure Repository on Client

1
2
3
4
5
6
7
8
cat << 'EOF' > /etc/yum.repos.d/RHEL73.repo
[RHEL73]
name=Red Hat Enterprise Linux 7.3
baseurl=http://bsshost1.on.ec/CentOS/7/3
gpgcheck=0
EOF
yum repolist
yum update