制作ubuntu16.04 自动安装iso镜像

时间:2018-09-08 23:33:17   收藏:0   阅读:1339

官网下载Ubuntu镜像安装,交互模式需要手动配置很多东西,为了快速安装,特制作自动安装镜像,方便安装系统。

 

制作方法:

下载官网镜像iso文件:ubuntu-16.04.4-server-amd64.iso (http://mirrors.zju.edu.cn/ubuntu-releases/16.04/ubuntu-16.04.4-server-amd64.iso)

  1. cd /root/
  2. wget http://mirrors.zju.edu.cn/ubuntu-releases/16.04/ubuntu-16.04.4-server-amd64.iso
  3. mkdir mnt
  4. mount ubuntu-16.04.4-server-amd64.iso mnt/
  5. cp -rf ./mnt/* ./mnt/.disk/ ./ubuntu/ #将挂载的镜像目录copy到ubuntu目录中

将镜像文件拷贝出来后,根据以下链接修改相关配置文件:

http://www.linuxdiyf.com/linux/16044.html

1.用以下内容替换isolinux.cfg文件内容(相关说明见上面链接)

cp  ubuntu/isolinux/isolinux.cfg{,.bak}

-------------------------------------------

default autoinstall
prompt 0
timeout 100
menu title Custom Live CD
menu background splash.png
menu color title 1;37;44 #c0ffffff #00000000 std
 label autoinstall
menu label autoinstall - auto install ubuntu
kernel /install/vmlinuz
append initrd=/install/initrd.gz file=/cdrom/preseed/ubuntu-server.seed boot=install debian-installer/locale=en_US console-setup/ask_detect=false keyboard-configuration/layoutcode=us automatic-ubiquity quiet splash --

------------------------------------------------------

2.用以下内容替换ubuntu-server.seed文件内容(相关说明见上面链接)

 

cp  ubuntu/preseed/ubuntu-server.seed{,.bak}

-------------------------------------------------------------------------------------

#locate

d-i debian-installer/locale string en_US
d-i console-tools/archs select true
d-i debian-installer/language string en
d-i debian-installer/country string us

d-i localechooser/supported-locales multiselect en_US.UTF-8, zh_CN.UTF-8
     
#keyboard
d-i console-setup/ask_detect boolean false
d-i console-configuration/layoutcode string us
d-i keyboard-configuration/modelcode string SKIP
     
#clock
d-i clock-setup/utc boolean false
d-i time/zone string Asia/Shanghai
     
#network
d-i netcfg/choose_interface select auto
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Do not configure the network at this time
d-i netcfg/get_hostname string cc
d-i netcfg/get_domain string cc-domain
d-i netcfg/wireless_wep string
     
# Mirror
     

d-i pkgsel/language-pack-patterns string
d-i pkgsel/install-language-support boolean false
d-i apt-setup/partner boolean true
d-i debian-installer/splash boolean false
d-i oem-config-udeb/frontend string debconf
d-i mirror/http/proxy string
     
    # clock
d-i clock-setup/ntp boolean true
     
    ## 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
    #user
d-i passwd/root-login boolean false
#d-i passwd/root-password password 123
#d-i passwd/root-password-again password 123
d-i passwd/make-user boolean true
d-i passwd/user-fullname string leo ##用户名
d-i passwd/username string leo ##用户名
d-i passwd/user-password password 123 ##密码
d-i passwd/user-password-again password 123
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false

    ## 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
#basic system
#d-i base-installer/kernel/linux/initramfs-generators string yaird
     
#package
tasksel tasksel/first multiselect ubuntu-desktop
d-i pkgsel/include string openssh-server build-essential vim landscape-common
d-i pkgsel/update-policy select none
     
#grub
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
     
# Finish
d-i finish-install/reboot_in_progress note
oem-config oem-config/steps multiselect language, timezone, keyboard, user, network, tasksroot

 

---------------------------------------------------------------------------------------------

修改完毕后,将ubuntu目录重新打包成iso镜像

mkisofs 命令使用参考这里(http://man.linuxde.net/mkisofs)

mkisofs -R -J -T -v -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat -o auto-ubuntu-16.04.4-server-amd64.iso  ubuntu/

生成的可以自动安装的iso镜像为:auto-ubuntu-16.04.4-server-amd64.iso

 

https://blog.csdn.net/Frank_Abagnale/article/details/78963876

https://blog.csdn.net/jinyuxiaoqiang/article/details/80827497

 

完毕。

 

补充,实践发现,在vmware 的Esxi 上安装ubuntu16.04 使用该镜像可以正常安装启动。

但是在dell服务器上安装   开机后,正常到选择启动项后,找到硬盘后直接黑屏,不显示启动时的那些信息。好像系统没有正确安装一样。

解决方法是 :  Ctrl +Alt +F1   进如tty1   。进如系统后   把/etc/default/grub 里面的GRUB_CMDLINE_LINUX_DEFAULT="quiet" 里面的quiet删掉即可。

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!