CentOS 7 の不要なパッケージを検討する

[CentOS 7.6.1810 (1902-01) Minimal](https://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-Minimal-1902-01.iso) でインストールされる 303 パッケージのうち、保護されていない 168 パッケージについて仮想環境上で不要なものを検討する。

パッケージではないが「[CentOS 7 の不要な言語(locale)を削除する - Qiita](https://qiita.com/bezeklik/items/a8274bb230f2efa61ffa)」で余計な言語ファイルを削除することができる。

## パッケージ数の確認
```bash
yum --quiet list installed | tail --lines=+2 | wc --lines
```
```
303
```
`rpm --all --query | grep --invert-match gpg-pubkey | wc --lines` でも同様。

## 保護パッケージの確認
`protected_packages` [^protected_packages] のデフォルト値の `yum` と `/etc/yum/protected.d` 配下のファイルで指定されている `systemd` は保護される。
それに伴い保護パッケージと依存関係にあるパッケージも削除することができない。

[^protected_packages]: ["protected_packages This is a list of packages that yum should never completely remove. They are protected via Obsoletes as well as user/plugin removals." - [main] OPTIONS - yum.conf(5) - Linux manual page](http://man7.org/linux/man-pages/man5/yum.conf.5.html)

[^protected_packages2]: ["The default is: yum glob:/etc/yum/protected.d/*.conf So any packages which should be protected can do so by including a file in /etc/yum/protected.d with their package name in it." - [main] OPTIONS - yum.conf(5) - Linux manual page](http://man7.org/linux/man-pages/man5/yum.conf.5.html)

[^protected_packages3]: ["Also if this configuration is set to anything, then yum will protect the package corresponding to the running version of the kernel." - [main] OPTIONS - yum.conf(5) - Linux manual page](http://man7.org/linux/man-pages/man5/yum.conf.5.html)

### repoquery
```bash
yum --assumeyes --quiet install yum-utils && \
repoquery --queryformat='%{name}\t%{ui_from_repo}' --all --installed \
 | grep @base | cut --fields=1 > yum-utils.txt
```
`repoquery` コマンドを使用するために `yum-utils` パッケージをインストール。
また、除外用に依存パッケージ3件を含めた計4件の追加インストールしたパッケージのリストを抽出。

[^repoquery]: [repoquery(1) - Linux manual page](http://man7.org/linux/man-pages/man1/repoquery.1.html)

### systemd
```bash
repoquery --requires --resolve --queryformat='%{na}' --recursive --installed systemd \
 | sort > protected_packages_systemd.txt
```
直接依存パッケージが33件、回帰的依存パッケージが111件。

### yum
```bash
repoquery --requires --resolve --queryformat='%{na}' --recursive --installed yum \
 | sort > protected_packages_yum.txt
```
直接依存パッケージが13件、回帰的依存パッケージが96件。

### インストール済みパッケージ
```bash
repoquery --queryformat='%{na}' --all --installed > yum_list_installed.txt
```
`yum --quiet list installed | sed 1d | cut --fields=1 --delimiter=' '` でも同様の情報が取得可能。

### 削除検討対象パッケージ一覧の出力
```bash
grep --invert-match \
 --file=yum-utils.txt \
 --file=protected_packages_yum.txt \
 --file=protected_packages_systemd.txt \
 yum_list_installed.txt > packages2consider4deletion.txt
```
インストール済みパッケージから保護パッケージを除外した結果、168件がリストアップされた。

```bash
echo -e "|パッケージ名|容量|サマリー|\n|---|--:|---|" > packages2consider4deletion.md
cat packages2consider4deletion.txt \
 | xargs repoquery --queryformat='|`%{name}`|%{size:k}|%{summary}|' --installed >> packages2consider4deletion.md
```
各パッケージのファイルサイズとサマリーを追記してMarkdown形式で出力。

## 削除検討対象パッケージ一覧 (168)

|パッケージ名|容量|サマリー|
|---|--:|---|
|`GeoIP`|3821 k|Library for country/city/organization to IP address or hostname mapping|
|`NetworkManager`|4952 k|Network connection manager and user applications|
|`NetworkManager-libnm`|6680 k|Libraries for adding NetworkManager support to applications (new API).|
|`NetworkManager-team`|36.4 k|Team device plugin for NetworkManager|
|`NetworkManager-tui`|260 k|NetworkManager curses-based UI|
|`NetworkManager-wifi`|120 k|Wifi plugin for NetworkManager|
|`aic94xx-firmware`|30.0 k|Adaptec SAS 44300, 48300, 58300 Sequencer Firmware for AIC94xx driver|
|`alsa-firmware`|9348 k|Firmware for several ALSA-supported sound cards|
|`alsa-lib`|1400 k|The Advanced Linux Sound Architecture (ALSA) library|
|`alsa-tools-firmware`|84.4 k|ALSA tools for uploading firmware to some soundcards|
|`audit`|623 k|User space tools for 2.6 kernel auditing|
|`authconfig`|2262 k|Command line tool for setting up authentication from network services|
|`bind-libs-lite`|1790 k|Libraries for working with the DNS protocol|
|`bind-license`|26.2 k|License of the BIND DNS suite|
|`biosdevname`|57.8 k|Udev helper for naming devices per BIOS names|
|`btrfs-progs`|4045 k|Userspace programs for btrfs|
|`centos-logos`|22020 k|CentOS-related icons and pictures|
|`chrony`|476 k|An NTP client/server|
|`cronie`|215 k|Cron daemon for executing programs at set times|
|`cronie-anacron`|40.7 k|Utility for running regular jobs|
|`crontabs`|3.61 k|Root crontab files used to schedule the execution of programs|
|`dbus-glib`|294 k|GLib bindings for D-Bus|
|`device-mapper-event`|41.8 k|Device-mapper event daemon|
|`device-mapper-event-libs`|49.4 k|Device-mapper event daemon shared library|
|`device-mapper-persistent-data`|1264 k|Device-mapper Persistent Data Tools|
|`dhclient`|475 k|Provides the ISC DHCP client daemon and dhclient-script|
|`dhcp-common`|240 k|Common files used by ISC dhcp client and server|
|`dhcp-libs`|146 k|Shared libraries used by ISC dhcp client and server|
|`dmidecode`|198 k|Tool to analyse BIOS DMI data|
|`dracut-config-rescue`|3.97 k|dracut configuration to turn on rescue image generation|
|`dracut-network`|145 k|dracut modules to build a dracut initramfs with network support|
|`e2fsprogs`|2489 k|Utilities for managing ext2, ext3, and ext4 filesystems|
|`e2fsprogs-libs`|355 k|Ext2/3/4 filesystem-specific shared libraries|
|`ebtables`|343 k|Ethernet Bridge frame table administration tool|
|`ethtool`|346 k|Settings tool for Ethernet NICs|
|`file`|65.9 k|A utility for determining file types|
|`fipscheck`|37.9 k|A library for integrity verification of FIPS validated modules|
|`fipscheck-lib`|11.2 k|Library files for fipscheck|
|`firewalld`|1818 k|A firewall daemon with D-Bus interface providing a dynamic firewall|
|`firewalld-filesystem`|0.23 k|Firewalld directory layout and rpm macros|
|`freetype`|805 k|A free and portable font rendering engine|
|`fxload`|41.6 k|A helper program to download firmware into FX and FX2 EZ-USB devices|
|`gettext`|4911 k|GNU libraries and utilities for producing multi-lingual messages|
|`gettext-libs`|1511 k|Libraries for gettext|
|`gobject-introspection`|834 k|Introspection system for GObject-based libraries|
|`groff-base`|3373 k|Parts of the groff formatting system required to display manual pages|
|`grub2`|0.00 k|Bootloader with support for Linux, Multiboot and more|
|`grub2-common`|3824 k|grub2 common layout|
|`grub2-pc`|0.00 k|Bootloader with support for Linux, Multiboot, and more|
|`grub2-pc-modules`|2256 k|Modules used to build custom grub images|
|`grub2-tools`|9844 k|Support tools for GRUB.|
|`grub2-tools-extra`|6194 k|Support tools for GRUB.|
|`grub2-tools-minimal`|670 k|Support tools for GRUB.|
|`grubby`|124 k|Command line tool for updating bootloader configs|
|`hostname`|19.0 k|Utility to set/show the host name or domain name|
|`hwdata`|13405 k|Hardware identification and configuration data|
|`initscripts`|1484 k|The inittab file and the /etc/init.d scripts|
|`iproute`|1747 k|Advanced IP routing and network device configuration tools|
|`iprutils`|934 k|Utilities for the IBM Power Linux RAID adapters|
|`ipset`|75.6 k|Manage Linux IP sets|
|`ipset-libs`|175 k|Shared library providing the IP sets functionality|
|`iptables`|1519 k|Tools for managing Linux kernel packet filtering capabilities|
|`iputils`|335 k|Network monitoring tools including ping|
|`irqbalance`|69.6 k|IRQ balancing daemon|
|`ivtv-firmware`|837 k|Firmware for the Hauppauge PVR 250/350/150/500/USB2 model series|
|`iwl100-firmware`|455 k|Firmware for Intel(R) Wireless WiFi Link 100 Series Adapters|
|`iwl1000-firmware`|782 k|Firmware for Intel® PRO/Wireless 1000 B/G/N network adaptors|
|`iwl105-firmware`|799 k|Firmware for Intel(R) Centrino Wireless-N 105 Series Adapters|
|`iwl135-firmware`|810 k|Firmware for Intel(R) Centrino Wireless-N 135 Series Adapters|
|`iwl2000-firmware`|805 k|Firmware for Intel(R) Centrino Wireless-N 2000 Series Adapters|
|`iwl2030-firmware`|816 k|Firmware for Intel(R) Centrino Wireless-N 2030 Series Adapters|
|`iwl3160-firmware`|10192 k|Firmware for Intel(R) Dual Band Wireless-AC 3160 Series Adapters|
|`iwl3945-firmware`|272 k|Firmware for Intel® PRO/Wireless 3945 A/B/G network adaptors|
|`iwl4965-firmware`|309 k|Firmware for Intel® PRO/Wireless 4965 A/G/N network adaptors|
|`iwl5000-firmware`|1140 k|Firmware for Intel® PRO/Wireless 5000 A/G/N network adaptors|
|`iwl5150-firmware`|455 k|Firmware for Intel® PRO/Wireless 5150 A/G/N network adaptors|
|`iwl6000-firmware`|569 k|Firmware for Intel(R) Wireless WiFi Link 6000 AGN Adapter|
|`iwl6000g2a-firmware`|1220 k|Firmware for Intel(R) Wireless WiFi Link 6005 Series Adapters|
|`iwl6000g2b-firmware`|1238 k|Firmware for Intel(R) Wireless WiFi Link 6030 Series Adapters|
|`iwl6050-firmware`|1037 k|Firmware for Intel(R) Wireless WiFi Link 6050 Series Adapters|
|`iwl7260-firmware`|6359 k|Firmware for Intel(R) Dual Band Wireless-AC 7260 Series Adapters|
|`iwl7265-firmware`|61599 k|Firmware for Intel(R) Dual Band Wireless-AC 7265 Series Adapters|
|`jansson`|73.2 k|C library for encoding, decoding and manipulating JSON data|
|`kbd`|1351 k|Tools for configuring the console (keyboard, virtual terminals, etc.)|
|`kbd-legacy`|492 k|Legacy data for kbd package|
|`kbd-misc`|2363 k|Data for kbd package|
|`kernel`|64661 k|The Linux kernel|
|`kernel-tools`|288 k|Assortment of tools for the Linux kernel|
|`kernel-tools-libs`|18.3 k|Libraries for the kernels-tools|
|`kexec-tools`|756 k|The kexec/kdump userspace component.|
|`less`|210 k|A text file browser similar to more, but better|
|`libaio`|38.3 k|Linux-native asynchronous I/O access library|
|`libcroco`|313 k|A CSS2 parsing library|
|`libdaemon`|60.6 k|Library for writing UNIX daemons|
|`libdrm`|363 k|Direct Rendering Manager runtime library|
|`libedit`|239 k|The NetBSD Editline library|
|`libestr`|43.3 k|String handling essentials library|
|`libfastjson`|55.9 k|A JSON implementation in C|
|`libgomp`|207 k|GCC OpenMP v3.0 shared support library|
|`libmnl`|50.6 k|A minimalistic Netlink library|
|`libndp`|73.8 k|Library for Neighbor Discovery Protocol|
|`libnetfilter_conntrack`|140 k|Netfilter conntrack userspace library|
|`libnfnetlink`|46.0 k|Netfilter netlink userspace library|
|`libnl3`|845 k|Convenience library for kernel netlink sockets|
|`libnl3-cli`|690 k|Command line interface utils for libnl3|
|`libpciaccess`|44.6 k|PCI access library|
|`libpipeline`|139 k|A pipeline manipulation library|
|`libpng`|602 k|A library of functions for manipulating PNG image format files|
|`libseccomp`|297 k|Enhanced seccomp library|
|`libselinux-utils`|169 k|SELinux libselinux utilies|
|`libss`|71.4 k|Command line interface parsing library|
|`libsysfs`|146 k|Shared library for interfacing with sysfs|
|`libteam`|98.5 k|Library for controlling team network device|
|`libunistring`|1119 k|GNU Unicode string library|
|`linux-firmware`|179813 k|Firmware files used by the Linux kernel|
|`logrotate`|105 k|Rotates, compresses, removes and mails system log files|
|`lsscsi`|88.4 k|List SCSI devices (or hosts) and associated information|
|`lvm2`|3033 k|Userland logical volume management tools|
|`lvm2-libs`|3691 k|Shared libraries for lvm2|
|`lzo`|161 k|Data compression library with very fast (de)compression|
|`make`|1133 k|A GNU tool which simplifies the build process for users|
|`man-db`|2089 k|Tools for searching and reading man pages|
|`mariadb-libs`|4507 k|The shared libraries required for MariaDB/MySQL clients|
|`microcode_ctl`|1769 k|Tool to transform and deploy CPU microcode update for x86.|
|`mozjs17`|3950 k|JavaScript interpreter and libraries|
|`newt`|181 k|A library for text mode user interfaces|
|`numactl-libs`|49.6 k|libnuma libraries|
|`openssh`|1949 k|An open source implementation of SSH protocol versions 1 and 2|
|`openssh-clients`|2589 k|An open source SSH client applications|
|`openssh-server`|971 k|An open source SSH server daemon|
|`openssl`|814 k|Utilities from the general purpose cryptography library with TLS implementation|
|`os-prober`|95.7 k|Probes disks on the system for installed operating systems|
|`parted`|2282 k|The GNU disk partition manipulation program|
|`passwd`|420 k|An utility for setting or changing passwords using PAM|
|`pciutils-libs`|71.0 k|Linux PCI library|
|`plymouth`|228 k|Graphical Boot Animation and Logger|
|`plymouth-core-libs`|218 k|Plymouth core libraries|
|`plymouth-scripts`|22.3 k|Plymouth related scripts|
|`polkit`|473 k|An authorization framework|
|`polkit-pkla-compat`|80.5 k|Rules for polkit to add compatibility with pklocalauthority|
|`postfix`|12467 k|Postfix Mail Transport Agent|
|`python-configobj`|598 k|Config file reading, writing, and validation|
|`python-decorator`|70.6 k|Module to simplify usage of decorators|
|`python-firewall`|1819 k|Python2 bindings for firewalld|
|`python-gobject-base`|1097 k|Python 2 bindings for GObject Introspection base package|
|`python-linux-procfs`|94.4 k|Linux /proc abstraction classes|
|`python-perf`|328 k|Python bindings for apps which will manipulate perf events|
|`python-pyudev`|236 k|A libudev binding|
|`python-schedutils`|42.1 k|Linux scheduler python bindings|
|`python-slip`|59.9 k|Miscellaneous convenience, extension and workaround code for Python|
|`python-slip-dbus`|74.6 k|Convenience functions for dbus services|
|`rootfiles`|0.58 k|The basic required files for the root user's directory|
|`rsyslog`|1958 k|Enhanced system logging and kernel message trapping daemon|
|`selinux-policy`|6.33 k|SELinux policy configuration|
|`selinux-policy-targeted`|19507 k|SELinux targeted base policy|
|`slang`|1838 k|The shared library for the S-Lang extension language|
|`snappy`|117 k|Fast compression and decompression library|
|`sudo`|3122 k|Allows restricted root access for specified users|
|`systemd-sysv`|3.89 k|SysV tools for systemd|
|`sysvinit-tools`|107 k|Tools used for process and utmp management.|
|`tcp_wrappers-libs`|131 k|Libraries for tcp_wrappers|
|`teamd`|272 k|Team network device control daemon|
|`tuned`|751 k|A dynamic adaptive system tuning daemon|
|`vim-minimal`|896 k|A minimal version of the VIM editor|
|`virt-what`|44.6 k|Detect if we are running in a virtual machine|
|`which`|75.2 k|Displays where a particular program in your path is located|
|`wpa_supplicant`|4308 k|WPA/WPA2/IEEE 802.1X Supplicant|
|`xfsprogs`|3985 k|Utilities for managing the XFS filesystem|





## 確認コマンド

### 利用モジュールの確認
```bash
cat /proc/modules | sort | cut -d' ' -f 1 | xargs modinfo | grep "description\|filename"
```

## ネットワーク関連

### iwl*-firmware (17)
|パッケージ名|容量|要約|
|---|--:|---|
|iwl100-firmware    |437k|Firmware for Intel® Wireless WiFi Link 100 Series Adapters|
|iwl1000-firmware   |764k|Firmware for Intel® PRO/Wireless 1000 B/G/N network adaptors|
|iwl105-firmware    |781k|Firmware for Intel® Centrino Wireless-N 105 Series Adapters|
|iwl135-firmware    |792k|Firmware for Intel® Centrino Wireless-N 135 Series Adapters|
|iwl2000-firmware   |787k|Firmware for Intel® Centrino Wireless-N 2000 Series Adapters|
|iwl2030-firmware   |798k|Firmware for Intel® Centrino Wireless-N 2030 Series Adapters|
|iwl3160-firmware   |8.9M|Firmware for [Intel® Dual Band Wireless-AC 3160](https://ark.intel.com/ja/products/75442/Intel-Dual-Band-Wireless-AC-3160) Series Adapters|
|iwl3945-firmware   |254k|Firmware for Intel® PRO/Wireless 3945 A/B/G network adaptors|
|iwl4965-firmware   |291k|Firmware for Intel® PRO/Wireless 4965 A/G/N network adaptors|
|iwl5000-firmware   |1.1M|Firmware for Intel® PRO/Wireless 5000 A/G/N network adaptors|
|iwl5150-firmware   |437k|Firmware for Intel® PRO/Wireless 5150 A/G/N network adaptors|
|iwl6000-firmware   |552k|Firmware for Intel® Wireless WiFi Link 6000 AGN Adapter|
|iwl6000g2a-firmware|1.2M|Firmware for Intel® Wireless WiFi Link 6005 Series Adapters|
|iwl6000g2b-firmware|1.2M|Firmware for Intel® Wireless WiFi Link 6030 Series Adapters|
|iwl6050-firmware   |1.0M|Firmware for Intel® Wireless WiFi Link 6050 Series Adapters|
|iwl7260-firmware   |6.2M|Firmware for [Intel® Dual Band Wireless-AC 7260](https://www.intel.co.jp/content/www/jp/ja/wireless-products/dual-band-wireless-ac-7260-bluetooth-brief.html) Series Adapters|
|iwl7265-firmware   | 30M|Firmware for [Intel® Dual Band Wireless-AC 7265](https://www.intel.co.jp/content/www/jp/ja/products/wireless/wireless-products/dual-band-wireless-ac-7265.html) Series Adapters|

Intel 製の無線 LAN カードのファームウェアなので利用しない場合は不要と思われる。

### NIC チーミング  (4)
|パッケージ名|容量|要約|
|---|--:|---|
|NetworkManager-team	|  53k|Team device plugin for NetworkManager|
|libteam		|98.5k|Library for controlling team network device|
|teamd			| 271k|Team network device control daemon|
|jansson		|73.2k|C library for encoding, decoding and manipulating JSON data|

NIC チーミングとは複数の NIC (Network Interface Card) を1つの NIC として使えるようにする技術。[^nic]

`jansson` パッケージは `teamd` パッケージの依存パッケージ。

[^nic]: ["NICチーミングとは、コンピュータやネットワーク機器が備える複数のネットワーク・インタフェース・カード（NIC：ニック）を、1つのNICとして使えるようにする技術である。" - NICチーミング | 日経 xTECH（クロステック）](https://tech.nikkeibp.co.jp/it/article/Keyword/20140304/540902/)

### NetworkManager (2)
|パッケージ名|容量|要約|
|---|--:|---|
|`NetworkManager-tui` |240k|NetworkManager curses-based UI|
|`NetworkManager-wifi`|144k|Wifi plugin for NetworkManager|


## 周辺機器

### サウンドカード (3)
|パッケージ名|容量|要約|
|---|--:|---|
|alsa-lib           |1.4M|The Advanced Linux Sound Architecture (ALSA) library|
|alsa-firmware      |9.1M|Firmware for several ALSA-supported sound cards|
|alsa-tools-firmware| 84k|ALSA tools for uploading firmware to some soundcards|

[ALSA](https://ja.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture) はサウンドカードのデバイスドライバ群のようなので、サウンドを利用しない場合は不要と思われる。

### ビデオチューナー (1)
|パッケージ名|容量|要約|
|---|--:|---|
|ivtv-firmware   |837k|Firmware for the Hauppauge [PVR 250](https://www.mythtv.org/wiki/Hauppauge_PVR-250)/[350](https://www.mythtv.org/wiki/Hauppauge_PVR-350)/[150](https://www.mythtv.org/wiki/Hauppauge_PVR-150)/[500](https://www.mythtv.org/wiki/Hauppauge_PVR-500)/[USB2](https://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-PVR-USB2) model series|

[Hauppauge](http://www.hauppauge.com/) のビデオチューナーを利用しない場合は不要と思われる。

### SAS RAID カード (1)
|パッケージ名|容量|要約|
|---|--:|---|
|aic94xx-firmware| 30k|[Adaptec SAS 44300](https://storage.microsemi.com/ja-jp/support/sas/sas/sas-44300/), [48300](https://storage.microsemi.com/ja-jp/support/sas/sas/sas-48300/), [58300](https://storage.microsemi.com/ja-jp/support/sas/sas/sas-58300/) Sequencer Firmware for AIC94xx driver|

### linux-firmware (1)
|パッケージ名|容量|要約|
|---|--:|---|
|linux-firmware  |126M|Firmware files used by the Linux kernel|

`/usr/lib/firmware` に展開されているファームウェア群。いずれも利用しない場合は不要と思われる。

### fxload (1)
|パッケージ名|容量|要約|
|---|--:|---|
|fxload|41.6 k|A helper program to download firmware into FX and FX2 EZ-USB devices|

[fxload(8): Firmware download to EZ-USB devices - Linux man page](https://linux.die.net/man/8/fxload)


## ブート関連

### centos-logos (1)
|パッケージ名|容量|要約|
|---|--:|---|
|centos-logos		|22020 k|CentOS-related icons and pictures|

### plymouth (3)
|パッケージ名|容量|要約|
|---|--:|---|
|plymouth		|228 k	|Graphical Boot Animation and Logger|
|plymouth-core-libs	|218 k	|Plymouth core libraries|
|plymouth-scripts	|22.3 k	|Plymouth related scripts|

`plymouth` パッケージを除去すると `/var/log/boot.log` が出力されなくなる。
ただし、 `/var/log/boot.log` の内容は `/var/log/message` に概ね含まれている。

## その他

### Cron (3)
|パッケージ名|容量|要約|
|---|--:|---|
|`cronie`|215 k|Cron daemon for executing programs at set times|
|`cronie-anacron`|40.7 k|Utility for running regular jobs|
|`crontabs`|3.61 k|Root crontab files used to schedule the execution of programs|
`systemd` の `timer` で代替可能。
Cron に依存したパッケージを利用する場合に影響を受けるので注意。

### dracut-config-rescue (1)
|パッケージ名|容量|要約|
|---|--:|---|
|dracut-config-rescue|3.97 k|dracut configuration to turn on rescue image generation|