07
2025
06
17:21:59

新一代多系统启动U盘解决方案 Ventoy

新一代多系统启动U盘解决方案 Ventoy

启动盘制作

使用 Windows 制作启动盘

  • 安装 ventoy 到 U 盘

下载最新版本:https://github.com/ventoy/Ventoy/releases/download/v1.1.05/ventoy-1.1.05-windows.zip

解压后打开 ventoy-1.1.05 目录
运行 Ventoy2Disk.exe
确认 U 盘设备
运行安装等待结束

使用 macOS 制作启动盘

  • 安装 ventoy 到 U 盘

# wget https://github.com/ventoy/Ventoy/releases/download/v1.1.05/ventoy-1.1.05-linux.tar.gz
# tar xzvf ventoy-1.1.05-linux.tar.gz
# cd ventoy-1.1.05

# brew install --HEAD https://raw.githubusercontent.com/daniel-toman/homebrew-exfat/master/Formula/exfat.rb
# cp -rp /usr/bin/hexdump /usr/local/bin/xzcat tool/x86_64
# brew tap daniel-toman/exfat
# brew install --HEAD exfat

# diskutil list
# diskutil unmountDisk /dev/disk2
...

# ./Ventoy2Disk.sh -i /dev/disk2

使用 Linux 制作启动盘

  • 安装 ventoy 到 U 盘或本地盘

# wget https://github.com/ventoy/Ventoy/releases/download/v1.1.05/ventoy-1.1.05-linux.tar.gz# tar xzvf ventoy-1.1.05-linux.tar.gz# cd ventoy-1.1.05# yum install -y tar wget dosfstools exfatprogs# lsblk...# ./Ventoy2Disk.sh -i /dev/sdb...   Install Ventoy to /dev/sdb successfully finished.# lsblk /dev/sdbNAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb      8:16   0  16G  0 disk
├─sdb1   8:17   0  16G  0 part
└─sdb2   8:18   0  32M  0 part# sdb1 默认使用的是 exfat 格式, 也可将 sdb1 重新格式化其他格式

U 盘安装系统

普通安装

只需要把 ISO/WIM/IMG/VHD(x)/EFI 等类型的文件直接拷贝到 U 盘里即可

自动安装

  • 挂载数据盘

# mount /dev/sdb1 /mnt
  • 上传 ISO 文件

# mkdir /mnt/isos    # 上传文件到此目录下: /mnt/isos/CentOS-8.5.2111-x86_64-dvd1.iso
  • 上传 KS 应答文件

# mkdir /mnt/templates    # 上传文件到此目录下: /mnt/templates/centos8.5-ks.cfg
  • 配置自动安装

以 CentOS8.5.2111 自动安装为例

# cat /mnt/ventoy/ventoy.json
  {
      "auto_install":[
          {
              "image": "/isos/CentOS-8.5.2111-x86_64-dvd1.iso",
              "template":[
  		    "/ventoy/templates/centos8.5-ks.cfg"
  	    ],
              "autoselect": 1,
              "timeout": 10
          },
          {
              "image": "/isos/CentOS-8.5.2111-x86_64-boot.iso",
              "template":[
  		    "/ventoy/templates/centos8-ks-localdisk.cfg",
  		    "/ventoy/templates/centos8-ks-internet.cfg"
  	    ],
              "autoselect": 1,
              "timeout": 10
          }
      ]
  }
  • 启动安装测试

开机 U 盘启动
  - CentOS-8.5.2111-x86_64-dvd1.iso
  - Boot with /script/centos8-ks.cfg
  - Boot in normal mode
  - 进入正常安装界面选择安装即可
  • 附 KS 文件示例

#version=RHEL8
# Use CDROM installation media
cdrom
#url --url=http://192.168.33.20/jos/4.0/os/x86_64/

# Use text/graphical mode install
#graphical
text

# Do not configure the X Window System
skipx

# Run the Setup Agent on first boot
firstboot --disable

# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'

# System language
lang en_US.UTF-8 --addsupport=""

# Network information
network --hostname=localhost.localdomain
network --bootproto=dhcp   --device=eth0  --onboot=yes --ipv6=auto --activate
network --bootproto=static --device=ens18 --onboot=off --ipv6=auto --activate --gateway=192.168.103.254 --ip=192.168.103.106 --netmask=255.255.255.0 --nameserver=114.114.114.114
#repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream

# Root password
rootpw --iscrypted $6$rounds=656000$XOnNPMrf7WaTCcpp$qkoKmih/JqnzovPxnMBmEi65hltSXzzwcjbHPlktl8t4rLSXpMrXz4R/LldMYGOTU/tPPScajqo1vx2rBimKS0
user --groups=wheel --name=oops --password=$6$rounds=656000$JaFBqKo9a1yeUJkp$ToIvKwAflwAxxDp96ru25fgdbNbBZyZQXVxtW0WMDjaFyz6LHiHWk/hOEnNezygoKu/KLfpEbB5Nh2EVvuqNx1 --iscrypted --uid=1000 --gecos="oops" --gid=1000

# System services
services --enabled="chronyd"
services --enabled="NetworkManager"
services --disabled="postfix"

# Firewall configuration
firewall --disabled

# SELinux configuration
selinux --disabled

# System timezone
timezone Asia/Shanghai --nontp

# System bootloader configuration
bootloader --location=mbr --boot-drive=sda

# Ignore disks (include usb/hda/vda)
#ignoredisk --only-use=sda
%include /tmp/ignoredisk.cfg

# Clear the Master Boot Record
zerombr

# Partition clearing information
clearpart --all --initlabel --drives=sda

# Disk partitioning information
part /boot --fstype="xfs"  --ondisk=sda --size=1024
part swap  --fstype="swap" --ondisk=sda --grow --size=4096 --maxsize=16384 --recommended
part /     --fstype="xfs"  --ondisk=sda --grow --size=1024 --maxsize=307200

#part /boot --fstype="xfs" --ondisk=sda --size=1024
#part pv.109 --fstype="lvmpv" --ondisk=sda --size=1 --grow
#volgroup centos --pesize=4096 pv.109
#logvol swap --fstype="swap" --grow --size=4096 --recommended --maxsize=16384 --name=swap --vgname=centos
#logvol / --fstype="xfs" --grow --maxsize=307200 --size=1024 --name=root --vgname=centos

# Reboot after installation
#reboot --eject
poweroff

%packages --ignoremissing
@^minimal-environmentkexec-toolsbc
jq
vim
net-tools
%end

%addon com_redhat_kdump --enable --reserve-mb='auto'
%end

# Create a %pre section as below
%pre --interpreter=/usr/bin/bash
#ls /dev/disk/by-path/*usb* && echo "ignoredisk --drives=/dev/disk/by-path/*usb*" >/tmp/ignoredisk.cfg
readlink -e /dev/disk/by-path/*usb* | awk '!/[0-9]+$/ && !a[$1]++' | sed 'N;s/\n/,/' | while read i; do echo "ignoredisk --drives=$i"; done > /tmp/ignoredisk.cfg
%end

# Create a %post section as below
%post --log=/var/log/centos-init.log --interpreter=/usr/bin/bash
# user
cat > /etc/sudoers.d/oops <<EOF
oops ALL=(ALL) NOPASSWD:ALL
EOF





推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

本文链接:https://www.hqyman.cn/post/11518.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:
打赏





休息一下~~


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

请先 登录 再评论,若不是会员请先 注册

您的IP地址是: