1.. _packaging-redhat:
2
3Packaging Red Hat
4=================
5
6Tested on CentOS 6, CentOS 7, CentOS 8 and Fedora 24.
7
81. On CentOS 6, refer to :ref:`building-centos6` for details on installing
9   sufficiently up-to-date package versions to enable building FRR.
10
11   Newer automake/autoconf/bison is only needed to build the RPM and is **not**
12   needed to install the binary RPM package.
13
142. Install the build dependencies for your platform. Refer to the
15   platform-specific build documentation on how to do this.
16
173. Install the following additional packages::
18
19      yum install rpm-build net-snmp-devel pam-devel libcap-devel
20
21   If your platform uses systemd::
22
23      yum install systemd-devel
24
25   For CentOS 7 and CentOS 8, the package will be built using python3
26   and requires additional python3 packages::
27
28       yum install python3-devel python3-sphinx
29
30   .. note::
31
32     For CentOS 8 you need to install ``platform-python-devel`` package
33     to provide ``/usr/bin/pathfix.py``::
34
35       yum install platform-python-devel
36
37
38   If ``yum`` is not present on your system, use ``dnf`` instead.
39
40   You should enable ``PowerTools`` repo if using CentOS 8 which
41   is disabled by default.
42
434. Add librtr-devel. Install librtr-devel from rpm.frrouting.org
44   repository (See https://rpm.frrouting.org to add repository
45   if it's not yet added)
46
47      yum install librtr-devel
48
495. Checkout FRR::
50
51      git clone https://github.com/frrouting/frr.git frr
52
536. Run Bootstrap and make distribution tar.gz::
54
55      cd frr
56      ./bootstrap.sh
57      ./configure --with-pkg-extra-version=-MyRPMVersion
58      make dist
59
60   .. note::
61
62      The only ``configure`` option respected when building RPMs is
63      ``--with-pkg-extra-version``.
64
657. Create RPM directory structure and populate with sources::
66
67     mkdir rpmbuild
68     mkdir rpmbuild/SOURCES
69     mkdir rpmbuild/SPECS
70     cp redhat/*.spec rpmbuild/SPECS/
71     cp frr*.tar.gz rpmbuild/SOURCES/
72
738. Edit :file:`rpm/SPECS/frr.spec` with configuration as needed.
74
75   Look at the beginning of the file and adjust the following parameters to
76   enable or disable features as required::
77
78      ############### FRRouting (FRR) configure options #################
79      # with-feature options
80      %{!?with_pam:           %global  with_pam           0 }
81      %{!?with_ospfclient:    %global  with_ospfclient    1 }
82      %{!?with_ospfapi:       %global  with_ospfapi       1 }
83      %{!?with_irdp:          %global  with_irdp          1 }
84      %{!?with_rtadv:         %global  with_rtadv         1 }
85      %{!?with_ldpd:          %global  with_ldpd          1 }
86      %{!?with_nhrpd:         %global  with_nhrpd         1 }
87      %{!?with_eigrp:         %global  with_eigrpd        1 }
88      %{!?with_shared:        %global  with_shared        1 }
89      %{!?with_multipath:     %global  with_multipath     256 }
90      %{!?frr_user:           %global  frr_user           frr }
91      %{!?vty_group:          %global  vty_group          frrvty }
92      %{!?with_fpm:           %global  with_fpm           0 }
93      %{!?with_watchfrr:      %global  with_watchfrr      1 }
94      %{!?with_bgp_vnc:       %global  with_bgp_vnc       0 }
95      %{!?with_pimd:          %global  with_pimd          1 }
96      %{!?with_rpki:          %global  with_rpki          0 }
97
989. Build the RPM::
99
100      rpmbuild --define "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/frr.spec
101
102   If building with RPKI, then download and install the additional RPKI
103   packages from
104   https://ci1.netdef.org/browse/RPKI-RTRLIB/latestSuccessful/artifact
105
106If all works correctly, then you should end up with the RPMs under
107:file:`rpmbuild/RPMS` and the source RPM under :file:`rpmbuild/SRPMS`.
108