ZBLOG

内网 实现 pxe 安装debian

要在内网中实现 PXE 安装 Debian,您需要完成以下步骤:

  1. 确保您的网络拓扑支持 PXE 启动和 TFTP 服务。

  2. 在一台服务器上安装 TFTP 服务。这可以使用 apt-get 命令安装:

sudo apt-get install tftpd-hpa
  1. 配置 TFTP 服务器以启用 PXE 引导。编辑 /etc/default/tftpd-hpa 文件,并确保以下行存在并取消注释:
TFTP_OPTIONS="--secure"
  1. 将 Debian ISO 映像文件下载到 TFTP 服务器的根目录中。例如,如果您要下载 Debian 10 Buster 的 ISO 映像,则可以使用以下命令:
sudo wget http://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.5.0-amd64-netinst.iso -O /var/lib/tftpboot/debian-10.5.0-amd64-netinst.iso
  1. 创建一个名为 pxelinux.cfg 的目录,并在其中创建一个名为 default 的文件夹。例如,
sudo mkdir -p /var/lib/tftpboot/pxelinux.cfg/default/
sudo touch /var/lib/tftpboot/pxelinux.cfg/default
  1. 编辑 default 文件以包含以下内容:
default linux
prompt 0
timeout 1

label linux
menu label ^Install Debian Linux
kernel debian-installer/amd64/linux
append initrd=debian-installer/amd64/initrd.gz netcfg/disable_autoconfig=true netcfg/get_hostname=mydebian preseed/url=http://<your-web-server>/preseed.cfg auto=true priority=critical ---
  1. 创建一个名为 preseed.cfg 的文件,其中包含要应用于 Debian 安装的预设设置。以下是示例 preseed.cfg 文件:
# Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string mydebian
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/get_ipaddress string 192.168.1.100
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 192.168.1.1
d-i netcfg/get_nameservers string 8.8.8.8

# Mirror settings
d-i mirror/country string manual 
d-i mirror/http/hostname string ftp.us.debian.org 
d-i mirror/http/directory string /debian 
d-i mirror/http/proxy string 

# Partitioning settings
partman-auto partman-auto/method select regular 
partman-auto/choose_recipe select atomic 
partman/default_filesystem ext4 
partman-partitioning/confirm_write_new_label boolean true 
partman/choose_partition select finish 
partman/confirm boolean true 

# Account setup
passwd/root-login boolean false 
passwd/user-fullname string My User Name 
passwd/username string myuser 
passwd/user-password-crypted password $6$WjUwVWxGmTwKcUQh$cLRxOncZz7E0P2XlLs9CJyf5.BwRuSHAV3JvXbmeYnFg7mbjRq/UeMkCu4uKu9TmAz0.bkQDGM5VoHzZLPKD80 

# Grub bootloader settings
grub-installer/only_debian boolean true 
grub-installer/bootdev string default 

# Package selection
tasksel tasksel/first multiselect standard, ssh-server

# Finish installation without manual intervention
d-i finish-install/reboot_in_progress note 
d-i debian-installer/exit/halt boolean false 
d-i debian-installer/exit/poweroff boolean false
  1. 将 preseed.cfg 文件上传到 Web 服务器,以便在安装期间使用。请注意,preseed.cfg 文件中的 URL 应该指向您的 Web 服务器。

  2. 启动客户端计算机,并确保其支持 PXE 引导。

  3. 在客户端计算机上,通过按 F12 或类似键启动网络引导。计算机应该从 TFTP 服务器启动 Debian 安装程序,并使用预设设置自动完成安装过程。

希望这些步骤对您有所帮助!

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=3634

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?