Category Archives: Redhat

Perl: How do I install Perl modules? eg. Installing LWP module for Perl.

The easiest way to install Perl modules is by installing them through “shell”. Let us say that you are trying to install very common module called: LWP

You can test to see if you have LWP installed by typing:
perl -MLWP -le "print(LWP->VERSION)"
If you get something like: Can’t locate LWP.pm in @INC means that you don’t have it installed. To install LWP, type:
perl -MCPAN -eshell
NOTE: most times it is okey for you to accept default answers to questions cpan asks.
You can read through cpan help by typing “h” without the quotes at cpan> prompt.
To continue installing LWP, type:
install Bundle::LWP
After few questions, and some text scrolling, you will have LWP installed. If for some reason you don’t want to do it this way, you can always obtain source for the module you are trying to install and build it from source files. You can obtain these files from CPAN site

CentOS and Redhat problem: NFS mount at boot up fails with error: “System Error: No route to host”

On our CentOS 4.4 box, I set up the nfs mount by putting the setting in fstab.

10.0.0.2:/export/files /files intr

After that I tested the setting by typing: mount /files Everything worked as expected and files was mounted successfully. At this point I wanted to make sure server will do nfs mounts automatically at boot up. To my surprise once I rebooted the server, nfs mount did not happen. I checked the logs and found this:

May 11 11:00:24 www3 mount: mount: mount to NFS server '10.0.0.2' failed:
May 11 11:00:24 www3 mount: System Error: No route to host.

But once server booted up, I typed mount /files and again, mount worked great. After poking around for a while I found out that when netfs script runs, netfs can not find network routes (due to network is still initializing). I tried few ways to get around this issue and settled on following solution:

vi /etc/init.d/netfs
insert: action $”Sleeping for 30 secs: ” sleep 30
right after: [ ! -f /var/lock/subsys/portmap ] && service portmap start
and right before: action $”Mounting NFS filesystems: ” mount -a -t nfs,nfs4

Basically we are going to give enough time for network to start and set up routes etc. You can play with that number after sleep command (we are basically pausing netfs script execution for 30 secs) and see what works for you. Once you are done, save/exit and reboot the server to see if number you used is sufficient sleep time. You can type df -h to see if it was mounted. If it wasn’t mounted, you can check /var/log/messages to see if nic was starting after nfs mount. If it is after, you will have to increase that number after sleep. Remember that you are only pausing the netfs script execution. Rest of the system continues to boot up. After I made changes, I checked my df output after reboot and my mount was there. I also checked /var/log/messages to see if everything looks ok there:

May 11 11:22:14 www3 kernel: bnx2: eth0 NIC Link is Up, 1000 Mbps full duplex
May 11 11:22:16 www3 netfs: Sleeping for 30 secs: succeeded
May 11 11:22:17 www3 netfs: Mounting NFS filesystems: succeeded