RTPEngine RPM creation from the Tar file or source code.
RPM creation from SPEC file and tar file :
To create any RPM we need the source code of the project. In my case I am trying to create the RPM for the RTPEngine, So I am using RTPEngine source code tar file.
To build the RPMs you need following packages, Go go ahead and install those packages.
1 2 |
redhat-rpm-config rpm-build |
Installing the rpm-build :
1 |
yum install rpm-build |
Once you installed packages, you are ready to install the RPM. the rpm-build package creates one folder called rpmbuild in /root/ directory.
rpm-build will automatically create the following directory structures that will be used during the RPM build.
1 2 3 4 5 6 7 |
# ls -l /root/rpmbuild/ drwxr-xr-x. 2 root root 4096 Oct 5 12:21 BUILD/ drwxr-xr-x. 2 root root 4096 Oct 5 12:21 BUILDROOT/ drwxr-xr-x. 2 root root 4096 Oct 5 12:21 RPMS/ drwxr-xr-x. 2 root root 4096 Oct 5 12:21 SOURCES/ drwxr-xr-x. 2 root root 4096 Oct 5 12:21 SPECS/ drwxr-xr-x. 2 root root 4096 Oct 5 12:21 SRPMS/ |
Download the RTPEngine tar file :
You can clone the rtpengine GitHub repo and create the tar file or simply follow the following URL it will download the RTPEngine 4.5 version tar file.
once you downloaded the tar file, Move it into the /root/rpmbuild/SOURCES/ folder.
Creating The SPEC file:
You can use SPEC file for the RTPEngine in the Tar file or you can write your own SPEC file. Here is my SPEC file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
Name: rtpengine Version: mr4.5.1.1 Release: 0%{?dist} Summary: The Sipwise NGCP rtpengine Group: System Environment/Daemons License: GPLv3 URL: https://github.com/sipwise/rtpengine Source0: https://github.com/sipwise/rtpengine/archive/%{version}.tar.gz Conflicts: %{name}-kernel < %{version}-%{release} BuildRequires: gcc make pkgconfig redhat-rpm-config BuildRequires: glib2-devel libcurl-devel openssl-devel pcre-devel BuildRequires: xmlrpc-c-devel zlib-devel hiredis-devel Requires: nc # Remain compat with other installations Provides: ngcp-rtpengine = %{version}-%{release} %description The Sipwise NGCP rtpengine is a proxy for RTP traffic and other UDP based media traffic. It's meant to be used with the Kamailio SIP proxy and forms a drop-in replacement for any of the other available RTP and media proxies. %package kernel Summary: NGCP rtpengine in-kernel packet forwarding Group: System Environment/Daemons BuildRequires: gcc make redhat-rpm-config iptables-devel Requires: iptables iptables-ipv6 Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}-dkms = %{version}-%{release} %description kernel %{summary}. %package dkms Summary: Kernel module for NGCP rtpengine in-kernel packet forwarding Group: System Environment/Daemons BuildArch: noarch BuildRequires: redhat-rpm-config Requires: gcc make Requires(post): epel-release dkms Requires(preun): epel-release dkms %description dkms %{summary}. %prep %setup -q %build cd daemon RTPENGINE_VERSION=""%{version}-%{release}"" make cd ../iptables-extension RTPENGINE_VERSION=""%{version}-%{release}"" make cd .. %install # Install the userspace daemon install -D -p -m755 daemon/%{name} %{buildroot}%{_sbindir}/%{name} # Install CLI (command line interface) install -D -p -m755 utils/%{name}-ctl %{buildroot}%{_sbindir}/%{name}-ctl ## Install the init.d script and configuration file install -D -p -m755 el/%{name}.init %{buildroot}%{_initrddir}/%{name} install -D -p -m644 el/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name} mkdir -p %{buildroot}%{_sharedstatedir}/%{name} # Install the iptables plugin install -D -p -m755 iptables-extension/libxt_RTPENGINE.so %{buildroot}/%{_lib}/xtables/libxt_RTPENGINE.so ## DKMS module source install install -D -p -m644 kernel-module/Makefile %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/Makefile install -D -p -m644 kernel-module/xt_RTPENGINE.c %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/xt_RTPENGINE.c install -D -p -m644 kernel-module/xt_RTPENGINE.h %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/xt_RTPENGINE.h mkdir -p %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release} install -D -p -m644 kernel-module/rtpengine_config.h %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/rtpengine_config.h sed -i -e "s/__VERSION__/%{version}-%{release}/g;s/ngcp-rtpengine/rtpengine/g" debian/dkms.conf.in install -D -p -m644 debian/dkms.conf.in %{buildroot}%{_usrsrc}/%{name}-%{version}-%{release}/dkms.conf # For RHEL 7, load the compiled kernel module on boot. %if 0%{?rhel} == 7 install -D -p -m644 kernel-module/xt_RTPENGINE.modules.load.d %{buildroot}%{_sysconfdir}/modules-load.d/xt_RTPENGINE.conf %endif %pre getent group %{name} >/dev/null || /usr/sbin/groupadd -r %{name} getent passwd %{name} >/dev/null || /usr/sbin/useradd -r -g %{name} -s /sbin/nologin -c "%{name} daemon" -d %{_sharedstatedir}/%{name} %{name} %post if [ $1 -eq 1 ]; then /sbin/chkconfig --add %{name} || : fi %post dkms # Add to DKMS registry, build, and install module dkms add -m %{name} -v %{version}-%{release} --rpm_safe_upgrade && dkms build -m %{name} -v %{version}-%{release} --rpm_safe_upgrade && dkms install -m %{name} -v %{version}-%{release} --rpm_safe_upgrade --force true %preun if [ $1 = 0 ] ; then /sbin/service %{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} fi %preun dkms # Remove from DKMS registry dkms remove -m %{name} -v %{version}-%{release} --rpm_safe_upgrade --all true %files # Userspace daemon %{_sbindir}/%{name} # CLI (command line interface) %{_sbindir}/%{name}-ctl # init.d script and configuration file %{_initrddir}/%{name} %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %attr(0750,%{name},%{name}) %dir %{_sharedstatedir}/%{name} # Documentation %doc LICENSE README.md el/README.el.md debian/changelog debian/copyright %files kernel /%{_lib}/xtables/libxt_RTPENGINE.so %files dkms %{_usrsrc}/%{name}-%{version}-%{release}/ %if 0%{?rhel} == 7 %{_sysconfdir}/modules-load.d/xt_RTPENGINE.conf %endif %changelog * Mon Nov 11 2013 Peter Dunkley <peter.dunkley@crocodilertc.net> - Updated version to 2.3.2 - Set license to GPLv3 * Thu Aug 15 2013 Peter Dunkley <peter.dunkley@crocodilertc.net> - init.d scripts and configuration file * Wed Aug 14 2013 Peter Dunkley <peter.dunkley@crocodilertc.net> - First version of .spec file - Builds and installs userspace daemon (but no init.d scripts etc yet) - Builds and installs the iptables plugin - DKMS package for the kernel module |
Building the RPM from the SPEC-File :
1 |
rpmbuild -ba rtpengine.spec |
You can also build RPM for the Tarball here is the command to use
1 |
rpmbuild -ta ./rpmbuild/SOURCES/rtpengine-4.5.0.tar.gz |
Once the RPM’s are created, Those RPM’s will be saved in the /root/rpmbuild/RPMS/ folder. This folder contains architecture folder, So search for appropriate architecture.
Installing the RTPEngine RPM’s :
Once you built the RPM’s you can install those RPM’s using RPM command like below
To install the rtpengine daemon use the following command.
1 |
rpm -ivh rtpengine-mr4.5.1.1-0.el7.centos.x86_64.rpm |
RTPEngine kernel module depends on the DKMS module so first install the DKMS module then install the kernel forwarding module like below.
1 2 |
rpm -ivh rtpengine-dkms-mr4.5.1.1-0.el7.centos.noarch.rpm rpm -ivh rtpengine-kernel-mr4.5.1.1-0.el7.centos.x86_64.rpm |
Note :
You can also install those RPM’s using yum localinstall command. As it will resolve all the dependencies automatically.
1 2 3 |
yum localinstall rtpengine-mr4.5.1.1-0.el7.centos.x86_64.rpm yum localinstall rtpengine-dkms-mr4.5.1.1-0.el7.centos.noarch.rpm yum localinstall rtpengine-kernel-mr4.5.1.1-0.el7.centos.x86_64.rpm |
That’s it. You successfully build the RTPEngine RPM’s from SPEC file.