Skip to main content

Creating RPM repository


This article explain how to create RPM repository of FreeSwitch modules and of FreeSwitch dependency libs.

Pre Requirements

Before you start you need to make sure that the host on which you are compiling RPM packages have:

  1. operating system RHEL 7, CentOS 7, Fedor 21 or newer;
  2. installed git, curl, rpmbuild and createrepo utilities;
  3. installed "mock" package from operation system repository or from EPEL repository;
  4. about 8Gb free space.

To get information about used operation system execute command "cat /etc/redhat-release". Example below

Checking used operation system

\[root@buildhost \~\]# cat /etc/redhat-release

CentOS Linux release 7.1.1503 (Core)

To install git, curl, rpmbuild and createrepo utilities execute command "yum install git curl rpm-build". Example below

Installing git, curl and rpm-build utilities

\[root@buildhost \~\]# yum -y install git curl rpm-build createrepo

Installing mock utility

Fedora disro contain mock utility in system repo. Some other distro require install mock utility from external repo. On RHEL and CentOS before installing mock utility required install EPEL repo. Example below.

installing EPEL repository on CentOS and RHEL

\[root@buildhost \~\]# curl -O [](

\[root@buildhost \~\]# rpm -Uvh epel-release-7\*.rpm

Mock utility can be installed via executing command "yum install mock python-ctypes". Example below

installing mock utility

\[root@buildhost \~\]# yum -y install mock python-ctypes

Next, you need to create a user under the rights of which RPM packages will be made

Creating build user and affiliation him to mock group

\[root@buildhost \~\]# useradd build \[root@buildhost \~\]# usermod -G mock build

Creating distribution specific config files

For CentOS, RHEL operation system mock config files must be created. For Fedora distros mock config files has been installed with mock utility.

installing mock config file for CentOS

\[root@buildhost \~\]# curl -o /etc/mock/centos-7-x86_64.cfg [](

Creating repo

Creating SRPM packages

First, you must get the scripts that perform repository assembly

Downloading repo creation scripts

\[root@buildhost \~\]# su - build  
Last login: Mon Jun 15 10:11:36 GMT 2015 on pts/0
\[build@buildhost \~\]$ mkdir WORKDIR
\[build@buildhost \~\]$ cd WORKDIR/
\[build@buildhost WORKDIR\]$ echo git clone [](
\[build@buildhost WORKDIR\]$ git clone []([ ]( into 'freeswitch-video-deps'...
remote: Counting objects: 82, done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 82 (delta 29), reused 0 (delta 0)
Unpacking objects: 100% (82/82), done.

Next, you need to prepare SRPM packages via executing "" command. Example below.

Creating SRPM packages

\[build@buildhost WORKDIR\]$ ./freeswitch-video-deps/rpm-systemd/ && ls -1 rpmbuild/\*src.rpm  
Trying clone repo "openh264"
Cloning into 'openh264'...

--- strings has been cutted ---

Compressing "libg7221"  
Creating SRPM of "libg7221"
warning: Could not canonicalize hostname: [](
Wrote: /home/build/WORKDIR/rpmbuild/g722\_1-0.2.0-1.el7.centos.src.rpm

Creating RPM packages

Next, you need to prepare RPM packages via executing " " command with appropriate distro config file as argument. Example below.

Creating RPM packages

\[build@buildhost WORKDIR\]$ ./freeswitch-video-deps/rpm-systemd/ centos-7-x86\_64  
\[build@buildhost WORKDIR\]$ ./WORKDIR/freeswitch-video-deps/rpm-systemd/
INFO: version 1.2.7 starting (python version = 2.7.5)...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run

**\--- strings has been cutted ---**

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

Resulted RPM packages will be located at "~/WORKDIR/MOCKED" subfolders.


Install EPEL and additional repositories on CentOS and Red Hat

Using Mock to test package builds

Mocking RPMs on CentOS




centos-7-x86_64.cfg (application/octet-stream)
centos-7-x86_64.cfg (application/octet-stream)
centos-7-x86_64.cfg (application/octet-stream)
centos-7-x86_64.cfg (application/octet-stream)
centos-7-x86_64.cfg (application/octet-stream)