Ubuntu 커스텀 설치 이미지 만들기 (Make the custom ISO image of Ubuntu)

설명

cubic 설치

$ sudo add-apt-repository ppa:cubic-wizard/release
$ sudo apt install cubic

설치 이미지 다운로드 (주의! Live 이미지는 자동설치 지원 안됨.)

$ wget http://cdimage.ubuntu.com/ubuntu/releases/18.04/release/ubuntu-18.04.4-server-arm64.iso

cubic 실행 (실행시 root 권한이 필요하므로 계정 암호 입력하여 진행)

작업에 사용할 디렉토리 생성하고 선택, 다음으로 진행

다운로드한 설치 이미지를 선택, 그러면, 다음과 같이 정보들이 자동으로 입력됨. Original ISO… 부분은 절대 수정하면 안되고, Custom ISO… 부분은 작업 디렉토리를 제외한 나머지 부분은 수정 가능.

다음으로 진행.

자동으로 파일 및 디렉토리를 복사한 후, 작업을 위한 chroot 환경의 터미널이 뜸.

이제 이 터미널 내에서 원하는 작업을 해주면 됨. 프로그램 설치는 apt를 이용해서 설치. 스크립트나 기타 등등의 작업도 가능.

작업이 완료되었으면, Next를 눌러 다음으로 진행

여기에선 설치하고 싶지 않은 패키지들을 선택 가능. 필요없다고 생각하는 것들을 선택하면 됨.


3번째 탭으로 이동. 설치 자동화 스크립트 파일을 하나 추가한다. seed 파일의 문법은 https://help.ubuntu.com/lts/installation-guide/amd64/apbs04.html을 참고한다. 파일을 추가하기 위해서 하단의 + 버튼을 누르고 오른쪽 편집창에 스크립트를 입력한다. 이번 과정에서 사용한 seed 파일은 다음과 같다.

### Automatic Installation
d-i auto-install/enable boolean true
d-i debconf/priority select critical


### Localization
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales multiselect en_US.UTF-8
# Keyboard
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us


### Network
d-i netcfg/choose_interface select auto
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/use_autoconfig boolean false
d-i netcfg/disable_dhcp boolean true
#d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually

# Static network configuration.
d-i netcfg/get_ipaddress string 192.168.1.11
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 192.168.1.1
d-i netcfg/get_nameservers string 192.168.1.1
d-i netcfg/confirm_static boolean true

d-i netcfg/get_hostname string ubuntu
d-i netcfg/get_domain string


### 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


### Account setup
d-i passwd/root-login boolean false
d-i passwd/make-user boolean true

d-i passwd/user-fullname string ubuntu
d-i passwd/username string ubuntu
d-i passwd/user-password password ubuntu
d-i passwd/user-password-again password ubuntu
d-i user-setup/allow-password-weak boolean true


### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string Asia/Seoul
d-i clock-setup/ntp boolean true


### Partitioning
d-i partman-auto/init_automatically_partition select biggest_free
d-i partman-auto/method string regular
d-i partman-swapfile/size string 4096

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

### Update
d-i pkgsel/update-policy select none

### Bootloader
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev  string default


# Verbose output and no boot splash screen.
d-i debian-installer/quiet	boolean false
d-i debian-installer/splash	boolean false
d-i finish-install/reboot_in_progress note

이상하게, 몇개의 특정 스크립트 이외에 다른 스크립트들은 거의 반영이 안된다. 완전 자동화 설치는 아니고, 부분부분은 사용자가 개입을 해줘야한다. 버그인듯한데… 좀더 살펴봐야 할듯.

다음으로 이 seed 파일을 사용하기 위해, 부트 메뉴 등을 설정해야 한다. 네번째 탭인 ISO Boot Configuration으로 이동, grub.cfg 파일에 다음과 같은 엔트리 하나 추가.

menuentry "Automatic Install Ubuntu Server" {
	set gfxpayload=keep
	linux	/install/vmlinuz  boot=casper file=/cdrom/preseed/auto-cli.seed auto=true priority=critical locale=en_US netcfg/disable_autoconfig=true automatic-ubiquity noprompt noshell quiet ---
	initrd	/install/initrd.gz
}

다음으로 isolinux 설정. 역시 엔트리를 하나 추가하고, 기본 선택을 자동설치로 변경. (isolinux/txt.cfg 파일 수정)

default auto-install
label auto-install
  menu label ^Automatic Install Ubuntu Server
  kernel /install/vmlinuz
  append  boot=casper file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz auto=true locale=en_US priority=critical netcfg/disable_autoconfig=true automatic-ubiquity noprompt noshell quiet ---

수정이 완료 되어 있으면, Generate 버튼을 눌러 다음으로 진행.


이제 사용자의 ISO 파일을 생성함. 종료하고 작업 디렉토리로 가보면, 사용자 설치 이미지가 생성되어 있는 것을 볼수 있음.

이걸 가지고 USB등 설치 이미지를 만들어 설치하면 끝!.

참고링크

2 Replies to “Ubuntu 커스텀 설치 이미지 만들기 (Make the custom ISO image of Ubuntu)”

  1. 제가 찾던 정보인거같아요.. 감사합니다
    Live는 자동 설치 지원이 안된다고 하셨는데, 안그래도 kick start 이용해서 ubuntu server 20.04를 설치해보려고 했으나 잘 안되더라고요

    live가 아닌 다른 파일로 20.04를 자동으로 설치하기 위한 방법이 있을까요??

    1. 관심 가져주셔서 감사합니다.

      Server 이미지가 가장 가벼운 형태라서 사용을 했었고, Desktop 이미지도 가능할겁니다. 20.04는 시도해보지 않았는데, 아마 부트로더 관련한거 이외엔 별다른 차이가 없을거라고 생각이 됩니다.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.