Upgrade or new installation

Near the start of a linux installation, the installer usually asks whether this is to be an upgrade or a new installation.  Typically, “upgrade” implies updating the existing software to newer versions where available.  And “new installation” implies formatting the root file system and then starting over from scratch to install the latest release.

I have always chosen “new installation” at that step.  I prefer that, because it gives a cleaner system.  Some people prefer the upgrade path, so that they won’t have to redo as much local configuration.  Using a new installation, I also like to keep the reconfiguration as small as possible.  So here I shall outline how I handle that

User Configuration

The first thing to note, is that you can do a new installation, yet retain all of the ordinary user home directories.  This requires making “/home” a separate disk partition, or a separate logical volume within your logical volume group (if you use an LVM).  As long as I have made “/home” a separate partition, then when installing I can just use that same partition for “/home” without reformatting it.  That allows me to retain all user files.

Much of user configuration is in the hidden files in a user home directory.  So, as long as I retain “/home”, I will retain all of the user settings.  That leaves only the system wide configuration to be adjusted for my needs.  Most of that is in configuration files under “/etc”.  I typically don’t alter very many system wide files, so it won’t take me too long to update them.

System wide settings

To simplify the system configuration, I keep a log of the changes that I have made since installation.   In practice, I use the “rcs” command, and associated “ci”, “co” and “rcsdiff” to maintain the log.  However, all that is really needed, is keeping a copy of the originally distributed version of a file and a copy of the current version of the file.  The use of “rcs” just makes that a bit easier.

My log of system wide config changes is kept in the “/home” partition.  That way, it will be automatically available when I do a new install but preserve “/home”.  Since I use “rcs”, I simply create a directory “/home/RCS.etc”.  Then I symlink that to “/etc/RCS” so that I can use it as if the log were kept in “/etc/RCS”.  The first thing to do after a new install is to create that symlink

cd /etc
ln -s ../home/RCS.etc RCS

I use a relative path in that symlink, so that it is still available if I have booted from a repair disk, and mounted the installed system as, say, “/mnt”.

Just before installing a new system, I copy “/etc/group”, “/etc/passwd” and “/etc/shadow” to my log directory.  I will use that to merge existing users into the newly installed system.  I also use “tar” to save any installed files, such as scripts that I may have added in “/root/bin”

After the install, I use “su” to get to a root shell.  Next, I create the symlink to make my log of changes readily accessible.  Then I edit “/etc/group” to merge in any groups that I have created for my own use.  Next, I edit “/etc/passwd” to merge in additional users.  I browse my saved copy of the old passwd file to help me with that.  Then I edit “/etc/shadow” to add in the passwords for those merged in users.

Then I get to other files that I want to update.  I compare the newly installed file with what I had saved from the previous installation.  Then I compare with the modified version from the last installation.  From those comparisons (done using “diff” or “rcsdiff”), I work out what I need to change for the new install.

The main files that I change are “/etc/ssh/ssh_config”, “/etc/ssh/sshd_config”, “/etc/hosts”.  Depending on which of my systems, I might also update “/etc/hosts.allow” and “/etc/hosts.deny”.  And there may be one or two other files to update.  It usually doesn’t take long, and some of the updates can be postponed for a few days.

Advertisements

About Neil Rickert

Retired mathematician and computer scientist who dabbles in cognitive science.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: