DEBIAN_FRONTEND 환경 변수

DEBIAN_FRONTEND 환경 변수

나의 잠재적인 호스팅 제공업체제안KVM 기반 서버의 OS 이미지를 최소화하기 위해 터미널에서 명령을 실행합니다. KVM 템플릿에는 필요하지 않은 패키지가 포함되어 있으므로 동일한 명령을 사용하여 원하지 않는 패키지를 제거할 수 있을 것이라고 생각했습니다.

해당 명령은 로 시작 DEBIAN_FRONTEND=noninteractive하고 apt-get remove다음과 같이 호출됩니다.

DEBIAN_FRONTEND=noninteractive apt-get remove --purge -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" package-1 package-2 ... package-n; apt-get -y autoremove; apt-get clean all 

환경변수를 처음 접하는데 DEBIAN_FRONTEND아직까지는 유용한 정보를 찾을 수 없었습니다. 그래서 무엇을 설정하는지 noninteractive, 그리고 권장되는 경우 해당 값( noninteractive)이 지속될 것이라고 가정하기 때문에 궁금합니다.

답변1

명령 앞에 단순히 apt명령을 추가하는 것은 DEBIAN_FRONTEND=something해당 명령이 적용된 단일 명령 이후에는 지속되지 않습니다.

옵션 DEBIAN_FRONTEND은 의 섹션 7 매뉴얼 페이지에 설명되어 있습니다 ( 시스템에서 이러한 옵션을 사용하려면 패키지를 debconf설치해야 할 수도 있습니다 ). debconf-doc에서 man 7 debconf:

Frontends
   One of debconf's unique features is that the interface it  presents  to
   you is only one of many, that can be swapped in at will. There are many
   debconf frontends available:

   dialog The default frontend, this uses  the  whiptail(1)  or  dialog(1)
          programs to display questions to you. It works in text mode.

   readline
          The  most  traditional frontend, this looks quite similar to how
          Debian configuration always has been:  a  series  of  questions,
          printed  out  at  the console using plain text, and prompts done
          using the readline library. It even supports tab completion. The
          libterm-readline-gnu-perl package is strongly recommended if you
          chose to use this frontend; the default readline module does not
          support  prompting  with default values.  At the minimum, you'll
          need the perl-modules package installed to use this frontend.

          This frontend has some special hotkeys. Pageup (or ctrl-u)  will
          go  back  to  the previous question (if that is supported by the
          package that is using debconf), and pagedown  (or  ctrl-v)  will
          skip forward to the next question.

          This is the best frontend for remote admin work over a slow con‐
          nection, or for those who are comfortable with unix.

   noninteractive
          This is the anti-frontend. It never interacts with you  at  all,
          and  makes  the  default  answers  be used for all questions. It
          might mail error messages to root, but that's it;  otherwise  it
          is  completely  silent  and  unobtrusive, a perfect frontend for
          automatic installs. If you are using this front-end, and require
          non-default  answers  to questions, you will need to preseed the
          debconf database; see the section below  on  Unattended  Package
          Installation for more details.

또한 다음과 같이 언급합니다.

   You can change the default frontend debconf uses by reconfiguring  deb‐
   conf.  On the other hand, if you just want to change the frontend for a
   minute, you can set the DEBIAN_FRONTEND  environment  variable  to  the
   name of the frontend to use. For example:

     DEBIAN_FRONTEND=readline apt-get install slrn

   The  dpkg-reconfigure(8) and dpkg-preconfigure(8) commands also let you
   pass --frontend= to them, followed by the frontend  you  want  them  to
   use.

   Note  that not all frontends will work in all circumstances. If a fron‐
   tend fails to start up for some reason, debconf will print out  a  mes‐
   sage explaining why, and fall back to the next-most similar frontend.

답변2

무인 스크립트(Dockerfile 포함)를 작성할 때, apt install -y그러나없이 DEBIAN_FRONTEND=noninteractive, 대화형 프롬프트에서 설치가 중단되는 경우가 있습니다.

여기에 이미지 설명을 입력하세요

이러한 대화형 x 프롬프트 와 함께 설치 명령을 실행하면 DEBIAN_FRONTEND=noninteractive비활성화됩니다.

관련 정보