一、目的

减少操作系统安装过程中人机交互过程,实现选择光盘安装后,无需其他人机交互过程即可自动完成操作系统的安装。

二、环境和软件工具

环境:Linux Ubuntu/CentOS操作系统(其他发行版未作尝试)

软件:mkisofs,xorriso

软件安装:

CentOS : yum install mkisofs xorriso -y

Ubuntu: sudo apt install -y mkisofs xorriso

三、iso重新打包

1.Ubuntu

1.1原料

我是用ubuntu-16.04.3-server-arm64.iso挂载出来再做一份拷贝,如果有现成的编译环境也是可以的。

$ mkdir mnt/ ubuntu/
$ ls -almnt/
ubuntu/
ubuntu-16.04.3-server-arm64.iso
$ sudo mount ubuntu-16.04.3-server-arm64.iso mnt/
$ cp -rf ./mnt/* ./mnt/.disk/ ./ubuntu/
$ sudo umount ./mnt/

1.2修改/添加配置文件

1.2.1.boot/grub/grub.cfg

$ vim ubuntu/boot/grub/grub.cfg
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set timeout=60
insmod gzio
menuentry 'Install Ubuntu' {set background_color=blacklinux    /install/vmlinuz auto-install/enable=true file=/cdrom/preseed/ubuntu.seedinitrd   /install/initrd.gz
}

(1)set timeout=60  ##设置60秒无应答自动选择默认项

(2)auto-install/enable=true   ##允许自动安装模式

(3)file=/cdrom/preseed/ubuntu.seed  ##指定自动安装的preseed文件。

(4)如果想将正常发行的iso和可以自动安装的iso合并为一个,可以添加其他的菜单项,但是一定确保上面这条配置是默认项,并配置超时操作。

1.2.2.preseed文件preseed/ubuntu.seed

$ vim ubuntu/preseed/ubuntu.seed

#########################################################################

## CDROM auto install

#########################################################################

# Continue install on "no kernel modules were found for this kernel"

#d-i anna/no_kernel_modules boolean true

d-i auto-install/enable boolean true

## Set country, language and keyboard map

d-i debian-installer/language string en

d-i debian-installer/country string US

d-i debain-install/locale string en_US.UTF-8

# Optionally specify additional locales to be generated.

#d-i localechooser/supported-locales multiselect zh_CH.UTF-8, C.UTF-8, en_US.UTF-8

#d-i keyboard-configuration/xkb-keymap select us

## Disable automatic (interactive) keymap detection.

d-i console-setup/ask_detect boolean false

d-i keyboard-configuration/layoutcode string us

## To select a variant of the selected layout (if you leave this out, the

## basic form of the layout will be used):

#d-i keyboard-configuration/variantcode string dvorak

##net config

d-i netcfg/choose_interface select auto

d-i netcfg/get_hostname string unassigned-hostname

d-i netcfg/get_domain string unassigned-domain

## set root password

d-i passwd/root-login boolean root

d-i passwd/root-password password root

d-i passwd/root-password-again password root

d-i user-setup/allow-password-weak boolean true

## creat user

d-i passwd/make-user boolean true

d-i passwd/user-fullname string User

d-i passwd/username string user

d-i passwd/user-password-crypted password userpassword

d-i passwd/user-password-again password userpassword

## Encrypt your home directory NO

d-i user-setup/encrypt-home boolean false

## Controls whether or not the hardware clock is set to UTC.

d-i clock-setup/utc boolean true

d-i time/zone string Asia/Shanghai

## Disk usage

d-i partman-auto/disk string /dev/sda

#d-i partman-auto/method string lvm

#d-i partman-auto-lvm/guided_size string max

d-i partman-auto/method string regular

d-i partman-lvm/device_remove_lvm boolean true

d-i partman-md/device_remove_md boolean true

d-i partman-lvm/confirm boolean true

d-i partman-lvm/confirm_nooverwrite boolean true

d-i partman-auto/choose_recipe select atomic

d-i partman-partitioning/confirm_write_new_label boolean true

d-i partman/choose_partition select finish

d-i partman/confirm boolean true

d-i partman/confirm_nooverwrite boolean true

## umount /dev/sda

d-i partman/unmount_active boolean true

d-i preseed/early_command string umount /media || true

#set mirror CD 安装不需要设置:mirror

#d-i mirror/country string manual

#d-i mirror/http/hostname string ports.ubuntu.com

#d-i mirror/http/directory string /ubuntu-ports/

#d-i mirror/http/proxy string

#d-i mirror/http/mirror select 192.168.50.122:8083

#d-i mirror/http/mirror select 192.168.1.107:80

## apt-setup

#d-i apt-setup/non-free boolean true

#d-i apt-setup/contrib boolean true

d-i apt-setup/use_mirror boolean false

d-i apt-setup/restricted boolean true

d-i apt-setup/universe boolean true

d-i apt-setup/backports boolean true

d-i apt-setup/services-select multiselect security

d-i apt-setup/security_host string security.ubuntu.com

d-i apt-setup/security_path string /ubuntu

d-i pkgsel/update-policy select none

##install software

tasksel tasksel/first multiselect standard

## Individual additional packages to install

d-i pkgsel/include string openssh-server vim 

d-i pkgsel/upgrade select none

popularity-contest popularity-contest/participate boolean false

##Grub and bootloder

## This is fairly safe to set, it makes grub install automatically to the MBR

## if no other operating system is detected on the machine.

d-i grub-installer/only_debian boolean true

d-i grub-installer/with_other_os boolean true

## Avoid that last message about the install being complete.

d-i finish-install/keep-consoles boolean true

d-i finish-install/reboot_in_progress note

d-i cdrom-detect/eject boolean false

1.3 重新打包iso

$ sudo xorriso -as mkisofs -r -checksum_algorithm_iso md5,sha1 -V 'Ubuntu-Server 16.04.3 LTS arm64' \
-o ./new-ubuntu-16.04.3-server-arm64.iso -J -joliet-long -cache-inodes -e boot/grub/efi.img \
-no-emul-boot -append_partition 2 0xef ubuntu/boot/grub/efi.img  -partition_cyl_align all ubuntu/

生成的iso就在当前目录下。

2.CentOS

2.1原料

我是用CentOS-7-aarch64-Everything.iso挂载出来再做一份拷贝,如果有现成的编译环境也是可以的。(用的是CentOS7.4-1708-ARM服务器版iso)

$ mkdir mnt/ centos/
$ ls -al
centos/
mnt/
CentOS-7-aarch64-Everything.iso
$ sudo mount CentOS-7-aarch64-Everything.iso mnt/
$ sudo cp -rf mnt/* mnt/.discinfo mnt/.treeinfo centos/
$ sudo umount ./mnt/

2.2修改/添加配置文件

2.2.1grub菜单EFI/BOOT/grub.cfg对默认项内容修改:

$ vim centos/EFI/BOOT/grub.cfg
set timeout=60
### END /etc/grub.d/00_header ###search --no-floppy --set=root -l 'CentOS 7 aarch64'### BEGIN /etc/grub.d/10_linux ###
menuentry 'install CentOS Linux AltArch 7' --class red --class gnu-linux --class gnu --class os {linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20aarch64 ip=dhcp acpi=force inst.ks=cdrom:/ks-iso.cfginitrd /images/pxeboot/initrd.img
}

(1)inst.stage2=hd:LABEL=CentOS\x207\x20aarch64  ##第二部执行的空间LiveOS的父目录位置。

(2)inst.ks=file:/ks-iso.cfg  ##自动安装用到的kickstart文件路径。

(3)acpi的设置根据具体设备而定,有些可能需要设置为off

2.2.2.kickstart文件

$ vim centos/ks-iso.cfg
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use text mode install
text
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts=''
# System language
lang en_US.UTF-8# Network information
network  --bootproto=dhcp --device=eth0 --ipv6=auto --activate
network  --bootproto=dhcp --device=eth1 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=eth2 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=eth3 --onboot=off --ipv6=auto
network  --hostname=localhost.localdomain# Root password
rootpw --iscrypted $6$Kd3yxUtwpOk3fJ.M$KnTt/6pHJzXWYcKGQbqqkifavlMLrQcuOd6OAud97qD2IbFcWGtljsRVo9qWSSHj0Mcy.HmyLZ0JsDlq8mQ7B/
# System services
services --enabled="chronyd"
# Do not configure the X Window System
skipx
# System timezone
timezone US/Alaska --isUtc
user --groups=user,wheel --name=user --password=$6$aBUT2gAUGjmQEeKF$.y8qtYgDX0gZZyiAVbBwlCfsNgPUykgP9HP82vzAcRJMz2E0ynnHpthBaSVlJWk0a8EmUZJDD6marUZhH7mkG1 --iscrypted --gecos="user"
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --all --initlabel --drives=sda
reboot%post
#安装完成后的操作
%end%packages
#需要安装的软件包
%end

以上自动安装配置只是提供一种方案。

2.3 重新打包iso

$ cd centos/

$ sudo genisoimage -e images/efiboot.img -no-emul-boot -T -J -R -c boot.catalog -hide boot.catalog -V "CentOS 7 aarch64"\
 -o ../CentOS-7-aarch64-Everything.iso .

CentOS/Ubuntu制作自动安装iso实操相关推荐

  1. CentOS/Ubuntu制作自动安装arm iso镜像

    一.目的 减少操作系统安装过程中人机交互过程,实现选择光盘安装后,无需其他人机交互过程即可自动完成操作系统的安装. 二.环境和软件工具 环境:Linux Ubuntu/CentOS操作系统(其他发行版 ...

  2. 计算机培训微课设计与实现,微课制作相关软件的实操培训

    为全面提升我校教师信息技术应用能力,促进教师转变教育教学方式,推动广大教师在课堂教学和日常工作中有效应用信息技术,实现信息技术与教育教学深度融合.5月9日下午,教师发展中心在计算机基础实验教学中心组织 ...

  3. Centos8安装mindoc实操

    Centos8安装mindoc实操 Centos8环境准备 centos 安装说明 centos8系统安装: 配置yum 仓 安装 vim.unzip 安装数据库 安装步骤: mindoc 安装 启动 ...

  4. linux6.5虛擬機镜像,CentOS 7.2 自动安装光盘实验全过程记录

    实验过程: 本文在一台RHEL6.5机器上,通过向原生CentOS7.2 iso中添加kickstart启动脚本ks.cfg和读取脚本的开机选项,再对该iso镜像重新封装的方式,完成CentOS7.2 ...

  5. 拳王虚拟项目公社:小白无脑可操作的自动化虚拟资源项目,虚拟资源自动发货的实操玩法

    首先,欢迎各位朋友收看这篇文章,请耐心看完,看完后,你会被震惊到,原来真的有自动化赚钱的方法,而且还特别暴利.(只是你不知道而已) 很多未了解的朋友说,能自动化赚钱的项目不就是淘宝.闲鱼之类的电商平台 ...

  6. Win10+VScode+Latex快速上手:从安装到实操保姆级教程

    1. 安装 MikTex 2. 编辑器的安装 3. Latex 工作环境的配置 4. 如何快速套用模板 5. 排版一篇论文必须掌握的操作 (1) 导入必须的包 (2) 插入图片 (3) 插入表格 (4 ...

  7. tengine简单安装_实操丨如何在EAIDK上部署Tengine开发AI应用之物体检测应用入门(C++)...

    前言:近期推出的嵌入式AI系列直播公开课受到广大开发者的喜爱,并收到非常多的反馈信息,其中对如何在EAIDK上面部署Tengine开发AI应用感兴趣的开发者不在少数,我们将分2期以案例实操的形式详细介 ...

  8. Kickstart+NFS+DHCP+TFTP+PXElinux实现CentOS的网络自动安装

    作者:diege 时间:2012-05-02 第三次整理 一:准备工作 1:安装centos系统,配置好网络 二:安装各软件 1:配置yum 2:安装kickstart # yum -y instal ...

  9. 创建 Windows Server无人值守安装自动安装 ISO

    在使用 Red Hat 的 Kickstart 和 Debian 的 Preseed 来自动化 Linux 安装之后,我需要类似的东西来自动化 Windows 部署. 目标 防止在安装过程中显示 Wi ...

最新文章

  1. ios 裁剪圆形头像_iOS开发笔记:实现圆形头像
  2. 【Android 进程保活】oom_adj 值 ( oom_adj 值对应的进程优先级 | oom_adj 值动态改变 | 进程保活优化方向 )
  3. 一键快速生成 Vue 的 HTML页面结构代码
  4. Python学习笔记之字典(一)
  5. Android OnLowMemory和OnTrimMemory
  6. 666的vue.mixin
  7. 如何把Access中数据导入Mysql中 (转)
  8. mysql sql语句递归查询语句_SQL实现MYSQL递归查询的方法
  9. 一篇比较好的高数的学习规划分享
  10. python八大排序算法_Python实现八大排序算法
  11. 如何网页截长图?网页截图其实很简单
  12. 如何做到阿里云 Redis 开发规范中的拒绝 bigkey
  13. 打印机乱码不停打印_性价比高的打印机推荐【2020年9月】-十大高性价比家用/办公打印机...
  14. 什么剪辑软件好用?视频剪辑这样做
  15. php 分数大于80 小于90优,“ 90 分改成 80 分”学生期末成绩须“正态分布”?不必搞一刀切...
  16. 常见浏览器及其内核(国际)
  17. C语言对于char*和char[]的理解
  18. 数据通信与计算机网络答案,数据通信与计算机网络考试试题及答案
  19. 一芯FC1178BC/FC1179主控U盘量产修复指南
  20. Ubuntu20.04.3引导修复(Boot Repair)

热门文章

  1. JavaScript实现双色球机选逻辑错误与正确的算法
  2. GIS地图开发,LBS开发,室内/外导航,三维地图开发的首选
  3. jquery时间计时器
  4. 河南省自考本科计算机专业需要考哪几门,河南省计算机网络技术自考本科都有哪些科目?...
  5. 康拓展开以及逆展开 板子
  6. 如何一步更改文件夹及其子文件夹/文件的权限
  7. DDMS调式小米2s无法找到设备的解决办法
  8. 刘知远:NLP研究入门之道(一)
  9. 我用阿里云盘分享了「apktool_2.6.0.jar」
  10. 如何安装和设置Lutron Caseta插入式调光器