[FreeRADIUS] Build RPM files in CentOS 6.X

WTF, I wasted all my morning doing it…..

Environment: CentOS 6.6 x64 minimal server

  1. install wget
yum install wget
  1. create rpmbuild/SOURCES and rpmbuild/SPECS folder under your home directory
mkdir -p /root/rpmbuild/SOURCES
  1. get into this folder and download the source file from freeradius.org
cd /root/rpmbuild/SOURCES
wget ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-2.2.6.tar.gz
  1. extract this compressed file and edit the source what you want, i want to edit the “MAX_SQL_SOCKS” limit. then you can delete the original compressed file
tar zxvf freeradius-server-2.2.6.tar.gz
vim freeradius-server-2.2.6/src/modules/rlm_sql/conf.h
// original
// #define MAX_SQL_SOCKS                   256
// edited
#define MAX_SQL_SOCKS                   2048
del zxvf freeradius-server-2.2.6.tar.gz
  1. use tar to compress this folder and then bzip2 it
tar cf freeradius-server-2.2.6.tar freeradius-server-2.2.6
bzip2 freeradius-server-2.2.6.tar
  1. copy the required files
cp freeradius-server-2.2.6/redhat/freeradius-* .
cp freeradius-server-2.2.6/redhat/freeradius.spec ../SPECS/
  1. start to build RPM files
rpmbuild -bb ../SPECS/freeradius.spec
  1. then the RPM files will be here
Wrote: /root/rpmbuild/RPMS/x86_64/freeradius-2.2.6-1.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/freeradius-utils-2.2.6-1.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/freeradius-ldap-2.2.6-1.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/freeradius-krb5-2.2.6-1.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/freeradius-perl-2.2.6-1.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/freeradius-python-2.2.6-1.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/freeradius-mysql-2.2.6-1.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/freeradius-postgresql-2.2.6-1.el6.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/freeradius-unixODBC-2.2.6-1.el6.x86_64.rpm

note: the default path in CentOS 5.x is /usr/src/redhat

This entry was posted in Radius. Bookmark the permalink.