snidley has asked for the wisdom of the Perl Monks concerning the following question:

Ohm...ohm...(draining resistance...) This most unworthy novitiate is in need of asking assistance of those wiser than he beyond the Perl Gates. I am in the process of migrating applications from AIX to Linux. Other application environments came first. Now I need to move the Perl apps. The original apps run under 5.8.8 on AIX. To migrate them, I had installed RHEL5.4 on a server, and from the RHN site, installed 5.8.8 with several additional packages. I also performed a basic upgrade to make the various modules in use current from an RHN perspective. That is where the trouble started. I've installed base RPM's from RHN, and have also attempted to install additional modules through CPAN. I'm sure I did something wrong. I couldn't go through an exact set of steps that I've performed. All this started about a week and a half ago. Since then, because of what one of the messages said (which I can't quote right now) I attempted to install 5.12.1 through CPAN. Enough has gone wrong now that I think I need to punt, and start over. But I don't see anywhere what I need to do to remove Perl and start over. At this point, I've attempted installation of Perl under /opt, /usr/local, and at the standard places that RHN RPMs put things - basically, under /usr. I can probably use yum to remove those things installed by the RHN installation. For others, what do I need to do? Can I just delete things? If so, what? How? Just use "rm" of those things under "/usr/*/perl5", in addition to things under /usr/bin that are perl? Or is there something else? I can't keep burning time without results, so I'm coming to you all, unworthy as I am, to ask for help. Thanks in advance. I look forward to hearing from you. Snide

Replies are listed 'Best First'.
Re: Installing/Upgrading 5.8.8 to 5.12.1
by pemungkah (Priest) on Aug 02, 2010 at 21:29 UTC
    As you've learned, upgrading a Perl installed in any way other than a source build by using a source build will result in pain and suffering. You'll also find out that if you uninstall Perl via yum that it will take half the system with it (including X). So here's my recommendation:

    First use rpm -e --nodeps when removing Perl. This will remove the now-damaged Perl without breaking the rest of your system.

    Immediately reinstall the base system's Perl pachage, even if it's 5.10 or even 5.8.

    In the /usr/lib/perl5 directory, you can remove any 5.x directories that don't match the Perl you just reinstalled, along with anything in /usr/lib/perl5/site_perl that doesn't match your current Perl version.

    You can now kill off any other Perl builds you did (in /opt, /usr/local, etc.). Anything that isn't an already-existing path under RH can be removed wholesale (I believe /opt/local falls under that heading); anything that was there before will require careful surgery. The /usr/local one will probably be the most trouble, as there'll be a bunch of scripts installed allong with Perl that end up in /usr/local/bin.

    Your best bet after the system Perl is restored and you've built a new one elsewhere is to check the new bin directory and clean out anything that's in there that's also in /usr/local/bin. /usr/local/lib can be handled like the /usr/lib example above, except that any version of Perl you spot in there can go. You may at this point have some leftovers, but they shouldn't cause you any problems.

    I highly recommend that you simply ignore the system Perl altogether and do everything via the one you install. Use CPAN with that one to install modules. If for any reason you simply must diddle with the system Perl, only use yum and RPMs; do not use CPAN there, as it will confuse things when it comes to trying to install stuff via RPM. The cpanspec package is useful if you decide that you have loads of time to waste and you want to build your own RPM-based packages (I don't recommend this, if you can't guess!).

      I installed perl 5.8.9, 5.10.1 and 5.12.1 (from source) in /usr/local/perl5 (in that order). Do not accept the defaults, install it the long way. Due to the fact that a) I had the time and b) I had the disk space, I made sure that each version did not reference the earlier versions. This way, I have a "clean" install of each (even though they reside in the same upper level directory. You will find perl5.8.9, perl5.10.1 and perl5.12.1 executables in the basedir/bin directory.

      Then I started with the base perl install (using autobundle) and then used the resulting snapshot file to install all base modules to each version (example: "perl5.8.9 -MCPAN -eshell" then "install Snapshot_2010_08_03_01").

      Now, you can add whatever modules you want from CPAN.

      Do not touch the system install (in /usr/bin and /usr/share/perl5). Simply set your non-root path to include /usr/local/perl5/bin before /usr/bin or use explicit paths. Since you defined the base directory during the install, the PATH environment variable (to find the perl executable) is the only one you need.

      Good luck with your project :-)

      Update: To get back to base on your system, do "yum reinstall perl*" (I don't use the -y flag, mainly so that I get out of the habit). If you get into the habit of something like "yum -y reinstall XXX", it is easy to forget and do something like "yum -y remove XXX" which will do exactly what you tell it to: remove the package and all of its dependents. As was noted above, using yum to remove perl will remove the X server among other things without prompting. That will ruin your whole day.

      Update 2:Clarified warning on yum -y.

Re: Installing/Upgrading 5.8.8 to 5.12.1
by SpiceMan (Sexton) on Aug 03, 2010 at 00:27 UTC
    To avoid such kind of pains in the future, do use App::perlbrew and/or local::lib.