Alpine Linux - 시작 시 로드할 패키지를 정의하는 방법은 무엇입니까?

Alpine Linux - 시작 시 로드할 패키지를 정의하는 방법은 무엇입니까?

Alpine Linux는 시작 시 패키지를 로드하는 것 같습니다. 시작 시 로드된 패키지에 openssh를 추가하는 방법은 무엇입니까?

로그인하면 다음과 같은 16개의 패키지가 나열되는 "apk info"를 수행합니다.

localhost:~# apk info
musl
busybox
alpine-baselayout
openrc
alpine-conf
zlib
libcrypto1.0
libssl1.0
apk-tools
busybox-suid
busybox-initscripts
scanelf
musl-utils
libc-utils
alpine-keys
alpine-base
localhost:~#

시작 로그의 다음 메시지는 이러한 16개 패키지가 로드되고 있음을 보여줍니다.

* Installing packages to root filesystem: (1/16) Installing musl (1.1.14-r12)
7  0% [                                           ][    3.787784] tsc: Refined TSC clocksource calibration: 2600.002 MHz
[    3.788821] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x257a3e40e8d, max_idle_ns: 440795298933 ns
8[0K(2/16) Installing busybox (1.24.2-r11)
7  7% [###                                        ]8[0K7 17% [#######                                    ]8[0KExecuting busybox-1.24.2-r11.post-install
(3/16) Installing alpine-baselayout (3.0.3-r0)
7 18% [########                                   ]8[0KExecuting alpine-baselayout-3.0.3-r0.pre-install
7 18% [########                                   ]8[0K7 19% [########                                   ]8[0K7 20% [########                                   ]8[0KExecuting alpine-baselayout-3.0.3-r0.post-install
(4/16) Installing openrc (0.21-r2)
7 23% [##########                                 ]8[0K7 24% [##########                                 ]8[0K7 25% [##########                                 ]8[0K7 25% [###########                                ]8[0K7 26% [###########                                ]8[0K7 27% [###########                                ]8[0K7 28% [############                               ]8[0K7 29% [############                               ]8[0K7 30% [############                               ]8[0K7 30% [#############                              ]8[0K7 31% [#############                              ]8[0K7 32% [#############                              ]8[0K7 32% [##############                             ]8[0K7 33% [##############                             ]8[0K7 34% [##############                             ]8[0K7 35% [###############                            ]8[0K7 36% [###############                            ]8[0K7 37% [###############                            ]8[0K7 37% [################                           ]8[0K7 38% [################                           ]8[0K7 39% [################                           ]8[0K7 39% [#################                          ]8[0K7 40% [#################                          ]8[0K7 41% [#################                          ]8[0K7 42% [##################                         ]8[0K7 43% [##################                         ]8[0K7 44% [##################                         ]8[0K7 44% [###################                        ]8[0K7 45% [###################                        ]8[0K7 46% [###################                        ]8[0K7 46% [####################                       ]8[0K7 47% [####################                       ]8[0KExecuting openrc-0.21-r2.post-install
(5/16) Installing alpine-conf (3.4.1-r5)
7 49% [#####################                      ]8[0K7 50% [#####################                      ]8[0K7 51% [#####################                      ]8[0K7 51% [######################                     ]8[0K(6/16) Installing zlib (1.2.8-r2)
7 52% [######################                     ]8[0K(7/16) Installing libcrypto1.0 (1.0.2j-r0)
7 53% [######################                     ]8[0K7 80% [##################################         ]8[0K7 81% [###################################        ]8[0K7 82% [###################################        ]8[0K7 83% [###################################        ]8[0K7 83% [####################################       ]8[0K7 84% [####################################       ]8[0K7 85% [####################################       ]8[0K(8/16) Installing libssl1.0 (1.0.2j-r0)
7 85% [####################################       ]8[0K(9/16) Installing apk-tools (2.6.7-r0)
7 91% [#######################################    ]8[0K(10/16) Installing busybox-suid (1.24.2-r11)
7 94% [########################################   ]8[0K(11/16) Installing busybox-initscripts (3.0-r3)
7 94% [########################################   ]8[0K7 95% [########################################   ]8[0K7 95% [#########################################  ]8[0K7 96% [#########################################  ]8[0KExecuting busybox-initscripts-3.0-r3.post-install
(12/16) Installing scanelf (1.1.6-r0)
7 96% [#########################################  ]8[0K(13/16) Installing musl-utils (1.1.14-r12)
7 97% [########################################## ]8[0K7 98% [########################################## ]8[0K(14/16) Installing libc-utils (0.7-r0)
7 99% [########################################## ]8[0K(15/16) Installing alpine-keys (1.1-r0)
7 99% [########################################## ]8[0K(16/16) Installing alpine-base (3.4.4-r0)
7 99% [########################################## ]8[0K7100% [###########################################]8[0KExecuting busybox-1.24.2-r11.trigger
OK: 7 MiB in 16 packages
ok.

답변1

USB를 통해 부팅했고 lbu가 올바르게 구성되었다고 가정하면 openssh를 설치한 후 다음을 실행해야 합니다.

 lbu commit

이렇게 하면 /media/usb/yourhostname.apkovl.tar.gz의 apkovl 오버레이 파일에 /etc 디렉터리가 저장됩니다.

시작 시 설치되는 패키지는 /etc/apk/world에 있으며, "lbu commit"을 사용하여 저장할 때도 저장됩니다.

기록을 위해 lbu가 올바르게 구성되었는지 확인하려면(여전히 USB를 통해 부팅한다고 가정) 다음을 실행합니다.

 cat /etc/lbu/lbu.conf | grep LBU_MEDIA

다음을 반환해야 합니다.

 LBU_MEDIA=usb

관련 정보