• feedburner RSS feed
  • About
  • lifestream
  • Site Tech
  • Creating custom RPMs is simple with EPM

    The RedHat RPM format is a handy way to distribute software to RPM-based systems. The RPM format is quite feature rich and hence it can be quite complicated to create your own RPMs at times. Editing SPEC files, creating a cogent build tree, dependency hell.. these things can be frustrating. However, if you want the shortcut to creating your own RPMs (as well as quite a few other package formats), then use ESP Package Manager. I’ll give you the quick 2 minute overview on getting started…

    1: Get a build system (you’ll need one for each architecture (intel i686, AMD64) and OS version you want to create binary packages for.
    2: Download ESP from http://www.easysw.com/epm/
    3: Install ESP onto your build system(s). If you are creating RPMs, then you dont need ESP installed on the systems you’ll be installing your RPM pkgs on.
    ./configure; make; make install

    4: Create a Build and Source Tree on your BS (Build System)
    Source Tree: mkdir /packages/build/source
    Binary Tree: mkdir /packages/apps

    5: Build and install the software you want to package onto the BS

    6: Making an Apache Binary Tree (My Example)

    Download Source: wget http://mirror.olnevhost.net/pub/apache/httpd/httpd-2.2.4.tar.gz
    Build tree (and required options): ./configure \--prefix=/packages/apps/apache/2.2.4-v1 \--enable-ssl \--enable-deflate (etc etc)
    Build and Install: make; make install
    Edit /packages/apps/apache/2.2.4-v1 config files to your own requirements.

    7. Creating an RPM of your Binary Tree is now done with ESP tools mkepmlist and epm

    8: Create an epmlist file of all the files in the tree you just installed

    cd /packages/apps/apache/2.2.4-v1
    mkepmlist \--prefix /packages/apps/apache/2.2.4-v1 . &> /packages/apps/apache/2.2.4-v1/epm.list

    9: Edit and add details to the epm.list file you just created above

    Add package details similar to this to the very top of the epm.list file
    Make sure the license and README files exist in the binary tree, add them if they don’t, then regenerate the epm.list as above file any time you add or change files in the binary tree:


    %product My Apache Package
    %copyright 1999-2006 by Apache Software Foundation
    %vendor Me
    %license /packages/apps/apache/2.2.4-v1/license/LICENSE
    %readme /packages/apps/apache/2.2.4-v1/license/README
    %description My Binary Apache Distro for fc5 Linux Intel
    %version 2.2.4-1 400

    Add a post-install script to the very end of the epmlist file
    This is an optional step. But make sure the script file exists in the binary tree if you use a post-install script. If not add it, then regen your epm.list file again

    %postinstall 
    

    My post-install.sh file does some dependency installation, directory creation and user/group adding

    #!/bin/bash
    # things to do before installing this package
    yum install openssl openssl-devel zlib zlib-devel
    if grep apache /etc/group
    then
    echo "yes: Group"
    else
    echo "Adding Group"
    useradd -s /bin/false -u 5048 -g apache apache
    fi
    echo "Checking for Apache User"
    if grep apache /etc/passwd
    then
    echo "yes: User"
    else
    echo "Adding Apache User"
    useradd -s /bin/false -u 5048 -g apache apache
    fi
    echo "Creating Directories if needed"
    if [ ! -d /var/www/html ]
    then
    echo “*** NO html dir”
    mkdir -p /var/www/html
    chown -R apache:apache /var/www/html
    fi
    if [ ! -d /var/www/cgi-bin ]
    then
    echo “*** NO cgi-bin dir”
    mkdir -p /var/www/cgi-bin
    chown -R apache:apache /var/www/cgi-bin
    fi
    echo “Creating Symlink”
    ln -s /packages/apps/apache/2.2.4-v1 /packages/apps/apache/current
    echo “Installing init script”
    if [ -f /etc/init.d/httpd ]
    then
    echo “*** Previous init script exists”
    mv /etc/init.d/httpd /etc/init.d/httpd.pre
    fi
    ln -s /packages/apps/apache/2.2.4-v1/etc/init.d/httpd /etc/init.d/httpd

    h4. Build RPM package using EPM

    epm -f rpm my-apache epm.list

    You should now have a binary .rpm file in a new sub directory linux-architecture/package-name-version-arch.rpm

    You can install that RPM anywhere with the same OS and Arch as the build system now.

    EPM is a very well designed software package manager. You can read more here: http://www.easysw.com/epm/epm-book.html

    By: warwick, on: Jun 5, 2007
    Tagged with: linux, packages, rpm, software

    Post a Comment


    Tag Cirrostratus

    amazon apple automattic browsers cache color conference craigslist ec2 ex720 fuel funny images iphone linux LIRR mac macbook pro mysql nginx nventory NY nyc osx packages photographs politics proxy rails rant rpm s3 silly software south africa squid startups stubhub svn travel web 2.0 wordpress wp-themes youtube zimbabwe

    Twitter: warwickp

    • WordPress.com is a few mili seconds away from 2.7... 6 hrs ago
    • WordPress 2.7 is creeping closer and closer.... 6 hrs ago
    • Not that I used Pownce, or care that much, but it would seem the right thing to do would be to open source Pownce and let it live on. 2 days ago
    • Michael Clayton is my favorite movie of the last 5 years. 4 days ago
    • More updates...

    Powered by Twitter Tools.

    A blog by Warwick Poole
    Powered by:
    WordPress and more.