There are some documents teaching me on how to build rpm by myself in centos with rpm-build or mock. I am fine to build them for el6 rpm package.

My question is, can I build a rpm package for centos 7 (el7) on a centos 6 server?

The reason is, my company's build server (a bamboo server) is a centos 6 server currently.


Yes and no:

  • Yes, you can do that with Mock. You just run mock -r epel-7-x86_64 yourpackage.src.rpm and it will build package for RHEL/CentOS 7 no matter what is your current host.

  • No, you cannot do that with rpmbuild as that builds packages for your current platform.

  • the second point is not really true: if you set up manually a chroot env with all necessary files from el7, then you could build el7 package for el7 system. However this is exactly what mock does. – Serge May 30 '16 at 16:53
  • Thanks all. I got the point. Mock is the right tool to do the job smoothly with current environment. – Bill May 31 '16 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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