http://www.perlmonks.org?node_id=1014235

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

Firstly, I apologise if this question is very basic as I am new to perl. We have a small linux network (15 users) running red hat linux. We have started dabbling in perl. A few users, myself included, have superuser privileges and are in the process of translating and updating some of our older csh scripts to perl. To do so we have had to install quite a few modules through CPAN. Once the scripts are written we place them in a folder that is accessible to all users in our network so that they can execute them when required. However, these users haven't yet installed the required perl modules. I guess my question is, how can I or others with root privileges ensure that the perl modules installed for all other users on all computers are consistent. Can this be done in a simple script rather than physically going to each computer and installing the modules by brute force? Thanks
  • Comment on Ensuring cpan modules installed on all computers in a network are consistent

Replies are listed 'Best First'.
Re: Ensuring cpan modules installed on all computers in a network are consistent
by BrowserUk (Patriarch) on Jan 20, 2013 at 01:56 UTC
    Once the scripts are written we place them in a folder that is accessible to all users in our network ...

    Why not also share the installed Perl in the same way, then you only need to maintain a single copy of both perl and its installed modules.

    And if you make the shared folder readonly to your users, they cannot modify anything.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Ensuring cpan modules installed on all computers in a network are consistent
by tobyink (Canon) on Jan 19, 2013 at 22:43 UTC

    About a month ago there was a PerlAdvent.org article which presents a good solution for this sort of problem.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

      Indeed! Jeffrey Thalhammer came and spoke to the Thousand Oaks Perl Mongers (Southern California) a month or so ago about the Pinto project. It seems to me it's the solution the exact problem this OP is trying to solve.


      Dave

Re: Ensuring cpan modules installed on all computers in a network are consistent
by blue_cowdawg (Monsignor) on Jan 20, 2013 at 01:12 UTC
        ensure that the perl modules installed for all other users on all computers are consistent.

    First off, you need one person or one committee to decide on what is "standard" for your enterprise.

    Second, there are at least two ways to do this that come to mind immediately.

    First method would be to set up NFS/AFS/whatever mounts with Perl and its modules all set up. In doing this you could mount it someplace such as /MyCompany/Perl or whatever and provide symbolic links for /usr/bin/perl and friends. This is a "yucky" way of doing it but very similar to what I was doing at a major financial firm back around 2001. AFS was used and we actually had to support multiple versions of Perl on multiple platforms and for multiple OS versions (Solaris vs. SunOS for instance).

    The other method that leaps to mind is to build out what you want for Perl from source, add the modules you want and then package this all up and install it everywhere. This is actually my preferred method and in the current environment that I work in we have a standard mount point for all locally produced packages. You can decide if you want to do symbolic linking or just put #!/my/mount/path/perl/bin/perl in all your scripts.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: Ensuring cpan modules installed on all computers in a network are consistent
by 7stud (Deacon) on Jan 20, 2013 at 01:45 UTC

    I've never used it before, but the cpan command has an autobundle flag, that will bundle up all the installed modules. Then I think you should be able copy that file for all the users, and then install it. See here: link and here link Also, I don't know if you've heard of perlbrew or not, but if your users install perlbrew, they will be able to install any modules they want locally--thwarting your efforts to restrict all users to the modules you've chosen.

Re: Ensuring cpan modules installed on all computers in a network are consistent
by mhearse (Chaplain) on Jan 20, 2013 at 17:49 UTC
    The way I've done it is using software package management. This includes Redhat based (rpms), Debian (dpkg) or BSD (pkgng or ports). Creating packages is a bit of a pain. But a definitive way to ensure uniform machines.
      Would this be a case of running a root script which secure shells to each computer on the network and yum install or apt-get install the required library. I assume this would save the downloaded package in /usr/lib and the perl module would then be available for all users on that computer?
        You could do that. The way I've done is via puppet and cfengine. Also via func and ansible. Ducks for mentioning python apps on a perl pub These methods require some work to get setup. SSL or SSH if you're the paranoid type (want to sleep soundly through the night).

        Create your rpm and then deploy it:

        for i in $(cat serverlist) do ssh "$i" "sudo yum -y install your.rpm" done
Re: Ensuring cpan modules installed on all computers in a network are consistent
by bcarroll (Pilgrim) on Jan 21, 2013 at 05:37 UTC