制作ubuntu16.04 (12.04)自动安装iso镜像(只需要手动分区,其他自动)

背景:

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

以下方法是参照已经做好的12.04自动安装镜像修改16.04的镜像,最终成功,此配置方法应该是普适的。

制作方法:

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

cd /root/
wget http://mirrors.zju.edu.cn/ubuntu-releases/16.04/ubuntu-16.04.4-server-amd64.iso
mkdir mnt
mount ubuntu-16.04.4-server-amd64.iso  mnt/
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

#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

#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

 

完毕。

 

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

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

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

 

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值