Linux를 수동으로 최소 설치하는 방법은 무엇입니까? [폐쇄]

Linux를 수동으로 최소 설치하는 방법은 무엇입니까? [폐쇄]


전통적인 지원 설정 없이 Linux를 수동으로 설치하는 방법에 대한 가이드를 찾고 있습니다.
소스에서 대상 미디어로 파일을 복사하고...
필요한 최소 설정을 구성하기만 하면 됩니다.
(교육용입니다.)

  1. 파티션 생성 및 대상 드라이브 포맷...
  2. 소스 드라이브에서 대상 드라이브로 최소한의 파일 복사(수동 복사, 파일별)
  3. 필요한 최소 폴더 생성(/root /bin /etc ...)
  4. 최소 구성 파일(/etc/???)을 만듭니다.
  5. MBR용 부트로더와 GPT/EFI용 기타 부트로더를 선택하고 설치합니다.

Arch/Alpine/Kali/UBUNTU-Minimal/…과 같은 최신 배포판

? 누군가 이 주제에 대한 문서/비디오를 알려줄 수 있습니까?

감사해요

답변1

부팅 이미지로 시작할 수 있습니다. 다음은 이름과 크기가 다른 몇 가지 제품입니다.

]# ls *.iso -dsh
607M OL-x86_64-boot-uek.iso
603M archlinux-2019.01.01-x86_64.iso
258M install-gentoo_minimal.iso
2.6G slackware64-14.2-install-dvd.iso
882M ubuntu-18.10-live-server-amd64.iso

이러한 ISO 이미지는 다음 없이도 루프로 설치할 수 있습니다 -o loop(단, mkdir MNTPOINT디렉토리가 먼저 있는 경우).

]# mount install-gentoo_minimal.iso iso
mount: /root/sda1/LINUX/iso: WARNING: device write-protected, mounted read-only.

]# ls iso
README.txt  boot  gentoo.efimg  grub  image.squashfs  isolinux  livecd

다음 파일은 필수적입니다.

]# ls -lh iso/isolinux/gentoo* iso/gentoo.efimg iso/image.squashfs 
-rw-r--r-- 1 root root 6.4M Jan  9  2019 iso/gentoo.efimg
-rw-r--r-- 1 root root 236M Jan  9  2019 iso/image.squashfs
-rw-r--r-- 1 root root 3.8M Jan  9  2019 iso/isolinux/gentoo
-rw-r--r-- 1 root root 5.1M Jan  9  2019 iso/isolinux/gentoo.igz

젠투.efimg

다시 말하지만, mount [-o loop] iso/gentoo.efimg img/마운트 지점(dir)을 생성한 후(예: "img/"). 그러면 다음을 얻게 됩니다:

]# file img/EFI/BOOT/*
img/EFI/BOOT/BOOTIA32.EFI: PE32 executable (EFI application) Intel 80386 (stripped to external PDB), for MS Windows
img/EFI/BOOT/BOOTX64.EFI:  PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows
img/EFI/BOOT/grubia32.efi: PE32 executable (EFI application) Intel 80386 (stripped to external PDB), for MS Windows
img/EFI/BOOT/grubx64.efi:  PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows
img/EFI/BOOT/mmia32.efi:   PE32 executable (EFI application) Intel 80386 (stripped to external PDB), for MS Windows
img/EFI/BOOT/mmx64.efi:    PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows

이는 EFI 부트로더의 다양한 변형입니다. 또 다른 방법은 Uefi Shell(또는 MBR...)을 사용하는 것입니다. 하지만 여기서 우리는 BOOTX64.EFI누군가를 기다리고 있습니다.

image.squashfs

이것은 Squashfs filesystem기초 입니다확장하다그리고 file명령. 따라서 ISO 이미지(루프)처럼 마운트할 수 있습니다.

여기에는 루트 파티션의 파일이 포함되어 있습니다.

]# ldd sq/bin/bash
        linux-vdso.so.1 (0x00007fffe97ef000)
        libreadline.so.7 => not found
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f0d4e221000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f0d4e6c5000)
]# ./sq/bin/bash
./sq/bin/bash: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory

이는 일반 /bin/bash에도 일부 라이브러리, 버전 및 링크가 필요함을 의미합니다.


iso/isolinux/젠투

]# file iso/isolinux/gentoo
iso/isolinux/gentoo: Linux kernel x86 boot executable bzImage, version 4.14.83-gentoo (root@catalyst) #1 SMP Wed Jan 9 01:58:22 UTC 2019, RO-rootFS, swap_dev 0x3, Normal VGA

커널(bzImage). Uefi를 사용하면 ESP에 복사하기만 하면 됩니다. 그렇지 않으면 (MBR) 일부 디렉토리로 이동한 다음 grub-...,


iso/isolinux/gentoo.igz

압축된 initrd를 사용하면 다음을 xz나열 cpio -t할 수 있습니다.

]# xz -cd iso/isolinux/gentoo.igz | cpio -t lib/modu\* 
lib/modules
lib/modules/4.14.83-gentoo
lib/modules/4.14.83-gentoo/modules.order
lib/modules/4.14.83-gentoo/modules.symbols
...

grub/grub.cfgiso에 하나 있습니다.

menuentry 'Boot LiveCD (kernel: gentoo)' --class gnu-linux --class os {
    linux /isolinux/gentoo root=/dev/ram0 init=/linuxrc  dokeymap looptype=squashfs loop=/image.squashfs
    initrd /isolinux/gentoo.igz

bash와 4개의 라이브러리/종속성( ldd위 참조)을 포맷된 파티션에 복사하면 sdXY다음 3개의 시작 매개변수를 얻게 됩니다.

gentoo 
root=/dev/sdXY 
init=/bin/bash
initrd=gentoo.igz

최소한의 실험을 위해 3)과 4)(디렉터리 및 구성 파일)는 부차적인 것입니다. 그렇게 작지 않았다면 새로운 배포판을 만드는 것과 같을 텐데…

MBR 대 UEFI 외에도 많은 가능성이 있기 때문에 가장 큰 어려움은 부팅 프로세스 자체에 있습니다. init/systemd 및 로그인이 누락되었습니다. 파티셔닝도 가능하지만 어떤 경우든 이것은 설치와 별개입니다(또는 논리적으로 분리되어야 합니다). 사실 /bin/bash를 제외하고는 모두 생략했습니다.


이는 "클래식 지원 설정"을 피하고 처음부터 컴파일을 제외한 모든 작업을 수행하는 방법입니다.

누군가가 제안했기 때문에 나는 젠투를 예로 사용하고 있습니다. 상단에 나열된 .iso 파일은 크기만 다를 뿐 매우 유사합니다. 표시된 대로 바이너리 중 하나에서 바이너리를 추출할 수 있습니다.

관련 정보