Hi,
I wonder if there's an easy way to strip down an installation to the bare minimum, e. g. the packages you get when you select "minimum installation".
In Slackware, the bone-headed package manager slackpkg has a few nice options, among which 'slackpkg clean-system', which removes all third-party packages in one single operation, or 'slackpkg remove <package_group>', which does exactly that.
I know CentOS has yum groupinstall/groupremove etc. but as far as I can tell, if I only have a handful of packages from a package group installed, yum grouplist lists the group as not installed, so there's not an easy way to tell.
You may wonder why I want to do this. I have CentOS installed on some sandbox machines here, and I like to fiddle with different desktops and setups just for the sake of experimenting.
Cheers,
Niki
On 2/25/2015 10:23 AM, Niki Kovacs wrote:
I wonder if there's an easy way to strip down an installation to the bare minimum, e. g. the packages you get when you select "minimum installation".
I install from the 'minimum' ISO, and get that off the bat, then just install the packages I need with yum
Le 25/02/2015 19:36, John R Pierce a écrit :
I install from the 'minimum' ISO, and get that off the bat, then just install the packages I need with yum
I do the same, but my question is: how to do that the other way around? Let's say you start from the base system, then install a couple dozen command-line utilities from cowsay to whois, then you install the "X Window System" group, a couple dozen fonts, then the WindowMaker window manager, then a handful of X applications... how do you manage from there to get back to exactly the base system you had from the start? I know this may sound a little academic, but it's for a little private experiment here.
Niki
On Wed, Feb 25, 2015 at 2:04 PM, Niki Kovacs info@microlinux.fr wrote:
Le 25/02/2015 19:36, John R Pierce a écrit :
I install from the 'minimum' ISO, and get that off the bat, then just install the packages I need with yum
I do the same, but my question is: how to do that the other way around? Let's say you start from the base system, then install a couple dozen command-line utilities from cowsay to whois, then you install the "X Window System" group, a couple dozen fonts, then the WindowMaker window manager, then a handful of X applications... how do you manage from there to get back to exactly the base system you had from the start? I know this may sound a little academic, but it's for a little private experiment here.
Niki
It's not automatic so maybe not what you're looking for, but reviewing the yum log in /var/log/ will give you a chronological list of what packages were installed, so you could use that create a list of packages to remove. Be careful about updates that masquerade as installations, like kernel packages.
You could also query by install date as outlined here:
http://unix.stackexchange.com/questions/2291/centos-list-the-installed-rpms-...
I don't think there's a single yum command that lets you roll back to the packages the were installed at a given point in time. I also don't think that this would get you back to the *exact* system as it was. Linux packages aren't completely self contained like that, and have the potential to make other changes to the system, so it's not a completely clean rollback. At minimum, you'd have rpmsave files laying around, probably empty directories, etc...
❧ Brian Mathis @orev
Le 25/02/2015 20:18, Brian Mathis a écrit :
I don't think there's a single yum command that lets you roll back to the packages the were installed at a given point in time.
Maybe a good idea would be to find one or a handful of packages that the whole desktop and/or graphical subsystem depends on. Removing this one package - or this handful of packages, but which? - would already result in removing everything X11-related. After that, I can always manually sort out the remaining command-line stuff.
Niki
On Wed, 25 Feb 2015 20:04:22 +0100 Niki Kovacs wrote:
how do you manage from there to get back to exactly the base system you had from the start?
My approach would be to create a list of installed rpms for what you're using as the base system:
rpm -qa --qf "%{NAME}\n" | sort > starting.txt
Run that command again when you have all of the extra stuff installed, using a different filename for the output, for example, ending.txt
Now merge and compare those files, and pull out the unique entries:
sort starting.txt ending.txt | uniq -u > newstuff.txt
Now remove the files in newstuff.txt
yum remove `cat newstuff.txt`
There is probably a way to combine those last two steps into one single command.
On 2/25/2015 12:04 PM, Niki Kovacs wrote:
Le 25/02/2015 19:36, John R Pierce a écrit :
I install from the 'minimum' ISO, and get that off the bat, then just install the packages I need with yum
I do the same, but my question is: how to do that the other way around? Let's say you start from the base system, then install a couple dozen command-line utilities from cowsay to whois, then you install the "X Window System" group, a couple dozen fonts, then the WindowMaker window manager, then a handful of X applications... how do you manage from there to get back to exactly the base system you had from the start? I know this may sound a little academic, but it's for a little private experiment here.
Before I discovered the minimal iso I found that I could unselect everything and still get a working install with CentOS on my servers. Curiously, that didn't work with RedHat, had to at least select the "base" option and then go thru the base options to deselect bits. My experience is only up thru v6, don't know about v7 (refuse to use it for now). -- Steve
On Feb 25, 2015 10:00 PM, "Peter" peter@pajamian.dhs.org wrote:
I haven't tried this, but see if it works: yum shell remove * install @minimal run
I've not tried this to see the effect but don't forget in el6 there is the yum history database...
yum history list will show all yum operations that have happened on the system.
In principle you could do yum history rollback 1 ... That wouldn't clear up config data of course.
For testing stuff VM use and templates or snapshots are essential tools. Or create a bare minimal kick start ... Doesn't take long to do a fresh install to a clean system that way.
The best way to do this is a new minimal install either in the GUI installer or with kickstart. And build up from there.
If you do an install to e.g. CentOS-base.qcow2, that image already has machine-id and hostname set. While not running a VM, use guestfish to mount the qcow2, and make /etc/machine-id empty. Now, only use this base.qcow2 as a backing image. That is, never use it directly in a VM. Use
qemu-img create -b base.qcow2 -f qcow2 guest1.qcow2 qemu-img create -b base.qcow2 -f qcow2 guest2.qcow2 qemu-img create -b base.qcow2 -f qcow2 guest3.qcow2
Now use the guestn.qcow2 in the VM. And at first boot, the machine-id will be populated. I'm not sure of any negative consequences of not doing this, but if you want to use remote journalling it's necessary so that the single journal can keep machines uniquely identified (even when changing the hostname).
http://fedoraproject.org/wiki/Changes/Remote_Journal_Logging https://kashyapc.fedorapeople.org/virt/lc-2012/snapshots-handout.html
Extra info: Anaconda uses this on lives to do installations (quite a few of these options are consolidated with -a): rsync -pogAXtlHrDx
Am 26.02.2015 um 08:38 schrieb James Hogarth james.hogarth@gmail.com:
On Feb 25, 2015 10:00 PM, "Peter" peter@pajamian.dhs.org wrote:
I haven't tried this, but see if it works: yum shell remove * install @minimal run
I've not tried this to see the effect but don't forget in el6 there is the yum history database...
yum history list will show all yum operations that have happened on the system.
In principle you could do yum history rollback 1 ... That wouldn't clear up config data of course.
or
# rpm -qa --last
Lists the last installed package first. That way back would be one way to strip it down.
I have here some minimal systems with about 200 packages installed ( rpm -qa | wc ).
-- LF
Le 26/02/2015 10:30, Leon Fauster a écrit :
# rpm -qa --last
Lists the last installed package first. That way back would be one way to strip it down.
Here's a completely empiric approach, tried out on three different machines. It's not perfect, but it's already quite usable :
https://kikinovak.wordpress.com/2015/02/26/elaguer-un-systeme-centos/
Cheers,
Niki
Le 25/02/2015 23:00, Peter a écrit :
I haven't tried this, but see if it works: yum shell remove * install @minimal run
I get "Package group minimal does not exist"
What now?