WTF, I wasted all my morning doing it…..
Environment: CentOS 6.6 x64 minimal server
- install wget
1 |
yum install wget |
- create rpmbuild/SOURCES and rpmbuild/SPECS folder under your home directory
1 |
mkdir -p /root/rpmbuild/SOURCES |
- get into this folder and download the source file from freeradius.org
1 2 |
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
1 2 3 4 5 6 7 |
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
1 2 |
tar cf freeradius-server-2.2.6.tar freeradius-server-2.2.6 bzip2 freeradius-server-2.2.6.tar |
- copy the required files
1 2 |
cp freeradius-server-2.2.6/redhat/freeradius-* . cp freeradius-server-2.2.6/redhat/freeradius.spec ../SPECS/ |
- start to build RPM files
1 |
rpmbuild -bb ../SPECS/freeradius.spec |
- then the RPM files will be here
1 2 3 4 5 6 7 8 9 |
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