一、目的

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

二、环境和软件工具

环境: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 -al
  mnt/ 
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=black
    linux    /install/vmlinuz auto-install/enable=true file=/cdrom/preseed/ubuntu.seed
    initrd   /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.cfg
    initrd /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 .

--------------------- 
原文:https://blog.csdn.net/Frank_Abagnale/article/details/78963876

CentOS/Ubuntu制作自动安装arm iso镜像相关推荐

  1. CentOS/Ubuntu制作自动安装iso实操

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

  2. 制作CentOS 5.9自动安装光盘iso镜像

    准备环境:先手动安装一台centos5.9系统 [root@localhost ~]# mkdir /iso [root@localhost ~]# mount -o loop /dev/cdrom ...

  3. Windows--如何使用PE安装官方ISO镜像

    Windows–如何使用PE安装官方ISO镜像 准备工作 制作U盘启动盘–普通PE类 下载官方ISO系统文件镜像(随便找一个不是C盘的目录放着就行,建议直接扔在D盘根目录) 然后新建一个文件夹叫 Wi ...

  4. 开源工程师:Ubuntu 应该抛弃 32 位 ISO 镜像

    在最新的Ubuntu-devel邮件列表条目中,开 源软件工程师Dimitri John Ledkov分享了他对Ubuntu Linux操作系统32位ISO镜像的观点和看法.尽管开发者非常清楚知道全球 ...

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

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

  6. img文件制作linux启动u盘,如何在Linux系统中制作可启动img/iso镜像文件

    img/iso文件是镜像文件,在Linux系统操作中有时需要制作镜像文件,那么制作镜像文件的方法有哪些呢?下面小编就给大家介绍下如何下Linux下制作可启动img/iso文件. 制作镜像文件有三种方法 ...

  7. linux系统做成iso镜像文件,如何在Linux系统中制作可启动img/iso镜像文件

    img/iso文件是镜像文件,在Linux系统操作中有时需要制作镜像文件,那么制作镜像文件的方法有哪些呢?下面小编就给大家介绍下如何下Linux下制作可启动img/iso文件. 制作镜像文件有三种方法 ...

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

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

  9. debian及ubuntu挂载本地硬盘的ISO镜像文件

    1.定位Debian ISO镜像的位置,比如说sda3 fdisk -l 2.挂载: # mount -t auto /dev/sda3 /media/mnt 生成isodebian路径 /mnt# ...

最新文章

  1. spring第一个小例子(Spring_xjs1)
  2. MFC类中获得其它类指针
  3. 《程序员面试金典》最大和子矩阵
  4. const constexpr C++ 解释
  5. jca使用_使用JCA的密码学–提供者中的服务
  6. java解析string_java读取文件内容为string字符串的方法
  7. SQL Server 2016 新功能之综述
  8. kafaka可视化工具
  9. React Native 运行环境安装:0.6以下/以上版本的 新老项目 都适用
  10. POJ 3168 Barn Expansion (几何+排序)
  11. 计算机体系结构与组成的区别
  12. 甘肃暴雨强度公式_甘肃暴雨强度公式
  13. mysql联合查询_mysql中的联合查询
  14. YYUC01——Windows本地环境搭建
  15. 012Java虚拟机005垃圾的回收
  16. 第一次带项目遇到的坑
  17. origin柱状图同时有两组数和两组数差值_教程 | Origin用矩阵绘制多层曲面映射图...
  18. 解决Jenkins一直用户名或密码错误
  19. FT60F011A包含1Krom+EEPROM+Flash方案
  20. 贪心算法之 活动安排(Java代码实现)

热门文章

  1. 史上最快、最强大的Gradle 5.0发布,新特性全解
  2. DC中的一些命令随笔
  3. 《深入理解Android:卷III A》一一第3章 深入理解AudioService
  4. Hibernate简单的保存操作
  5. php的SAPI,CLI SAPI,CGI SAPI
  6. ffmpeg,rtmpdump和nginx rtmp实现录屏,直播和录制
  7. scaleType属性设置!
  8. 【HTTP】 认证和单点登录 【瞎写的…】
  9. 【cocos2d-x从c++到js】08:JS脚本语言的优势与一些问题
  10. 众推架构的进一步讨论