[CentOS] Easy switch from Fedora 14 to CentOS 6??

Tue Jul 12 15:10:59 UTC 2011
Lamar Owen <lowen at pari.edu>

On Tuesday, July 12, 2011 10:23:59 AM Beartooth wrote:
> 	Of course I can switch, I know, by brute force : just install 
> CentOS over top of Fedora. But that would require a tedious day (of 
> manually re-tweaking panels, adding & removing software, etc. ad nauseam, 
> *and* transferring a backup copy of my data back onto the machine) -- 
> which I'd prefer to avoid.

Separate /home.  However, you're going to be downgrading things; it would be very much like downgrading from F14 to F12.  For GNOME that might not be too hard; for KDE it will be painful, as lots of things have changed from KDE 4.3 to KDE 4.6.

> 	What I want to do, if I can, is emulate the upgrades I've been 
> doing with each new release of Fedora. I'm hoping, since the like can be 
> done from SL, maybe it can also be done from Fedora.

SL is far far far closer to CentOS than any Fedora would be.  Even if you were running F12 you'd likely have issues.  And that's probably the closest Fedora to C6.

SL is virtually identical; Fedora is not.

Having said all that, the way I typically do that sort of reinstall is to make sure that I have a backup of my separate /home partition (but please note that I've been doing this for over a decade, and have learned some of this the hard way!), then I run:
rpm -qa --queryformat="%{NAME}\n" > current-os-rpms.lst
and save that file somewhere.

At that point, I'll boot a liveCD/DVD of the new distribution and  I'll use yum and repoquery to get lists of available packages and compare with the list of packages I have on the current system (diff, cut, awk, and friends give you the tools to do this in a scriptable manner, but I'll leave it as an exercise to do that).  I'll trim out packages that no longer exist, or, if those packages are important I'll track down a repo with those packages.  Or decide to build my own.  The final list of packages to install will then be saved somewhere safe (like a USB stick or something).

I then back up the whole /etc and /root trees.  If I have stuff in /opt and/or /usr/local, I back that up, too.

I then reinstall, leaving my current /home partition alone (and unmounted), if possible.  If I have to repartition, it may not be possible (like the /boot size increase needed for >F12), in which case I'll backup /home and restore from the backup once the repartition/reinstallation is complete (I've found that a full backup/restore can take essentially the same amount of time or less than using a 'partition move' program if the start point of the filesystem on that partition has to be changed).  

Once the new system comes up and I've fully updated with 'yum update,' I'll retrieve the package list I saved off to USB stick, and I'll then pipe that package list into yum:

cat old-os-edited.lst | xargs -n 10000 | yum -y install

(while I know some folks don't particularly care for xargs, it is just about the quickest way to de-newline a list)

Once I'm satisfied with the running system (without my own /home), I'll set up the mount point for /home (being sure I have a current backup of everything), I'll touch /.autorelabel, look through my old /etc and /root trees (and /opt and /usr/local if needed) and see what I might need to copy (/etc/sysconfig/network-scripts for instance) and what needs to be edited (this is what takes the longest), and reboot.  

The SELinux relabel I have found to be a frequently necessary thing, as about half the time /home will come up mislabeled (in my experience/history of doing this) and that can make it difficult or even impossible for my normal user to log in.  And the relabel (or running with SELinux in permissive mode or disabled) will be absolutely required in the case of a backup/restore of /home if a backup/restore tool that doesn't save/restore SELinux contexts is used.  And while a relabel of /home might be sufficient, I go ahead and do the full relabel anyway; it's fully automated and is a good time for a coffee break.

That's what I do, even for an upgrade as small as F13->F14, and I'm personally contemplating going from F14 -> C6 as well, once I find or build reasonably modern (4.6 at least) KDE packages.  I use too many of the newer features to go back all the way to KDE 4.3.

But YMMV, as I've been going that route for quite some time.