多语言展示
当前在线:1221今日阅读:22今日分享:22

centos7.0制作全自动安装盘

centos7.0全自动安装盘,省去了很多麻烦的选择步骤,适用于大批量的安装系统
工具/原料

centos7.0 一台虚拟机

方法/步骤
1

复制光盘文件挂载 iso 镜像创建目录用于挂载光盘:mkdir /root/centos7挂载 iso 镜像 mount -o loop CentOS-7.0-1406-x86_64-DVD.iso  /root/centos7

2

复制光盘文件到编辑目录进行编辑因为挂载上 iso 镜像是只读的,如果要编辑,需要将文件复制出来,再编辑。首先创建编辑目录:mkdir /root/centos7_iso复制光盘文件:cp -rf /root/centos7/* /root/centos7_iso/diskinfo 文件需求单独拷贝下: cp /root/centos7/.discinfo /root/iso

3

编辑 ks.cfg 文件系统安装的时候,按照 ks.cfg 文件的内容进行安装,我们把 ks.cfg 文件放到 isolinux 目录下: cd /root/centos7_iso/isolinuxvim ks.cfg我的 ks.cfg 文件内容如下: #version=RHEL/CentOS7 by suninstall# Keyboard layoutskeyboard 'us'# Reboot after installationreboot# Run the Setup Agent on first bootfirstboot --enableignoredisk --only-use=sda# Keyboard layoutskeyboard --vckeymap=us --xlayouts='cn'# System languagelang zh_CN.UTF-8# Network information#network --bootproto=dhcp --device=enp2s0 --onboot=off --ipv6=auto#network --bootproto=dhcp --device=enp3s0 --onboot=off --ipv6=auto#network --hostname=localhost.localdomain# Root passwordrootpw --iscrypted 111111111111111111111111111# System timezonetimezone Asia/Shanghai# System languagelang zh_CN# Firewall configurationfirewall --enabled --ssh # System authorization informationauth --useshadow  --passalgo=sha512# Use CDROM installation mediacdrom# Use graphical installgraphical# SELinux configurationselinux --disabled# Do not configure the X Window Systemskipx# System bootloader configurationbootloader --location=mbr# Clear the Master Boot Recordzerombr# Partition clearing informationclearpart --all# Disk partitioning informationpart /boot --fstype='xfs'--size=500part /boot/efi --fstype='xfs'--size=500part swap --fstype='swap'--size=16000part / --fstype='xfs' --grow--size=1 %packages@base@core@development@hardware-monitoring@performance@remote-system-management%end注意:因为 CentOS7 系统网卡规则更复杂,为了 ks.cfg 更通用,最好 ks.cfg 不用制定网卡配置。为了兼容 mbr 方式和 EFI 方式,同时创建了 /boot 和 /boot/efi 分区。配置 mbr 引导方式编辑 isoliuux 目录下的 isolinux.cfg 文件,添加自己的内容,在 isolinux.cfg 文件中 label linux 下面添加自己的 label : label custom menu label ^Custom CentOS  kernel vmlinuz append initrd=initrd.img inst.ks=cdrom:/isolinux/ks.cfg( 全自动不需要加上LABEL=CentOS 这个标签)

4

生成 iso 镜像会在/root/生成镜像(centos7.iso),并且能在 EFI 和 mbr 环境安装的镜像生成命令如下: genisoimage -v -cache-inodes -joliet-long -R -J -T -V CENTOS7 -o /root/centos7.iso    -c isolinux/boot.cat    -bisolinux/isolinux.bin    -no-emul-boot -boot-load-size 4-boot-info-table    -eltorito-alt-boot    -b images/efiboot.img      -no-emul-boot .

注意事项

制作centos7.0建议使用centos7.0的genisoimage命令

推荐信息