How would I specify in the spec file where to install the RPM to?

Kyle Crumpton (kcrumpto) kcrumpto at
Wed Mar 26 16:10:00 UTC 2014

Hi Fabricio.

These are two concepts I wasn't familiar with.

When I went to /usr/lib/rpm/macros I noticed that it had

%_prefix 		/usr

I changed this to /opt and saw no change in where it was installed too..
it still installs to /BUILD.
The build root is set to
232:%_buildrootdir		%{_topdir}/BUILDROOT
235:%buildroot		%{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}

And when I look at _topdir it points to %{getenv:HOME}/rpmbuild..


On 3/25/14 5:11 PM, "Fabricio Cannini" <fcannini at> wrote:

>Em 25-03-2014 19:01, Kyle Crumpton (kcrumpto) escreveu:
>> Hi all. I am very new to RPM building and chose Cassandra as the service
>> for my first rpm. I'm just curious about one thing. How  would I specify
>> in the .spec file to install the rpm to /opt instead of /BUILD which
>> seems to be the default/where Cassandra installs with my first rpm I
>Hi Kyle
>'%_prefix' is the macro that says where in the filesystem your package
>will be installed. It is the initial directory of your package, and it
>must an absolute path.
>'%buildroot' is the macro that says where, inside '%_topdir', the
>directory structure of your package will be created.
>( thinking about %buildroot as a kind of chroot may help )
>I'm guessing that you are confused about these two concepts. Am I right ?
>Rpm-list mailing list
>Rpm-list at

More information about the Rpm-list mailing list