LoginSignup
1
4

More than 5 years have passed since last update.

preseedメモ

Posted at

virt-installでVMを立てる時、preseedファイル書きます。

ハマったのでメモ

様々なサイトでもやってくれてますけどこことか参考に。
https://wikitech.wikimedia.org/wiki/PartMan

preseed.cfg

1.先頭の方。

d-i debian-installer/language string en
d-i debian-installer/country string JP
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales en_US.UTF-8
d-i console-setup/ask_detect boolean true
d-i console-setup/layoutcode string jp
d-i console-setup/charmap select UTF-8
d-i keymap select jp
d-i keyboard-configuration/xkb-keymap select jp

この辺は決め打ちでもいいと思う。
DebianInstallerのインストール時のオプション。
キーボードやらキーマップなど。

2.network系の設定

d-i netcfg/choose_interface select eth0
d-i netcfg/use_autoconfig boolean false
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/disable_dhcp boolean true
d-i netcfg/get_ipaddress string IPADDR
d-i netcfg/get_netmask string NETMASK
d-i netcfg/get_gateway string GATEWAY
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string HOSTNAME
d-i netcfg/get_domain string
d-i netcfg/get_nameservers string NAMESERVER

IPaddressとか固定でやるとき。
IPADDRは192.168.1.1とか、書いてあげます。

3.mirror設定

### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string jp.archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/suite string bionic 
d-i mirror/http/proxy string
# Suite to install.
d-i mirror/suite string bionic

パッケージ取りに行くときはJPのミラーサイトを見るよって設定だと思います。

4.root設定

# Setup the root account
d-i passwd/root-login boolean true
# Skip creation of a normal user account
d-i passwd/make-user boolean false
# Root password, either in clear text
d-i passwd/root-password-crypted password $1$KLRgJd.M$hogehogeeeeee

rootのパスワードとか設定できます。暗号化したほうがいい。

5.Timezone設定

### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true

# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string Asia/Tokyo

# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true

日本で設定してます。(その他はよくわかってない)

6.partman(困難)

# すべてのRAIDデバイス構成を破棄する
d-i partman-md/device_remove_md boolean true
# すべてのLVMデバイス構成を破棄する
d-i partman-lvm/device_remove_lvm boolean true
# RAIDアレイを構成するディスクを並べる
d-i     partman-auto/disk string /dev/sda
# RAIDを使わない(regular)
d-i     partman-auto/method string regular
# LVMを構成しない
d-i     partman-lvm/confirm boolean false
# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home:   separate /home partition
# - multi:  separate /home, /usr, /var, and /tmp partitions
d-i partman-auto/choose_recipe select atomic
# Set the default filesystem
d-i partman/default_filesystem string ext4

# Install without swap space
d-i partman-basicfilesystems/no_swap boolean false

d-i partman-auto/expert_recipe string \
vm :: \
1024 1024 -1 $default_filesystem \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
$default_filesystem{ } \
mountpoint{ / } \
.
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select Finish partitioning and write changes to disk
d-i partman/confirm boolean true 
d-i partman/confirm_nooverwrite boolean true

d-i partman-basicfilesystems/no_swap boolean false
Swap領域は作りません。

d-i partman-auto/expert_recipeで
最小領域1024MB ~ 限度いっぱいまで/でパーティション作ります。
partman-md …たしかRaid関係の操作してくれる(Raid使わなくても。)
partman-partitioning/confirm_write_new_label…作成したパーティションやらラベル名の選択時trueを選んでくれる
それ以降も、選択画面が出たらtrueを選んでくれっていう命令みたいです。

手動でパーティション切りたいときは以下のような感じになるぽい。

d-i partman-auto/expert_recipe string \
32 32 32 free \
$gptonly{ } \
$primary{ } \
$bios_boot{ } \
method{ biosgrub } \
. \
boot-root :: \
256 50 256 ext4 \
$gptonly{ } \
$primary{ } $bootable{_} \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
500 10000 -1 ext4 \
$gptonly{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
.
パーティション mountpoint filesystem 容量
sda1 ext4 32MB
sda2 /boot ext4 256MB
sda3? / ext4 残り全て

※手動で作成したときはbootloaderのインストール先注意

7.OSインストール

### Base system installation
# Verbose output and no boot splash screen.
d-i debian-installer/quiet boolean false
d-i debian-installer/splash boolean false

# Always install the server kernel.
# d-i base-installer/kernel/override-image string linux-server

今サーバカーネルが無かったんで、コメントアウトしてます。
d-i base-installer/kernel/override-image

勝手に進んでくれます…。

8.ソフトウェア系

d-i apt-setup/main boolean true
d-i apt-setup/services-select multiselect
tasksel tasksel/first multiselect
d-i pkgsel/language-pack-patterns string
d-i pkgsel/install-language-support boolean false
d-i pkgsel/include string openssh-server curl dnsutils build-essential tasksel s-nail sudo lv

postfix postfix/mailname string your-preferred-mailname
d-i pkgsel/upgrade select full-upgrade
d-i pkgsel/update-policy select none

popularity-contest popularity-contest/participate boolean false
d-i pkgsel/updatedb boolean false

インストールする言語とかパッケージとかだと思います。

9.grubブートローダ

d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string /dev/sda
d-i grub-installer/with_other_os boolean true
d-i grub-installer/timeout string 2

インストール先の指定。
選択肢は全部YesとかTrueを選べってことですかね…。

10.最後の処理。

d-i finish-install/keep-consoles boolean true
d-i finish-install/reboot_in_progress note
d-i cdrom-detect/eject boolean false

インストール終わったら再起動しますってことですね
CDはイジェクトしません(そもそもありませんし…。)

すんごい難しい。

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4