Showing posts with label perl. Show all posts

RT 3.8.7 YUM Repository for RHEL5

Many months after building the RT 3.6.6 rpm repository, I finally got around to gathering up all the required perl modules (in rpm format) for version 3.8.7.

The result is a new, localized, module repository for the latest version of RT. The archive below includes a yum repo of the hierarchical perl dependencies required by the latest version, as well a a few that must be manually installed due to RPM file conflicts in RHEL5.


Instructions:

Download the following archive:   rt_3.8.7_bundle.zip

Unzip the archive:

unzip rt_3.8.7_bundle.zip

The archive contains the following files:

  • instal.sh - Automated setup that will install the repository locally, install the required modules, compile the modules that cannot be install via RPM, and finally... install RT
  • Modules.tar.gz - Archive containing the 6 modules (CGI, Encode, File::Temp, Sys::Syslog, Test::Simple, MIME::tools) that must be installed manually due to RHEL5 conflicts.
  • rt-3.8.7.tar.gz - The RT system inself. Also available here.
  • rt.repo - The YUM repository file for the local repo that will be installed
  • rt_repo.tar.gz - The archive of the repository itself.

Installation Notes:


You MUST have access to a working BASE repository for your architecture. This repo only contains the modules that DON'T ship with the Redhat distro.

You must setup your MySQL and Apache instances yourself. Depending on your needs, the configuration can vary wildly... therefor it will not be covered here.


Automated Method

chmod o+x install.sh
./install.sh


Manual Method

tar -zxvf rt_repo.tar.gz
mv rt_repo /your/repo/path/here
mv rt.repo /etc/yum.repos.d/
tar -zxvf rt-3.8.7.tar.gz
tar -zxvf Modules.tar.gz

Read through the install.sh file. Use it as a guide to install. The basic sequence is as follows...
  • Create RT user/group
  • Install RT yum repo
  • Install packages required to compile other modules and packages (Devel Requirements)
  • Build & Install the 6 modules that can't be installed via RPM on RHEL5
  • Install the required packages for RT to be built
  • Build & Install RT
Post installation instructions are the same as in previous versions. The existing guide on the RT Wiki is still valid. http://wiki.bestpractical.com/view/Rhel5InstallGuide

Essential Sed one liners

sed (Stream EDitor) refers to a Unix utility for parsing text files and the programming language it uses to apply textual transformations to a sequential stream of data. It reads input files line by line, applying the operation which has been specified via the command line (or a sed script), and then outputs the line. Getting started with sed can be a real pain if you are unfamiliar with perl for regular expressions. Here are a several sed 'one liners' that I use all the time for test file manipulation. More can be found here.







FILE SPACING:



  • Double space a file


  • sed '/^$/d;G'


  • Undo double-spacing (assumes even-numbered lines are always blank)


  • sed 'n;d'






    NUMBERING:



  • Number each line of a file (number on left, right-aligned)


  • sed = filename | sed 'N; s/^/ /; s/ *(.{6,})n/1 /'


  • Number each line of file, but only print numbers if line is not blank


  • sed '/./=' filename | sed '/./N; s/n/ /'


  • Count lines (emulates "wc -l")


  • sed -n '$='






    TEXT CONVERSION AND SUBSTITUTION:



  • Convert DOS newlines (CR/LF) to Unix format.


  • sed 's/.$//'


  • Convert Unix newlines (LF) to DOS format.


  • sed 's/$'"/`echo r`/"


  • Delete leading whitespace (spaces, tabs) from front of each line aligns all text flush left


  • sed 's/^[ t]*//'


  • Delete trailing whitespace (spaces, tabs) from end of each line


  • sed 's/[ t]*$//'


  • Delete BOTH leading and trailing whitespace from each line


  • sed 's/^[ t]*//;s/[ t]*$//'


  • Substitute (find and replace) "foo" with "bar" on each line


  • sed 's/foo/bar/'     # replaces only 1st instance


    sed 's/foo/bar/4'     # replaces only 4th instance


    sed 's/foo/bar/g'     # replaces ALL instances


  • Change "scarlet" or "ruby" or "puce" to "red"


  • sed 's/scarlet/red/g;s/ruby/red/g;s/puce/red/g'






    SELECTIVE PRINTING OF CERTAIN LINES:



  • Print first 10 lines of file (emulates behavior of "head")


  • sed 10q


  • Print first line of file (emulates "head -1")


  • sed q


  • Print the last 10 lines of a file (emulates "tail")


  • sed -e :a -e '$q;N;11,$D;ba'


  • Print the last 2 lines of a file (emulates "tail -2")


  • sed '$!N;$!D'


  • Print the last line of a file (emulates "tail -1")


  • sed -n '$p'


  • Print section of file based on line numbers (lines 8-12, inclusive)


  • sed -n '8,12p'


  • Print only lines which match regular expression (emulates "grep")


  • sed '/regexp/!d'


  • Grep for AAA and BBB and CCC (in any order)


  • sed '/AAA/!d; /BBB/!d; /CCC/!d'


  • Grep for AAA and BBB and CCC (in that order)


  • sed '/AAA.*BBB.*CCC/!d'






    SELECTIVE DELETION OF CERTAIN LINES:



  • Delete duplicate, consecutive lines from a file (emulates "uniq").


  • sed '$!N; /^(.*)n1$/!P; D'


  • Delete duplicate, nonconsecutive lines from a file.


  • sed -n 'G; s/n/&&/; /^([ -~]*n).*n1/d; s/n//; h; P'


  • Delete all lines except duplicate lines (emulates "uniq -d").


  • sed '$!N; s/^(.*)n1$/1/; t; D'


  • Delete the first line of a file


  • sed '1d'


  • Delete the first 10 lines of a file


  • sed '1,10d'


  • Delete the last line of a file


  • sed '$d'


  • Delete the last 2 lines of a file


  • sed 'N;$!P;$!D;$d'


  • Delete the last 10 lines of a file


  • sed -n -e :a -e '1,10!{P;N;D;};N;ba'



  • Delete lines matching pattern


  • sed '/pattern/d'


  • Delete ALL blank lines from a file (same as "grep '.' ")


  • sed '/^$/d'


  • Remove most HTML tags (accommodates multiple-line tags)


  • sed -e :a -e 's/<[^>]*>//g;/


    How to list all installed Perl modules

    I recently found it necessary to list all installed Perl modules on one of my linux servers. I wouldn't have thought that it would be as big a deal as it turned out to be. After two hours or so of testing 20 or so methods Google found for me… I settled on the following.

    From the command line:

    perl -MFile::Find=find -MFile::Spec::Functions -Tlwe 'find { wanted => sub { print canonpath $_ if /.pmz/ }, no_chdir => 1 }, @INC'