大网数据广告活动
服务器运维问答

No APT Recommends with puppet

· 52CE 我爱测

I use puppet to manage a bunch of Debian servers at work, part if that includes installing packages. One package I install on several systems is nmap which is used to verify that firewall rules are setup properly. On Debian 7.0, …

问题原文

原帖链接 · Zoredache · CC BY-SA 3.0

I use puppet to manage a bunch of Debian servers at work, part if that includes installing packages. One package I install on several systems is nmap which is used to verify that firewall rules are setup properly. On Debian 7.0, if you have APT::Install-Recommends enabled you get a whole bunch of crap along with nmap (see below).

I don't want all the crap that install nmap with recommends enabled included. One solution would be to update my apt configuration with APT::Install-Recommends "0";. But I don't want to have this be the default. The majority of the time I want recommends included. The recommended packages are mostly fine, and I am not getting tons of stuff I don't need. But there are a few packages that are bringing thinks I don't want/need.

  package { 'nmap':
    ensure => installed,
    require => Class['apt'],
  }

Is there any method to control if recommends are installed via puppet when using the 'apt' package provider? I do not want to mess around with the aptitude provider since apt and aptitude are not entirely compatible with each other.

With Recommends

root@fw-01:~# apt-get install nmap
Reading package lists... Done
Building dependency tree       
Reading state information... Done
... 
The following NEW packages will be installed:
  fonts-droid fonts-liberation ghostscript gnuplot gnuplot-nox groff gsfonts
  imagemagick imagemagick-common libblas3 libblas3gf libcroco3 libcupsimage2
  libdjvulibre-text libdjvulibre21 libexiv2-12 libgfortran3 libgs9
  libgs9-common libijs-0.35 libilmbase6 libjbig2dec0 liblcms1 liblcms2-2
  liblensfun-data litesting firewall blensfun0 liblinear-tools liblinear1 liblqr-1-0
  libmagickcore5 libmagickcore5-extra libmagickwand5 libnetpbm10 libopenexr6
  libpaper-utils libpaper1 librsvg2-2 librsvg2-common libsvm-tools libwmf0.2-7
  netpbm nmap poppler-data psutils ufraw-batch
0 upgraded, 45 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.0 MB of archives.
After this operation, 93.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? 

Without Recommends

root@fw-01:~# apt-get --no-install-recommends install nmap
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libblas3 libblas3gf libgfortran3 liblinear1
Suggested packages:
  liblinear-dev
Recommended packages:
  liblinear-tools
The following NEW packages will be installed:
  libblas3 libblas3gf libgfortran3 liblinear1 nmap
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,405 kB of archives.
After this operation, 17.4 MB of additional disk space will be used.
Do you want to continue [Y/n]?

已采纳解答

原帖链接 · Tim Donohue · CC BY-SA 4.0

This is now possible via the "install_options" setting in the Puppet 'package' type: https://puppet.com/docs/puppet/latest/types/package.html#package-attribute-install_options

For example:

package { 'nmap':
  ensure          => installed,
  install_options => ['--no-install-recommends'],
}

The above ensures the "--no-install-recommends" option is passed to apt-get, which skips the recommended packages just for this install: http://manpages.ubuntu.com/manpages/precise/man8/apt-get.8.html

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-06-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。