AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 972516
Accepted
Asarluhi
Asarluhi
Asked: 2017-11-04 04:11:04 +0800 CST2017-11-04 04:11:04 +0800 CST 2017-11-04 04:11:04 +0800 CST

DEBIAN_FRONTEND 环境变量

  • 772

我潜在的托管服务提供商建议在终端中运行命令,以使基于 KVM 的服务器的操作系统映像最小化。由于他们的 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) 会持续存在。

apt
  • 1 1 个回答
  • 57559 Views

1 个回答

  • Voted
  1. Best Answer
    steeldriver
    2017-11-04T05:00:00+08:002017-11-04T05:00:00+08:00

    简单地在命令前面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.
    
    • 54

相关问题

  • 如何编写 shell 脚本来安装应用程序列表?

  • 如何查看存档中可用的软件包的所有版本?

  • 是否可以说出我安装的哪些软件包不在原版安装中?

  • 如何删除 PPA?

  • 使用 apt-get upgrade 时如何强制安装内核更新?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve