PXE网络安装深度Deepin操作系统的设置方法
Tofloor
poster avatar
deepinuser17
deepin
2020-09-19 08:21
Author
本帖最后由 deepinuser17 于 2020-9-19 00:24 编辑

用PXE网络安装法可以同时安装多台机器,是大规模安装深度机器的首选。

这个方法使用Dnsmasq. Dnsmasq是一个轻量的域名解析,DHCP服务器。 同时Dnsmasq还提供tftp文件传输。
https://wiki.debian.org/dnsmasq

基本信息(范例):
PXE网络安装服务器的网卡名: eth0
PXE网络安装服务器设定的DHCP地址范围:192.168.10.91-192.168.10.99
PXE网络安装服务器的IP地址: 192.168.10.90
局域网的gateway地址: 192.168.10.1

以上参数要根据当地局域网的情况更改。

注意: 要用文本编辑器,如vim, nano, 深度editor来编辑文件.  跟据当地网络的具体参数加以调整。 DHCP网址范围不能与其它DHCP服务器指定的范围冲突.  如果路由器上有DHCP服务,可以缩小范围。用腾出的范围给dnsmasq. 另一种方法是,建立一个独立的局域网,专门用来安装。

以下是设置步骤:

1. 使用深度20U盘或光盘正常安装深度

2. 安装和设置dnsmasq
  1. sudo apt update && sudo apt -y install dnsmasq
  2. sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
Copy the Code

      编辑/etc/dnsmasq.conf,内容如下
  1. interface=eth0

  2. dhcp-range=192.168.10.91,192.168.10.99,255.255.255.0,8h
  3. dhcp-option=option:router,192.168.10.1
  4. dhcp-option=option:dns-server,192.168.10.1

  5. enable-tftp
  6. tftp-root=/srv/tftp
  7. dhcp-boot=pxelinux.0,pxeserver,192.168.10.90
  8. pxe-prompt="Press F8 for PXE Network boot.", 30
  9. pxe-service=x86PC, "Install Deepin from PXE network server", pxelinux
Copy the Code
     创建文件夹

  1. sudo mkdir -p /srv/nfs/deepin20
  2. udo mkdir -p /srv/tftp/deepin/20
Copy the Code


3. 安装PXE启动文件; 创建深度安装菜单
  1. sudo apt install -y syslinux pxelinux
  2. sudo cp -v /usr/lib/PXELINUX/pxelinux.0 /srv/tftp/
  3. sudo cp -v  /usr/lib/syslinux/modules/bios/{hdt.c32,ldlinux.c32,libcom32.c32,libutil.c32,vesamenu.c32} /srv/tftp
  4. sudo mkdir -p /srv/tftp/pxelinux.cfg
Copy the Code

    创建深度安装菜单。 编辑/srv/tftp/pxelinux.cfg/default内容如下。
  1. default vesamenu.c32
  2. prompt 0
  3. timeout 50

  4. label live
  5.         menu label ^Install Deepin 20 with kernel 5.4 desktop
  6.         menu default
  7.         linux deepin/20/vmlinuz
  8.         initrd deepin/20/initrd.lz
  9.         append boot=live livecd-installer components quiet splash netboot=nfs nfsroot=192.168.1.90:/srv/nfs/deepin20/ locales=zh_CN.UTF-8

  10. label live
  11.         menu label ^Install Deepin 20 with kernel 5.4 desktop (Safe graphics)
  12.         linux deepin/20/vmlinuz
  13.         initrd deepin/20/initrd.lz
  14.         append boot=live livecd-installer components quiet splash nomodeset netboot=nfs nfsroot=192.168.1.90:/srv/nfs/deepin20/ locales=zh_CN.UTF-8

  15. label live
  16.         menu label ^Install Deepin 20 with kernel 5.7 desktop
  17.         linux deepin/20/vmlinuz-5.7.7
  18.         initrd deepin/20/initrd-5.7.7.lz
  19.         append boot=live livecd-installer components quiet splash netboot=nfs nfsroot=192.168.1.90:/srv/nfs/deepin20/ locales=zh_CN.UTF-8

  20. label live
  21.         menu label ^Install Deepin 20 with kernel 5.7 desktop (Safe graphics)
  22.         linux deepin/20/vmlinuz-5.7.7
  23.         initrd deepin/20/initrd-5.7.7.lz
  24.         append boot=live livecd-installer components quiet splash nomodeset netboot=nfs nfsroot=192.168.1.90:/srv/nfs/deepin20/ locales=zh_CN.UTF-8
Copy the Code

4. 拷贝Deepin20安装文件

   下载Deepin 20 iso文件,并放在/tmp.  如果放在不同的文件夹,以下命令要修改路径
  1. sudo mount -o loop -t iso9660 /tmp/deepin-desktop-community-1002-amd64.iso /mnt
  2. sudo cp -Rfv /mnt/* /srv/nfs/deepin20
  3. sudo cp /srv/nfs/deepin20/live/{initrd*,vmlinuz*} /srv/tftp/deepin/20
Copy the Code

5. 设置NFS服务

    安装NFS软件包:
  1. sudo apt install nfs-kernel-server
Copy the Code

   创建/修改NFS共享文件。编辑/etc/exports,加入以下内容:
  1. /srv/nfs        192.168.1.0/24(ro,sync,no_subtree_check)
Copy the Code
   
    输出NFS共享的路径:
  1. sudo exportfs -a
Copy the Code

以上步骤完成以后, 就可以通过PXE网络启动来安装Deepin 20了。  安装时,选用网络启动,然后挑选某一个选项。


参考文章:
https://bbs.deepin.org/post/188317
https://linuxhint.com/pxe_boot_ubuntu_server/






Reply Favorite View the author
All Replies
sailing110
deepin
2022-02-22 07:20
#1

十分感谢楼主的分享。用了将近一天的时间,按照楼主的保姆级教程,成功的实现了-PXE下deepin20的安装。此刻我是兴奋的,只能再次的感谢楼主无私的奉献!!!

Reply View the author