Ubuntu 16.04.1 の自動インストール .iso イメージを作る
以前に Ubuntu 15.10 の自動インストールイメージの作り方のメモを書きました。今回は 16.04.1 用にアップデートしたメモを残しておきます。
完成したファイル
ユーザ名 |
パスワード |
root |
password |
user |
password |
事前準備
以下を実行しておきます。
| apt-get -y install syslinux mtools mbr genisoimage dvd+rw-tools
cd ~
curl -O http://ftp.iij.ad.jp/pub/linux/ubuntu/releases/16.04.1/ubuntu-16.04.1-server-amd64.iso
mkdir -p ~/{dvd,dvdr}
mount -t iso9660 ~/ubuntu-16.04.1-server-amd64.iso ~/dvd
cd ~/dvd
find . ! -type l | cpio -pdum ~/dvdr/
|
isolinux.cfg を書き換える
~/dvdr/isolinux/isolinux.cfg を以下のように書き換えます。
| default install
label install
menu label ^Install Ubuntu Server
kernel /install/vmlinuz
append DEBCONF_DEBUG=5 auto=true locale=en_US.UTF-8 console-setup/charmap=UTF-8 console-setup/layoutcode=us console-setup/ask_detect=false pkgsel/language-pack-patterns=pkgsel/install-language-support=false vga=normal file=/cdrom/preseed/preseed.cfg initrd=/install/initrd.gz quiet --
label hd
menu label ^Boot from first hard disk
localboot 0x80
|
preeseed.cfg を新規作成する
~/dvdr/preseed/preseed.cfg を以下の内容で新規作成します。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 | # Localization
d-i debian-installer/locale string en_US
# Keyboard selection.
d-i console-keymaps-at/keymap select jp
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string jp
d-i keyboard-configuration/modelcode jp106
# Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/disable_autoconfig boolean false
d-i netcfg/get_domain string localdomain
d-i netcfg/get_hostname string localhost
# Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string
# Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string Asia/Tokyo
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string 0.pool.ntp.org
# Partitioning
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select atomic
#d-i partman/default_filesystem string ext4
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
# Base system installation
#d-i base-installer/install-recommends boolean false
#d-i base-installer/kernel/image string linux-generic
d-i base-installer/kernel/image string linux-server
# Account setup
d-i passwd/root-login boolean true
d-i passwd/make-user boolean true
d-i passwd/root-password password password
d-i passwd/root-password-again password password
# To create a normal user account.
d-i passwd/user-fullname string user
d-i passwd/username string user
d-i passwd/user-password password password
d-i passwd/user-password-again password password
d-i user-setup/allow-password-weak boolean true
d-i passwd/user-default-groups string sudo
d-i user-setup/encrypt-home boolean false
# Apt setup
#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/use_mirror boolean false
#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
# Package selection
tasksel tasksel/first multiselect none
d-i pkgsel/include string openssh-server
d-i pkgsel/upgrade select none
d-i pkgsel/update-policy select none
popularity-contest popularity-contest/participate boolean false
d-i pkgsel/updatedb boolean true
# Boot loader installation
d-i grub-installer/only_debian boolean true
# Finishing up the installation
d-i finish-install/reboot_in_progress note
# This first command is run as early as possible, just after
# preseeding is read.
d-i preseed/late_command string apt-install axel bash-completion chrony curl dnsutils fping git httpie httping jq libxml2-utils lsof man nmap open-vm-tools psmisc sshpass tcpdump tmux tree unzip vim-nox wget zip zsh; in-target apt-get -y update; in-target apt-get -y upgrade; in-target apt-get -y clean; in-target sed -i -e "s/PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config; in-target sed -i -e "s/%sudo ALL=(ALL:ALL) ALL/%sudo ALL=(ALL:ALL) NOPASSWD:ALL/g" /etc/sudoers
|
.iso イメージを作成する
.iso イメージを作成します。
| cd ~
genisoimage -N -J -R -D -V "PRESEED" -o ubuntu-16.04.1-server-amd64-preseed.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ~/dvdr
|