Tuesday, January 8, 2013

Build RPM - Deploy files using RPM command

1. Deploy files inside tar package  /usr/src/redhat/SOURCES/appdynamics-3.5.8.tar.gz

2. Create  appdynamics.spec file

#===============================================================================

# No debuginfo:
%define debug_package %{nil}


%define name      appdynamics
%define summary   AppDynamics is client agent of AppDynamic Server.
%define version   3.5.8
%define release   Base
%define license   GPL
%define group     Applications/System
%define source    %{name}-%{version}.tar.gz
%define url       http://www.outcome.com
%define vendor    AppDynamic
%define packager  Satish Patel
%define buildroot %{_tmppath}/%{name}-root
%define _prefix   /opt

Name:      %{name}
Summary:   %{summary}
Version:   %{version}
Release:   %{release}
License:   %{license}
Group:     %{group}
Source0:   %{source}
BuildArch: x86_64
Provides:  %{name}
URL:       %{url}
Buildroot: %{buildroot}

%description
AppDynamics is client agent of AppDynamic Server.

%prep
%setup -q

%build

%install
install -d %{buildroot}%{_prefix}/appdynamics

tar cf - . | (cd %{buildroot}%{_prefix}/appdynamics; tar xfp -)

%post
echo " "
echo "-------------------------------------------------"
echo "- %{name} installed in %{_prefix}"
echo "- Add /opt/%{name}/jsvc in tomcat startup script."
echo "-------------------------------------------------"

%clean
rm -rf %{buildroot}

%files
%defattr(-,tomcat5,tomcat5)
%{_prefix}/appdynamics/*
# Add cron entries

%changelog
* Mon Jan 08 2013 Satish Patel
- First rpmbuild version 3.5.8


3. Build rpm using rpmbuild command.

 sudo rpmbuild -bb appdynamics-3.5.8.spec
 4. If all goes well you can find created RPM inside.

 /usr/src/redhat/RPMS/x86_64/appdynamics-3.5.8-Base.x86_64.rpm

No comments:

Post a Comment