Annotation of doc/build/systemperl_howto.html, revision 1.1

1.1     ! matthew     1: <html>
        !             2: <head>
        !             3: <title>The LON-CAPA systemperl HOW-TO</title>
        !             4: </head>
        !             5: <body>
        !             6: 
        !             7: <h1>The LON-CAPA systemperl HOW-TO</h1>
        !             8: <p>
        !             9: The LON-CAPA systemperl rpm holds all of the perl modules required by LON-CAPA
        !            10: but not a part of LON-CAPA.  Additionally, other libraries have been included 
        !            11: as well.  
        !            12: This document describes in some detail the commands and 
        !            13: processes necessary to build a systemperl rpm.  
        !            14: My goal in writing this document is to never, ever have to do this again.  
        !            15: The difficulty is not simply the tedium involved in determining the 
        !            16: dependencies and build/install orders of the packages.  
        !            17: The real chore is the severity of an error - if the systemperl rpm is not 
        !            18: complete, LON-CAPA will not work properly.
        !            19: </p><p>
        !            20: <i>Fun Fact:emacs thinks 'systemperl' is a misspelling of 'distemper'.</i>
        !            21: </p>
        !            22: 
        !            23: <ol>
        !            24: 
        !            25: <li>Find a machine to build on</li>
        !            26: <p>
        !            27: In the case of the 3.5 systemperl, we were still support Red Hat 6.2, so 
        !            28: we needed two machines.  The best situation would be to have a clean install 
        !            29: of RedHat and LON-CAPA (fully updated) installed in it as well.  This is easy
        !            30: for RedHat 7.3 but less easy for RedHat 6.2.  
        !            31: For the latter case, I used data.lite.msu.edu.  This caused some problems so
        !            32: you should thoroughly test your rpm by doing a few test installations on 
        !            33: little-used machines - preferably access servers that are not used regularly.
        !            34: </p>
        !            35: 
        !            36: <li>Set up your work environment</li>
        !            37: <p>
        !            38: You will need to set up directories.  I used <tt>/root/systemperl/</tt> 
        !            39: as my base directory on data.lite.msu.edu.  I had to make the following
        !            40: directories:
        !            41: <pre>
        !            42: mkdir /root/systemperl
        !            43: mkdir /root/systemperl/modules
        !            44: mkdir /root/systemperl/root
        !            45: mkdir /root/systemperl/root/usr
        !            46: mkdir /root/systemperl/oldrpm
        !            47: mkdir /root/systemperl/oldrpm/var
        !            48: mkdir /root/systemperl/oldrpm/var/lib
        !            49: mkdir /root/systemperl/oldrpm/var/lib/rpm
        !            50: </pre>
        !            51: The <tt>rpm</tt> directory is required by rpm but it can't seem to make
        !            52: the directory itself.  <i>Fun Fact: rpm --usage causes a segfault on 
        !            53: RedHat 7 systems.</i>
        !            54: </p>
        !            55: 
        !            56: <li>Get the old systemperl</li>
        !            57: <p>
        !            58: Typically found living somewhere on Zaphod.  I suggest, as root, doing
        !            59: </p>
        !            60: <pre>
        !            61: find /home -name "*systemperl*"
        !            62: </pre>
        !            63: <p>
        !            64: The rest of this document assumes you're working with 
        !            65: <tt>LON-CAPA-systemperl-3.4-1.i386.rpm</tt> as the previous version.  
        !            66: The new version will be <tt>LON-CAPA-systemperl-3.5-1.i386.rpm.</tt>
        !            67: </p>
        !            68: 
        !            69: <li>Figure out what was in the old rpm contains</li>
        !            70: <p>
        !            71: Extract the rpm to a test directory.  I suggest 
        !            72: <tt>/root/systemperl/oldrpm</tt>
        !            73: <pre>
        !            74: rpm --install --force --noscripts --nodeps -r /root/systemperl/oldrpm LON-CAPA-systemperl-3.4-1.i386.rpm
        !            75: </pre>
        !            76: List all the files (ls -lR) and see what perl modules and libraries are in it.
        !            77: You will probably need to get all of these modules and libraries.
        !            78: </p><p>
        !            79: To get a list of new modules you may need to get, grep the loncapa source tree
        !            80: using the following simple command:
        !            81: <pre>
        !            82: find /home/matthew/loncapa -name "*.p[lm]" -exec grep "^use " {} \; \
        !            83:   | cut -d ' ' -f 2 | perl -pe 's/([\(\)\;]|\s+$)//g; $_.="\n"' | \
        !            84:   grep -v ^Apache | sort -u
        !            85: </pre>
        !            86: </p>
        !            87: 
        !            88: <li>Get source code for libraries you need to include</li>
        !            89: <p>
        !            90: You may need to include libgd or some other library in the systemperl.
        !            91: Google for the library and seek out the home page of the project developing it.
        !            92: You'll probably wind up with a tarball instead of an rpm.  (If you can find an 
        !            93: rpm for all the systems you have to support I suggest just requiring people to
        !            94: install the rpm directly instead of repackaging it (which I won't talk about).)
        !            95: So untar it and, if you're lucky, it will use a configure script to determine
        !            96: how to compile the package.  For example:
        !            97: <pre>
        !            98: tar zxf gd-2.0.9.tar.gz
        !            99: cd gd-2.0.9
        !           100: ./configure --prefix /root/systemperl/root/usr/
        !           101: make
        !           102: make install
        !           103: </pre>
        !           104: </p><p>
        !           105: If you find later that some perl modules are being compiled against this
        !           106: library (such as <tt>GD.pm</tt>), you will want to be sure you have this
        !           107: installed properly on the machine you're building on.  I suggest:
        !           108: <pre>
        !           109: rm -rf gd-2.0.9
        !           110: tar zxf gd-2.0.9.tar.gz
        !           111: cd gd-2.0.9
        !           112: ./configure
        !           113: make
        !           114: make install
        !           115: </pre>
        !           116: </p>
        !           117: 
        !           118: <li>Get new versions of perl modules</li>
        !           119: <p>
        !           120: I used CPAN.  
        !           121: <pre>
        !           122: # perl -MCPAN -e shell
        !           123: </pre>
        !           124: By issuing 'get <modulename>' commands you can grab all the files you need.
        !           125: </p><p>
        !           126: However, where the modules end up is another story.  The default storage
        !           127: place for modules is <tt>/root/.cpan/sources/...</tt>.  
        !           128: I have not found a reliable way to set this supposedly configurable option.  
        !           129: Issue a "<tt>o conf</tt>" to see what options are available in the CPAN shell.
        !           130: One method might be issuing the following commands (outside of the CPAN shell):
        !           131: <pre>
        !           132: cd /root/.cpan
        !           133: find . -name "*.tar.gz" -exec rm {} \;
        !           134: perl -MCPAN -e shell
        !           135: # Do your module downloading
        !           136: find . -name "*.tar.gz" -exec mv {} /root/systemperl/modules \;
        !           137: </pre>
        !           138: Do not simply issue the above commands without knowing what they do.
        !           139: </p><p>
        !           140: The method I used was slightly more iterative, where I copied each *.tar.gz out
        !           141: as it came in.
        !           142: </p>
        !           143: 
        !           144: <li>Compile the Perl Modules</li>
        !           145: <p>
        !           146: For each module you grabbed, you'll need to issue the following commands
        !           147: to compile it:
        !           148: <pre>
        !           149: tar zxf &lt;modulename&gt;.tar.gz
        !           150: cd &lt;modulename&gt;
        !           151: perl Makefile.PL PREFIX=/root/systemperl/root
        !           152: make
        !           153: make test
        !           154: make install
        !           155: </pre>
        !           156: The <tt>make test</tt> is probably not necessary in some cases.  Some packages
        !           157: require information from you during the <tt>perl Makefile.PL</tt> step.  
        !           158: Some packages will complain that you don't have prerequisite packages 
        !           159: installed.
        !           160: If you have already downloaded these packages you will need to install them on
        !           161: the live system you are building the package on.  For example, GDGraph will not
        !           162: compile without GD being installed on the machine.  So you must build GD.pm 
        !           163: <b>and</b> install it on the current machine by doing
        !           164: <pre>
        !           165: cd GD-&lt;version&gt;
        !           166: perl Makefile.PL
        !           167: make
        !           168: make install
        !           169: </pre>
        !           170: before you attempt to compile GDGraph.pm.  
        !           171: <b>Note</b>:  There is no <tt>make test</tt> for GD.pm.  
        !           172: </p><p>
        !           173: Of course, GD depends on the library libgd.so.  Thus, we need to have
        !           174: installed libgd prior to all of this.  <i>There is no automatic way of 
        !           175: settling these dependencies at this time.</i>
        !           176: </p>
        !           177: 
        !           178: <li>Package it together</li>
        !           179: <p>
        !           180: Ahh, building an rpm.  Legends tell of days when you had to work long and
        !           181: hard to build an rpm.  These days we have Scott Harrison's <tt>make_rpm.pl</tt>
        !           182: script which does the hard work for us.  Since you're likely to have to
        !           183: do this a lot, making a shell script might be wise:
        !           184: <pre>
        !           185: [root@data systemperl]# cat make_systemperl.sh 
        !           186: find ./root | perl make_rpm.pl LON-CAPA-systemperl 3.5 '' '' ./root
        !           187: </pre>
        !           188: </p><p>
        !           189: <b>NOTE</b>: A modification had to be made to make_rpm.pl in order for it to
        !           190: accept a name of LON-CAPA-systemperl.  By default the make_rpm.pl script does
        !           191: not allow for non-alphanumeric characters in the package name.  This bites.
        !           192: So you'll want to bypass that test in the make_rpm.pl script.
        !           193: </p><p>
        !           194: The invocation of make_rpm.pl given above omits a lot of options.
        !           195: If you need to do something special with your systemperl rpm I suggest you
        !           196: read the help available on make_rpm.pl.
        !           197: </p>
        !           198: 
        !           199: <li>Test installation</li>
        !           200: <p>
        !           201: So, you've made an rpm.  You should be proud.  
        !           202: You could be even prouder if you knew the thing worked.  
        !           203: So find a machine to test on.  I suggest either a little-used access server
        !           204: or a new machine you don't intend to keep around.
        !           205: </p><p>
        !           206: Do not simply install it on the machine you built on and decide it works.
        !           207: The process above only gives you the modules LON-CAPA depends on.  It does
        !           208: not tell you which modules those modules depend on.  Only actual use will
        !           209: tell you if your system is complete.
        !           210: </p><p>
        !           211: Install your rpm on the system 
        !           212: <pre>
        !           213: rpm --install --force LON-CAPA-systemperl-3.5.-1.rpm
        !           214: </pre>
        !           215: and install the new loncapa.  I suggest testing the following components:
        !           216: <ul>
        !           217: <li>kerberos 4 authentication</li>
        !           218: <li>kerberos 5 authentication</li>
        !           219: <li>spreadsheet, specifically excel output of spreadsheets</li>
        !           220: <li>statistics, specifically the degree of difficulty graphs</li>
        !           221: <li>A randomlabel problem</li>
        !           222: <li>search and search results</li>
        !           223: <li>enrollment upload</li>
        !           224: </ul>
        !           225: If there are any problems you have likely forgotten a library or have a bad
        !           226: version of the library.
        !           227: 
        !           228: </ol>
        !           229: </body>
        !           230: </html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>