製做ubuntu16.04 自動安裝iso鏡像

官網下載Ubuntu鏡像安裝,交互模式須要手動配置不少東西,爲了快速安裝,特製做自動安裝鏡像,方便安裝系統。html

 https://www.debian.org/releases/stable/i386/apb.htmllinux

https://www.debian.org/releases/stretch/example-preseed.txtshell

 https://www.debian.org/releases/stable/i386/apbs04.html.zh-cn#preseed-partmanubuntu

製做方法:vim

下載官網鏡像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目錄中

將鏡像文件拷貝出來後,根據如下連接修改相關配置文件:app

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

1.用如下內容替換isolinux.cfg文件內容(相關說明見上面連接)frontend

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

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

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

 https://www.linuxidc.com/Linux/2015-08/121662.htm

https://blog.csdn.net/ak47mig/article/details/7068568

 http://blog.51cto.com/yangzhiming/2052396

 

完畢。

 

補充,實踐發現,在vmware 的Esxi 上安裝ubuntu16.04 使用該鏡像能夠正常安裝啓動。

可是在dell服務器上安裝   開機後,正常到選擇啓動項後,找到硬盤後直接黑屏,不顯示啓動時的那些信息。好像系統沒有正確安裝同樣。

解決方法是 :  Ctrl +Alt +F1   進如tty1   。進如系統後   把/etc/default/grub 裏面的GRUB_CMDLINE_LINUX_DEFAULT="quiet" 裏面的quiet刪掉便可。

-----------------------------isolinux.cfg -----------------

default autoinstall
prompt 0
timeout 100
menu title Custom Live CD
menu background splash.png
menu color title 1;37;44
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 --

------------------------ubuntu-server.seed--

#located-i debian-installer/locale string en_USd-i console-tools/archs select trued-i debian-installer/language string end-i debian-installer/country string usd-i localechooser/supported-locales multiselect en_US.UTF-8, zh_CN.UTF-8#keyboardd-i console-setup/ask_detect boolean falsed-i console-configuration/layoutcode string usd-i keyboard-configuration/modelcode string SKIP#clockd-i clock-setup/utc boolean falsed-i time/zone string Asia/Shanghai#networkd-i netcfg/choose_interface select autod-i netcfg/dhcp_failed noted-i netcfg/dhcp_options select Do not configure the network at this timed-i netcfg/get_hostname string kankand-i netcfg/get_domain string kankan-domaind-i netcfg/wireless_wep string#d-i netcfg/disable_autoconfig boolean true#d-i netcfg/dhcp_failed note#d-i netcfg/dhcp_options select Configure network manually#d-i netcfg/get_nameservers string 192.168.1.1#d-i netcfg/get_ipaddress string 192.168.1.42#d-i netcfg/get_netmask string 255.255.255.0#d-i netcfg/get_gateway string 192.168.1.1#d-i netcfg/confirm_static boolean true# Mirrord-i pkgsel/language-pack-patterns stringd-i pkgsel/install-language-support boolean falsed-i apt-setup/partner boolean trued-i debian-installer/splash boolean falsed-i oem-config-udeb/frontend string debconfd-i mirror/http/proxy string# clockd-i clock-setup/ntp boolean true## set root passwordd-i passwd/root-login boolean rootd-i passwd/root-password password rootd-i passwd/root-password-again password rootd-i user-setup/allow-password-weak boolean true#userd-i passwd/root-login boolean falsed-i passwd/make-user boolean trued-i passwd/user-fullname string ubuntud-i passwd/username string ubuntud-i passwd/user-password password ubuntud-i passwd/user-password-again password ubuntud-i user-setup/allow-password-weak boolean trued-i user-setup/encrypt-home boolean false## Disk usaged-i partman-auto/disk string /dev/sda#d-i partman-auto/method string lvm#d-i partman-auto-lvm/guided_size string maxd-i partman-auto/method string regulard-i partman-lvm/device_remove_lvm boolean trued-i partman-md/device_remove_md boolean trued-i partman-lvm/confirm boolean trued-i partman-lvm/confirm_nooverwrite boolean trued-i partman-auto/choose_recipe select atomicd-i partman-partitioning/confirm_write_new_label boolean trued-i partman/choose_partition select finishd-i partman/confirm boolean trued-i partman/confirm_nooverwrite boolean true#basic system#d-i base-installer/kernel/linux/initramfs-generators string yaird#package#tasksel tasksel/first multiselecttasksel tasksel/first multiselect ubuntu-desktopd-i pkgsel/include string openssh-server build-essential vim landscape-common ubuntu-desktop#d-i pkgsel/include string  gnome-shell ubuntu-gnome-desktopd-i pkgsel/update-policy select none#grubd-i grub-installer/only_debian boolean trued-i grub-installer/with_other_os boolean true# Finishd-i finish-install/reboot_in_progress noteoem-config oem-config/steps multiselect language, timezone, keyboard, user, network, tasksroot                                                                                                

相關文章
相關標籤/搜索