Skip to content

Instantly share code, notes, and snippets.

@pfandl
Last active March 31, 2020 05:09
Show Gist options
  • Save pfandl/f5f18441c27464a9ba52c24ada0dd79d to your computer and use it in GitHub Desktop.
Save pfandl/f5f18441c27464a9ba52c24ada0dd79d to your computer and use it in GitHub Desktop.
Create a read-write overlay of / on the installation medium and chroot into it
# RAW: https://bit.ly/2UvzYZ6
# * Boot into the Rescue option of the ISO.
# * ALT+TAB to get into shell or wait for the option 3)
# * setup networking
# ncmli connection up enp0s3
# * setup keymap to not get insane
# localectl set-keymap at
# * prepare overlayfs
mkdir /tmp/upper /tmp/work /tmp/root
mount -t overlay overlay -o lowerdir=/,upperdir=/tmp/upper,workdir=/tmp/work /tmp/root
# chroot into write enabled overlay of root
cat << FOE | chroot /tmp/root
# * Prepare YUM repo
mkdir /etc/yum.repos.d
cat << EOF > /etc/yum.repos.d/CentOS-Base.repo
[BaseOS]
name=CentOS-\$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=BaseOS&infra=\$infra
#baseurl=http://mirror.centos.org/\$contentdir/\$releasever/BaseOS/\$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
# * need some DNS server
echo "nameserver 1.1.1.1" > /etc/resolv.conf
FOE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment