Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (SIDEBAR 2)
NOTE: there is a problem with NFS clients, that if the target server (source) of a shared NFS mount is offline when the client tries to shutdown, the client can, and usually does, hang for some period of time trying to contact the NFS server and “gracefully” close the connection (even though there isn’t a connection to close). [ I couldn’t make this up. ]
Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (SIDEBAR 1)
Downloaded ISOs can be mounted under /var/www/html/repos/{version}/{}/ and served to NetInstall clients by HTTP (or NFS).
- mkdir /var/www/html/repos/c7x64/ISOeverything/
- mount /dev/cdrom/ /var/www/html/repos/c7x64/ISOeverything/
- http://{ip-address}/repos/c7x64/ISOeverything
- http://mirror.centos.org/centos/7/os/x86_64/
- http://mirror.centos.org/altarch/7/os/i386/
- http://mirror.centos.org/centos/6/os/x86_64/
- http://mirror.centos.org/centos/6/os/i386/
- https://mirrors.kernel.org/fedora/releases/29/Everything/x86_64/os/
- use a subscribed node to run a reposync script against the desired repos,
- cp the PXE boot/install images from a downloaded ISO (matching the ReleaseVersion/Arch), compare the ISO location of the boot images to their online repos and find the correct URL path/pattern for future use.
- use a Kickstart ” %POST ” script for newly installed PXE/KS clients to join the subscription mgr.
- mkdir /var/www/html/repos/f29x64/
- mkdir /var/www/html/repos/f29x64/{base,extras,updates,epel}
- mkdir /var/www/html/repos/f29x64/base/LiveOS
- cd /var/www/html/repos/f29x64/base/LiveOS
- curl -o https://mirrors.kernel.org/fedora/releases/29/Everything/x86_64/os/images/install.img
- mkdir /var/lib/tftpboot/Fedora29x64/
- cd /var/lib/tftpboot/Fedora29x64/
- curl -o https://mirrors.kernel.org/fedora/releases/29/Everything/x86_64/os/images/pxeboot/initrd.img
- curl -o https://mirrors.kernel.org/fedora/releases/29/Everything/x86_64/os/images/pxeboot/vmlinuz
- nano /var/lib/tftpboot/pxelinux.cfg/default # add menu item(s) for booting Fedora.
- nano /var/www/html/repos/f29.ks # make/edit kickstart file for Fedora install.
Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 14)
Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 13)
This config is on the VMware host. In my case, that’s a MacOS Mojave MacBook Pro running VMware Fusion. Any recent VMware hypervisors (Fusion, Workstation ESXi) are capable of providing this. VirtualBox and Parallels can to. This scope of this guide is staying with VMware Fusion on MacOS.
* for simplicity, this VMNET config uses an entire class c range (private/non-routable of course), and then allocates the bottom half for static IP and lets the DHCP process serve the top half.
Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 12)
- this is how/where those are provided to the PXE/Kickstart clients.
- Each targeted Distro/Release/Arch requires a matching “LiveOS” be provided.
- When the client node boots into this image, this is what runs the Anaconda installer (and processes the kickstart script).
- cp /mnt/cdrom/LiveOS/* /var/www/html/repos/c7x64/base/LiveOS/
- # OR: cp /run/media/{username}/CentOS\ 7\ x86_64/LiveOS/* /var/www/html/repos/c7x64/base/LiveOS/
- # cp /run/media/elmer/CentOS\ 7\ x86_64/LiveOS/* /var/www/html/repos/c7x64/base/LiveOS/
Now, switch to the the 32 bit ISO and cp those files as well:
- umount /dev/cdrom
- mount /dev/cdrom/ /mnt/cdrom/
- cp /mnt/cdrom/isolinux/{vmlinuz,initrd.img,splash.png} /var/lib/tftpboot/CentOS7x32/
- cp /mnt/cdrom/LiveOS/* /var/www/html/repos/c7x32/base/LiveOS/
Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 11)
Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 10)
- 2 kickstart configs for CentOS 7 64-bit (c7x64).
- 1 kickstart config for CentOS 7 32-bit (c7x32).
- non-kickstart netinstall of c7x64 or c7x32, using local repos.
- non-kickstart netinstall of c7x64 or c7x32, using online internet mirror repos.
- menu DEFAULT is set to boot from local hard drive (to avoid accidentally overwriting an existing system).
Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 9)
- enable firewall port for tftp
- enable the service.
- systemctl start tftp.socket
- systemctl enable tftp.socket
- put some important files into the tftp server location:
- cd /var/lib/tftpboot # // it starts out empty.
- cp /usr/share/syslinux/{pxelinux.0,vesamenu.c32} . # // now it has those two files in it.
- Create a menu for the PXE Service… (the options a client machine gets):
- mkdir /var/lib/tftpboot/pxelinux.cfg
- cd /var/lib/tftpboot/pxelinux.cfg/
- nano default
Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 8)
STEP 8 – CREATE /etc/yum.repos.d/c7x32.repo for the CentOS 7 32-bit REPOSYNC CLIENTS:
note: client machine has to have nss-mdns (avahi-daemon) working, or file will need to be edited with server’s IP ADDRESS.
provide a copy of the file at “http://c7pxe.local/repos/client-files/c7x32.repo” from
folder “/var/www/html/repos/client-files/”
subsequent kickstart scripts will get that file during system installations.
# File:/etc/yum.repos.d/c7x32.repo
[c7x32-base]
name=CentOS Base
baseurl=http://c7pxe.local/repos/c7x32/base/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
[c7x32-extras]
name=CentOS Extras
baseurl=http://c7pxe.local/repos/c7x32/extras/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
[c7x32-updates]
name=CentOS Updates
baseurl=http://c7pxe.local/repos/c7x32/updates/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1