I am building rpm for opensips and i want to install this package in /opt/opensips path instead of default system path

I have define following in my SPEC file

    %define _prefix /opt/opensips
    %define _sysconfdir /opt/opensips/etc
    %define _libdir /opt/opensips/lib64
    %define _datadir /opt/opensips/share
    %define _sbindir /opt/opensips/sbin
    %define _bindir /opt/opensips/bin
    %define _mandir /opt/opensips/share/man

    LOCALBASE=/usr NICER=0 CFLAGS="%{optflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \
      exclude_modules="%EXCLUDE_MODULES" \
      cfg-target=%{_sysconfdir}/opensips/ \
      modules-prefix=%{buildroot}%{_prefix} \

    rm -rf $RPM_BUILD_ROOT
    %{__make} install TLS=1 LIBDIR=%{_lib} \
      exclude_modules="%EXCLUDE_MODULES" \
      basedir=%{buildroot} prefix=%{_prefix} sysconfdir=%{buildroot}/opt/opensips/etc \
      cfg-prefix=%{buildroot} \
      modules-prefix=%{buildroot}/%{_prefix} \
      modules-dir=%{_lib}/%{name}/modules \
      DBTEXTON=yes # fixed dbtext documentation installation

I am getting following error when i build RPM

rpmbuild -ba opensips.spec


RPM build errors:
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/rc.d/init.d/opensips
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/opensips/dictionary.opensips
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/sysconfig/opensips
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/opensips/opensips.cfg
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/opensips/opensipsctlrc
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/opensips/osipsconsolerc

If i check my BUILDROOT i can see it put all those file in /etc at default location

ls -l /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/etc/opensips/

How do i tell RPM put those files in /opt/opensips/etc/ directories?

1 Answer 1


Move the files from /etc/opensips to /opt/opensips them after the "make install" command.

  • Manually moving system files is rarely a good idea. In fact, assuming there is a package manager at all, manually messing around in the system is virtually never a good idea.
    – HalosGhost
    Jan 5, 2015 at 16:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .