Lesson 9

Dates: 6/13/2018
Building Linux packages
Linux System Administration

Exercise: build RPM package

  • Start a CentOS based VM, centmaster, and login to the console of centmaster
    virsh start centmaster
    virsh console centmaster

  • Install the RPM development tools on centmaster
    yum install gcc
    yum install rpm-build

  • Create the conventional directory tree for rpmbuild
    mkdir rpmbuild

  • Download the source tar ball into directory SOURCES and rename the source root directory to satisfy rpmbuild convention:
    cd SOURCES
    wget http://linuxcourse.rutgers.edu/lessons/application_compilation/downloads/Project.tgz
    tar -zxvf Project.tgz
    mv Project appx-1.0
    tar -zcvf appx-1.0.tgz appx-1.0
    rm -rf appx-1.0 Project.tgz

  • Create spec file, appx.spec in directory SPECS. Take the content from the previous page.

  • Build the package:
    cd /home/hostadm/rpmbuild
    rpmbuild -v -bb --clean SPECS/appx.spec

  • Check for the rpm package file, appx-1.0-0.x86_64.rpm in directory RPMS/x86_64:

  • Install the RPM package:
    sudo rpm -ivh appx-1.0-0.x86_64.rpm
    Verify that the package is installed on the system and the package files have been placed into the right locations:
    rpm -qa | grep appx
    ls /usr/local/bin
    ls /usr/local/lib
    ls /usr/local/include

  • Uninstall the package and make sure the package files are gone:
    sudo rpm -e appx
    ls /usr/local/bin
    ls /usr/local/lib
    ls /usr/local/include

  • Take me to the Course Website