Simple RPM builds - command sequence
You can use following simple command sequence run by root to build your RPM package from spec file on your system:
# yum install rpmdevtools yum-utils # su - <user> $ rpmdev-setuptree $ mc # now copy package's files where necessary $ cd ~/rpmbuild/SPECS $ rpmbuild -bs package.spec $ cd ~/rpmbuild/SRPMS $ yum-builddep package.srpm $ cd - && rpmbuild -ba package.spec # now your rpms are in ../RPMS
Simple RPM builds - commands' description
Now let's take a look at the thing above, one command at a time.
# yum install rpmdevtools yum-utils
This will install two packages which are necessary for the following work. rpmdevtools contains rpmdev-setuptree script and yum-utils contains yum-builddep.
This will create a directory tree necessary to build packages in your home directory. For more details on the tree structure, please see How_to_create_an_RPM_package.
$ mc # now copy package's files where necessary
The important thing to know is that you should copy your spec file into
SPECS and all other source files into
$ cd ~/rpmbuild/SPECS $ rpmbuild -bs package.spec
This will create srpm package. That is necessary for the next step. If you are sure all build dependencies of the package are installed, you can skip these two steps.
$ cd ~/rpmbuild/SRPMS $ yum-builddep package.srpm
This will try to download and install all built-time dependencies of desired package. Unfortunatelly rpmbuild can't do that on its own.
$ cd - $ rpmbuild -bb package.spec
This will build your rpm package. If any errors occur, you will see them on terminal. Otherwise look for your packages in