WTF, I wasted all my morning doing it…..
Environment: CentOS 6.6 x64 minimal server
- install wget
yum install wget
- create rpmbuild/SOURCES and rpmbuild/SPECS folder under your home directory
mkdir -p /root/rpmbuild/SOURCES
- 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
- 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
- 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
- copy the required files
cp freeradius-server-2.2.6/redhat/freeradius-* .
cp freeradius-server-2.2.6/redhat/freeradius.spec ../SPECS/
- start to build RPM files
rpmbuild -bb ../SPECS/freeradius.spec
- 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