Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

please advice why I get the error "error: License field must be present in package: (main package)"

I need to create rpm file ,

I only have the spec file under SPECS

and the script under SOURCES

what’s wrong here?

 [root@linux /usr/src/redhat]# ls


the spec file:

Summary: An example tool. To show a simple rpm build of the tool.
Version: 6.2
Release: 2
Group: Development/Debuggers

 #  rpm -ba my_spec.spec
 error: License field must be present in package: (main package)
 # ls ../SOURCES/
share|improve this question
By the looks of it I've solved your initial question. However as you've found, you've run into a new problem. I'm afraid writing spec files is a lot more complicated than the example you've provided, but perfectly doable. I've yet to find a decent example of packaging a simple bash script but something like this fedora guide is better than nothing. Just strip out the build commands & requirements. – PriceChild Apr 12 '11 at 15:24
but I have linux red-hat not fedora , second can you please give the correct spec file? – yael Apr 12 '11 at 15:26
Both RHEL and Fedora use the same rpm technology and the tutorial is valid. (That doesn't mean you can install fedora rpms in redhat or vica verca!) This forum thread here (see post 3) is an example of packaging a bash script but I haven't tried or checked it myself. – PriceChild Apr 13 '11 at 8:26
up vote 2 down vote accepted

Wild shot in the dark... have you tried adding something like:

License: OtherLicense

before %description?

share|improve this answer
OK I add this but now I get: error: Bad file: /root/rpmbuild/SOURCES/ No such file or directory RPM build errors: Bad file: /root/rpmbuild/SOURCES/ No such file or directory – yael Apr 12 '11 at 15:19
Awesome, looks like that's solved the problem you're asking about originally, going to add a further comment to your question. – PriceChild Apr 12 '11 at 15:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.