Last active
July 29, 2021 01:03
-
-
Save luckylittle/0cc58b9362a11cb50ce471a4b1a52736 to your computer and use it in GitHub Desktop.
Configuration of PXE Boot & Repository server in VirtualBox for automated install of RHEL 8.2 (VirtualBox <-> laptop)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default menu.c32 | |
prompt 0 | |
timeout 300 | |
ONTIMEOUT local | |
label 1 | |
menu label ^1) Install RHEL 8 with Local Repo | |
kernel rhel8/vmlinuz | |
append initrd=rhel8/initrd.img method=http://192.168.130.2/rhel8 devfs=nomount | |
label 2 | |
menu label ^2) Boot from local drive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#interface=eth1 | |
#bind-interfaces | |
domain=localhost.localdomain.local | |
#DHCP range-leases | |
dhcp-range=192.168.130.10,192.168.130.11,255.255.255.0,1h | |
#PXE | |
dhcp-boot=pxelinux.0,pxeserver,192.168.130.2 | |
#Gateway | |
dhcp-option=3,192.168.130.2 | |
#DNS | |
dhcp-option=6,192.168.130.2,8.8.8.8 | |
server=8.8.4.4 | |
#Broadcast address | |
dhcp-option=28,192.168.130.255 | |
#NTP server | |
dhcp-option=42,0.0.0.0 | |
pxe-prompt="Press F8 for menu.",30 | |
pxe-service=x86PC,"Install RHEL 8 from PXE server 192.168.130.2",pxelinux | |
enable-tftp | |
tftp-root=/var/lib/tftpboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HWADDR=08:00:27:47:52:54 | |
TYPE=Ethernet | |
PROXY_METHOD=none | |
BROWSER_ONLY=no | |
BOOTPROTO=none | |
IPADDR=192.168.130.2 | |
PREFIX=24 | |
DEFROUTE=yes | |
IPV4_FAILURE_FATAL=no | |
IPV6INIT=yes | |
IPV6_AUTOCONF=yes | |
IPV6_DEFROUTE=yes | |
IPV6_FAILURE_FATAL=no | |
IPV6_ADDR_GEN_MODE=stable-privacy | |
NAME="Wired connection 1" | |
UUID=7c5b0265-464a-3b3d-9c42-88499a09aaf0 | |
ONBOOT=yes | |
AUTOCONNECT_PRIORITY=-999 | |
DNS1=8.8.4.4 | |
IPADDR1=192.168.130.2 | |
PREFIX1=32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo su - | |
# NetworkManager | |
nmcli con mod Wired\ connection\ 1 ipv4.method static | |
nmcli con mod Wired\ connection\ 1 ipv4.address 192.168.130.2 | |
nmcli con up Wired\ connection\ 1 | |
# DNSMasq | |
dnf install dnsmasq -y | |
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup | |
cp -v dnsmasq.conf /etc/ | |
# Syslinux | |
dnf install syslinux -y | |
# TFTP | |
dnf install tftp-server -y | |
cp -rv /usr/share/syslinux/* /var/lib/tftpboot | |
mkdir /var/lib/tftpboot/pxelinux.cfg | |
cp -v default /var/lib/tftpboot/pxelinux.cfg/ | |
# Assign optical disc rhel-8.2-x86_64-dvd.iso in VirtualBox to the machine | |
mount /dev/sr0 /mnt | |
mkdir /var/lib/tftpboot/rhel8 | |
cp -v /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/rhel8 | |
cp -v /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/rhel8 | |
# Apache | |
dnf install httpd -y | |
setenforce 0 | |
mkdir /var/www/html/rhel8 | |
# Do not forget to copy the hidden files (e.g. .treeinfo), they are important! | |
cp -rvT /mnt /var/www/html/rhel8 | |
chown -Rv apache:apache /var/www/html/rhel8 | |
# Start services | |
systemctl stop firewalld | |
systemctl disable firewalld | |
systemctl start dnsmasq | |
systemctl start httpd | |
systemctl enable dnsmasq | |
systemctl enable httpd | |
# Test Apache2 | |
curl http://localhost/rhel8/.treeinfo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was working for me with Fedora 34 & UEFI
Scenario: Desktop computer <--> Laptop via Ethernet cable, peer to peer. VirtualBox Fedora 34 is used as PXE boot & DHCP.
eno1
), one is bridged WiFi (wlp0s20u3i2
).Fedora-Server-dvd-x86_64-34-1.2.iso
to the VirtualBox machine.192.168.1.1/24
, default gateway192.168.1.2
vianmcli
.Run:
dnf install tftp-server dhcp httpd
dnf install shim-x64 grub2-efi-x64 --installroot=/tmp/fedora --releasever 34
mkdir -p /var/lib/tftpboot/uefi
cp /tmp/fedora/boot/efi/EFI/fedora/{shimx64.efi,grubx64.efi} /var/lib/tftpboot/uefi/
wget https://download.fedoraproject.org/pub/fedora/linux/releases/34/Server/x86_64/os/images/pxeboot/vmlinuz -O /var/lib/tftpboot/vmlinuz
wget https://download.fedoraproject.org/pub/fedora/linux/releases/34/Server/x86_64/os/images/pxeboot/initrd.img -O /var/lib/tftpboot/initrd.img
cp -rvT /mnt /var/www/html/f34
vi /etc/dhcp/dhcpd.conf
:vi /var/lib/tftpboot/uefi/grub.cfg
:firewalld
and start + enabledhcpd
&tftp.socket
&tftp.service
&httpd
.192.168.1.2
address via DHCP and automatically load NBP filenameuefi/shimx64.efi
and start the boot & installation process.