Upgrading from a Previous Version

After you have Linux up and running, you may want to leave well enough alone - at least, for awhile. But sooner or later you're going to you'll read or hear about some program and decide you want to install it. Or you may want to upgrade some of the software you already have to take advantage of some new feature or bug fix.

Most of the major distributions update their releases every 3 to 6 months. You probably will not need to upgrade your software that often.

Some people feel it is better to backup everything you want saved and then reinstall from scratch; I subscribe to this. This is especially true of disk sets A and N. It's tricky to know which packages are related, your libraries and dependencies, etc., so unless you really know what you're doing there is considerable risk that you'll screw up your system with a partial upgrade. Besides, you've been through the setup program so you're familiar with it, and this will give you practice something you already know how to do. If you need to revise your partitioning scheme, this is a perfect opportunity to do so.

There are a number of package management tools available to make life a little easier. One of the most popular is rpm from Red Hat. (If you're using Slackware, there is a neat program called unrpm which works like rpm directly from the bash shell - just press F2 for the modified pulldown to install .rpm, .deb or .tgz or to untar them without installing.)

Most of the major distributions have their own idea of what's easiest and best - Red Hat uses .rpm, Debian has .deb, we all can use of venerable .tar.gz and .tgz.

What is especially appealing about using these tools is that it makes upgrades such a breeze. The catch is that you have to install packages with them to get that benefit when you need to upgrade; it you just installed with the Slackware setup program, for example, you will not be able to upgrade the kernel without a modest amount of work. Had you used rpm, for example, instead, the upgrade is painless. (You'll get a better idea of what this involves for Slackware later in this lesson.)

rpm works with packages in the .rpm format. The command to install is

rpm -i file.rpm

Another choice is yast from S.u.S.E. which is an excellent setup and maintence tool which does practically everything except walk the dog and take out the trash;-) I just put S.u.S.E. 5.1 through the paces and it passed all the tests with flying colors - with the single and monumental failure to install ppp; unfortunately, that's enough to disqualify it in my book. Hopefully, this is an isolated incident or will be fixed with the next release scheduled later this month or next.

You can use any of these tools with any any distribution; you do NOT have to be using Red Hat to use rpm. These are available at ftp://sunsite.unc.edu/pub/Linux/utils/package/ if you are interested. (Again, reading the documentation first and keeping notes during the procedure is the best policy.)

The following sequence applies to Slackware using pkgtool, and will require some adjustments if you are using RPM.

Backup your current configuration files - some packages will simply overwrite your existing files, and any changes you have made will be lost. Make a list of the packages you plan to remove and replace. Use the boot kernel floppy to boot your system - this makes it possible to remove and replace files that would be difficult or impossible to reach if you had booted from the hard disk. Log in as root. Mount your Linux partitions under /mnt (while still logged into the install floppy). For example, to mount your root ext2fs partition as the second partition on your first IDE hard disk, you would use

mount /dev/hda2 /mnt -t ext2

If you have other partitions that are part of your Linux filesystem, mount them after you've mounted the root partition. Once all the partitions are mounted, you need to activate swap (if you have a swap partition or swap file). Remove the packages using pkgtool - select the option 'Remove installed packages', and toggle your selections with the Spacebar as you go through the list using the cursor (arrow) keys. When your choices are all made and correct, press Enter and old packages will be cleanly removed.

Adding packages

If there's something on the CD-ROM you want to install, just go through the setup program - no need to reboot. Or you can use the pkgtool program or installpkg. Read the man pages before you use any new program.

The key is that you are always logged in as root when you add or remove packages. This is the only way you can be sure all the files and directories will be created and the links made.

tar and gzip

Almost always file are compressed to save storage space and transmission time over the Internet. The preferred format uses the GNU utility gzip which has a .gz extension. Unlike pkzip (which you may be familiar with in DOS/Windows), gzip does not compress more than one file; and, unlike with pkzip, by using gzip the original file is automatically deleted - which can give you a rude awakening if you're not prepared for it. Similarly, the gunzip utility also deletes the original file.

To combine files into one large archive and retain the original directory structure, the tar utility is used. You cannot use absolute pathnames with tar, however, because the leading slash is stripped off to prevent overwriting existing files when a tar file is unarchived.

You can combine these two utilities - first using tar to create an archive of the directory, subdirectories, and hidden files, then using gzip to compress that archive and delete it so that you are left with the original directory files intact and a tarred and gzipped file of it.

The commands would be something like the following.

tar -cvf newarchive.tar .

Note the trailing dot to specify the current directory will be tarred into the file newarchive.tar

gzip newarchive.tar

Or you could combine these on the same command line using a pipe; or use another feature of the tar utility to gzip on the fly.

tar -cvzf newarchive.tar.gz

You should read the section in your textbook carefully, as well as the man pages, and try using the various combinations on files and directories that can be replaced.

Please note that you will tar first, then gzip to create an archive; gzip deletes the original file - in this case, filename.tar. You probably do not want to delete all the individual files in a directory which you will do by running gzip without tar first.

Backups

Now you really have no excuse for not making backups - just set up a cron job to backup your system files (configuration files) and your data files (your work).

Without effort, without pain, without excuse.

This Website is hosted by :

Back to the main page