Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-24-2003, 06:34 PM   #1
Registered: May 2003
Posts: 44

Rep: Reputation: 15
making an RPM package ??

hello everybody,

i wanna make a small aoftware package using linux redhat 9, but it is failing and failing with errors i solved all of them i think now but it still making errors i don't know why ?!

do anyone did it before who can tell me trusted steps or a hyperlink to a trusted tutorial to do it

and here is the steps i did exactly, tell me what is wrong plzz
files in hello-1.0 directory
# <include stdio.h>
printf("Hello, World!\n");
all: hello

hello: hello.c
gcc -o hello hello.c
rm -f hello

install: hello
cp hello /usr/bin

(c) Copyright ........

Then, i went back to /root directory and made a tar file of all these files, and gzip it
# cd /root
# mkdir hello-1.0
# cd hello-1.0
# vi hello.c
# vi Makefile
# cd ..
# tar -zcvf hello-1.0.tar.gz hello-1.0/

Copy the hello-1.0.tar.gz to /usr/src/redhat/SOURCES
# cp hello-1.0.tar.gz /usr/src/redhat/SOURCES

Create the /usr/src/redhat/SPECS/hello.spec file
# vi /usr/src/redhat/SPECS/hello.spec
and here is the specs file
Summary: Hello, World program
Name: hello
Version: 1.0
Release: 1
Copyright: GPL
Group: Applications/Useless
Source: hello-1.0.tar.gz
Distribution: Useless Linux 1.0
Vendor: eee
Packager: rrrr
This program prints the text "Hello, World!"
rm -fr $RPM_BUILD_DIR/hello-1.0
tar -zxvf $RPM_SOURCE_DIR/hello-1.0.tar.gz
cd $RPM_BUILD_DIR/hello-1.0
cd $RPM_BUILD_DIR/hello-1.0
make install
%doc $RPM_BUILD_DIR/hello-1.0/README
Start the RPM prep stage .
# rpm -bp /usr/src/redhat/SPECS/hello.spec
# ls -lR /usr/src/redhat/BUILD

Start the RPM build stage .
# rpm -bc /usr/src/redhat/SPECS/hello.spec
# ls -lR /usr/src/redhat/BUILD

Start the RPM install stage .
# rpm -bi /usr/src/redhat/SPECS/hello.spec
# ls -lR /usr/src/redhat/BUILD
# ls -l /usr/bin/hello
# ls -l /usr/share/doc/hello-1.0
# hello

Create the binary RPM .
# rpm -bb /usr/src/redhat/SPECS/hello.spec
# ls -l /usr/src/redhat/RPMS/i386
# rpm -qilp /usr/src/redhat/RPMS/i386/hello-1.0-1.i386.rpm

Create the source RPM .
# rpm -ba /usr/src/redhat/SPECS/hello.spec
# ls -l /usr/src/redhat/SRPMS
# rpm -qilp /usr/src/redhat/SRPMS/hello-1.0-1.src.rpm
i tried to substitute $RPM_BUILD_DIR/ with the real directory, but also it failed

also i used rpmbuild instead of rpm as i am using redhat 9


Last edited by rinux; 09-24-2003 at 06:56 PM.
Old 09-24-2003, 08:11 PM   #2
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548Reputation: 3548

%define maj 1
%define min 0
%define rel 1

Summary: Print hello world
Name: hello
Version: %{maj}.%{min}
Release: %{rel}
License: GPL
Group: Applications/Base
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}
Provides: %{name}
Packager: name <>
Prefix: /usr/bin

This program prints the text "Hello, World!"

%setup -q


install -m 755 hello ${RPM_BUILD_ROOT}/usr/bin

rm -rf ${RPM_BUILD_ROOT}

# %post # Nothing necessary here
# %preun # Nothing necessary here
# %postun # Nothing necessary here

%attr(755,root,root) /usr/bin/hello

* Mon Dec 31 2007 name <> patchlevel
- Made spec file

Run "rpm -ba specfilename 2>&1|tee specfilename.log".
If any errors, they'll be in the log ready to post.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
tutorial custom package making? Potatopopper Slackware 4 11-19-2005 05:07 PM
Making a Slackware package.... ivoencarnacao Slackware 5 02-25-2005 08:21 AM
problem making slackware package busbarn Programming 3 07-21-2004 09:12 PM
can reinstall the rpm package without delete the rpm package eye Red Hat 1 10-20-2003 08:53 AM
Howto on making .deb package files preben Debian 1 08-21-2003 08:53 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:00 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration