From 8d7711709d452c7f9dc2cc4bca6f05fec834d6e7 Mon Sep 17 00:00:00 2001 From: ceetav Date: Thu, 24 May 2018 00:13:49 +0300 Subject: [PATCH] centos, rhel, oracle: remove previous kernels to minimize image size `yum update` keeps several kernel versions installed at the same time (installonly_limit). Removing previous kernels drops the image size by about 50 megs. --- centos/scripts/cleanup.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/centos/scripts/cleanup.sh b/centos/scripts/cleanup.sh index f4db8a1c4..d1f960de1 100644 --- a/centos/scripts/cleanup.sh +++ b/centos/scripts/cleanup.sh @@ -57,3 +57,7 @@ fi # delete any logs that have built up during the install find /var/log/ -name *.log -exec rm -f {} \; + +# remove previous kernels that yum preserved for rollback +yum install -y yum-utils +package-cleanup --oldkernels --count=1 -y