create OL9 minimal image

From ChmEarl, 4 Months ago, written in Plain Text, viewed 113 times.
URL https://pb.dynavirt.com/view/9b397e98 Embed
Download Paste or View Raw
  1. sudo mkdir /var/tmp/zzol9
  2.  
  3. sudo rpm --root=/var/tmp/zzol9/ --import -D '_db_backend sqlite' /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
  4. #tree zzol9/
  5.  
  6. // do the business install a minimal install, enough to run the dnf installer
  7. sudo dnf --releasever=9 --installroot=/var/tmp/zzol9 install oraclelinux-release-el9 dnf rpm nano dnf-plugins-core glibc-langpack-en --nogpgcheck \
  8.  --nodocs --setopt=module_platform_id=platform:el9 --repofrompath=mga8rel,https://yum.oracle.com/repo/OracleLinux/OL9/baseos/latest/x86_64/  \
  9.   --disablerepo=* --enablerepo=mga8rel --exclude=gnome*
  10.  
  11. cd
  12. mkdir tmpstrap && cd $_
  13.  
  14. cat >> schroot.sh<<EOL
  15. #!/bin/sh
  16.  
  17. PATH=$PATH:/sbin:/usr/sbin
  18.  
  19. # /var/cache/pbuilder
  20. RT=/var/tmp/${1-"zzol9"}
  21.  
  22. echo "rt=$RT"
  23.  
  24. # below for partitioned block device
  25. #mount $VM $RT -o offset=1048576
  26. ## --------- end control -------
  27.  
  28. # bindmount
  29. #BM=home/mockbuild/pbdeps
  30.  
  31. for i in dev dev/pts proc sys run ; do
  32.         mount -o bind /$i $RT/$i
  33.         echo "mount $i"
  34. done
  35.  
  36. LC_ALL=C chroot $RT /bin/bash
  37.  
  38. for i in run dev/pts dev proc sys ; do
  39.         umount $RT/$i
  40.         echo "umount $i"
  41. done
  42.  
  43. EOL
  44.  
  45. chmod +x schroot.sh
  46.  
  47. // enter chroot, add a nameserver to /etc/resolv.conf, clean all
  48. sudo ./schroot.sh
  49.  
  50. cd /var/tmp/zzol9/
  51. sudo tar -Ipzstd -cf ~/ol9-min.tar.zst ./
  52.  

Reply to "create OL9 minimal image"

Here you can reply to the paste above

captcha