Creating RPMs for Distributing PHP or other Source Code

Distributing PHP code with RPM’s

# cd /usr/src/redhat/SPECS/
# vi your_app-1-1.spec
Summary: PHP code for blah blah
Name: your_app
Version: 1
Release: 1
Group: Applications/Internet
License: commercial
Source: your_app-1-1.tar.gz
BuildRoot: /var/tmp/%{name}-buildroot

%description
Some
Description
Here

%prep
%setup -q

%build

%install
cp -rvf $RPM_BUILD_DIR/your_app-1 $RPM_BUILD_ROOT

%clean
if( [ $RPM_BUILD_ROOT != "/" ] ); then rm -rf $RPM_BUILD_ROOT; fi;

%files
/.


# cd /usr/src/redhat/SOURCES/
# mkdir -p your_app-1/var/www/your_app/
# cp -rvf /var/www/your_app your_app-1/var/www/your_app/
# tar -cf your_app-1-1.tar your_app-1
# gzip your_app.tar
# rpmbuild -ba /usr/src/redhat/SPECS/your_app-1-1.spec
# ls /usr/src/redhat/RPMS/i386/
your_app-1-1.rpm
# rpm -i usr/src/redhat/RPMS/i386/your_app-1-1.rpm
(should install your source code into /var/www/your_app)
# rpm -e your_app-1
(should remove your code from /var/www/your_app)

woot!

 

Leave a Reply

Your email address will not be published. Required fields are marked *