PXEブートによるFedoraネットワークのインストール

PXEブートによるFedoraネットワークのインストール

PXEブートを使用してネットワーク経由でFedoraをインストールする方法は?

同期:ターゲットシステムのBIOSはUSB大容量記憶装置から起動できません。もう一つの動機は、ネットワークを介したリリースの利便性が高いことです。

課題:LANには変更できないDHCPサーバーがすでにあります。つまり、PXE固有のオプション設定をサポートしていないサーバーです(Fritz Boxルーターの一部です)。

ベストアンサー1

以下を設定することもできます。プロキシDHCPサービスPXE。これにより、既存のDHCPサーバーを変更する必要がなくなります。その後、通常のLinuxシステム(ワークステーションなど)を使用してPXE(Preboot Execution Environment)をホストできます。

ネットワークブート用にPXEを設定するには、次の手順が必要です。Fedoraネットワークインストールイメージ(また、Fedoraホストだと仮定):

認証イメージ

$ gpg --verify Fedora-Server-21-x86_64-CHECKSUM
$ sha256sum --check Fedora-Server-21-x86_64-CHECKSUM
Fedora-Server-netinst-x86_64-21.iso: OK

イメージのインストール

mkdir /mnt/iso
mount -o loop Fedora-Server-netinst-x86_64-21.iso /mnt/iso

DHCP設定

yum install dnsmasq tftp-server syslinux-tftpboot

このtftp-serverパッケージはディレクトリの作成にのみ使用され、/var/lib/tftpbootdnsmasq は tftp サーバーを統合しました。

構成:

cat > /etc/dnsmasq.conf
interface=enp0s25
# and don't bind to 0.0.0.0
bind-interfaces
# extra logging
log-dhcp
dhcp-range=192.168.178.0,proxy
# first IP address is the one of the host
dhcp-boot=pxelinux.0,192.168.178.34,192.168.178.0
pxe-service=x86PC,"Automatic Network Boot",pxelinux
# Specify the IP address of another tftp server
enable-tftp
# default location of tftp-server on Fedora
tftp-root=/var/lib/tftpboot
# disable DNS
port=0

始めましょう:

systemctl start dnsmasq.service

TFTP ディレクトリ設定

必要なファイルをすべてコピーします。

cp /mnt/iso/images/pxeboot/initrd.img /var/lib/tftpboot
cp /mnt/iso/images/pxeboot/vmlinuz /var/lib/tftpboot
cp /tftpboot/pxelinux.0 /var/lib/tftpboot
cp /tftpboot/vesamenu.c32 /var/lib/tftpboot
cp /tftpboot/ldlinux.c32 /var/lib/tftpboot
cp /tftpboot/libcom32.c32 /var/lib/tftpboot
cp /tftpboot/libutil.c32 /var/lib/tftpboot

構成の追加:

mkdir /var/lib/tftpboot/pxelinux.cfg
cat > /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
prompt 0
# disable timeout
timeout 0
#timeout 600

# if file is missing, this is ignored
display boot.msg

label linux
  menu label Install Fedora 21 Server x86-64
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=http://workstation.example.org/

HTTPサーバーの設定

yum install nginx

構成例:

cat > /etc/nginx/conf.d/iso.conf
  server {
      listen       80 default_server;
      server_name  localhost;
      root         /mnt/iso ;
      include /etc/nginx/default.d/*.conf;
  }

デフォルトインスタンスを無効にするか、別のポートに移動します。

--- a/nginx/nginx.conf
+++ b/nginx/nginx.conf
@@ -43,7 +43,7 @@ http {
     include /etc/nginx/conf.d/*.conf;

     server {
-        listen       80 default_server;
+        listen       8080 default_server;
         server_name  localhost;
         root         /usr/share/nginx/html;

サーバーを起動します。

systemctl start nginx.service

Fedoraインストーラ(dracut)は、デフォルトでhttpサーバーからファイルをインポートする必要があります。

LiveOS/squashfs.img

ファイアウォールの構成

firewall-cmd --add-service=http
firewall-cmd --add-service=dhcp
firewall-cmd --add-service=tftp
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=dhcp --permanent
firewall-cmd --add-service=tftp --permanent

クライアントの起動

それはすべてです。クライアントはPXEを介してネットワークブートを行い、Fedoraネットワークインストールイメージを取得できることが知られています。

変更は次のとおりです。完全に自動化されたネットワークインストール用のキックスタートファイルの追加(およびタイムアウト設定)、さまざまなクライアント用のさまざまなPXE設定の構成(MACアドレスベース)など

掃除する

デーモンを停止してループバックイメージをアンマウントできます。

systemctl stop nginx.service
systemctl stop dnsmasq.service
umount /mnt/iso

安全マニュアル

ネットワークブートクライアントはTFTPとHTTPを介して構成と完全に安全でない複数のイメージを取得するため、この方法は信頼できるイントラネット内でのみ実行できます。

おすすめ記事