1. 建立原始碼儲存資料夾
#mkdir /usr/src/freeradius
#cd /usr/src/freeradius
2. 安裝必要條件及下載原始碼
#apt-get update
#apt-get build-dep freeradius
#apt-get install libssl-dev fakeroot
#apt-get source freeradius
3. 編輯 /usr/src/freeradius/freeradius-1.1.3/debian/control 把 libssl-dev 加入相依並從牴觸移除。也就是加入第二行(Build-Depends)最後面,從第三行(Build-Conflicts)拿掉。
Build-Depends: debhelper (>= 5), libltdl3-dev, libpam0g-dev, libmysqlclient15-dev | libmysqlclient-dev, libgdbm-dev, libldap2-dev, libsasl2-dev, libiodbc2-dev, libkrb5-dev, snmp, autotools-dev, dpatch (>= 2), libperl-dev, libtool, dpkg-dev (>= 1.13.19), libssl-dev
Build-Conflicts:
4. 同樣編輯 /usr/src/freeradius/freeradius-1.1.3/debian/control 在檔案最後面加入 EAP 模組,這裡要特別注意各模組的 Description 下面幾行最前面都要空一格,才會被視為 Description 的一部分,否則會出錯。
Package: freeradius-eaptls
Architecture: any
Depends: freeradius (= ${binary:Version}), ${shlibs:Depends}
Description: eap-tls module for FreeRADIUS server
Debian will not provide a binary version of the rlm_eap_tls.so library. This
module is required if you want to use EAP/TLS authentication, commonly used
for WiFi access points.
Package: freeradius-eappeap
Architecture: any
Depends: freeradius (= ${binary:Version}), ${shlibs:Depends}
Description: eap-peap module for FreeRADIUS server
Debian will not provide a binary version of the rlm_eap_peap.so library. This
module is required if you want to use EAP/PEAP authentication, commonly used
for WiFi access points.
5. 編輯 /usr/src/freeradius/freeradius-1.1.3/debian/rules 搜尋 "buildssl=" ,把 tls 和 peap 的 without 拿掉,如果有其他需求,就再拿到需要的 without 吧。再搜尋 "moduleslist=" 加入 eap_peap eap_tls。變成
buildssl=--without-rlm_otp --without-rlm_sql_postgresql --without-snmp
modulelist=krb5 ldap sql_mysql sql_iodbc eap_peap eap_tls
6. 建立檔案 /usr/src/freeradius/freeradius-1.1.3/debian/freeradius-eaptls.install 內容為
usr/lib/freeradius/rlm_eap_tls*.so
7. 建立檔案 /usr/src/freeradius/freeradius-1.1.3/debian/freeradius-eappeap.install 內容為
usr/lib/freeradius/rlm_eap_peap*.so
8. 建立檔案 /usr/src/freeradius/freeradius-1.1.3/debian/freeradius-eaptls.postinst 內容為
#! /bin/sh
set -e
case "$1" in
configure)
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d freeradius restart
else
/etc/init.d/freeradius restart
fi
;;
abort-upgrade)
;;
abort-remove)
;;
abort-deconfigure)
;;
esac
9. 建立檔案 /usr/src/freeradius/freeradius-1.1.3/debian/freeradius-eappeap.postinst 內容為
#! /bin/sh
set -e
case "$1" in
configure)
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d freeradius reload
else
/etc/init.d/freeradius reload
fi
;;
abort-upgrade)
;;
abort-remove)
;;
abort-deconfigure)
;;
esac
10. 編譯
#cd /usr/src/freeradius/freeradius-1.1.3/
#dpkg-buildpackage -rfakeroot -uc -us
完成後應該可以在 /usr/src/freradius 看到一堆 freeradius-*.deb
11. 逐一安裝需要的套件
安裝成功應該就可以看到 freeradius 的執行緒
#dpkg -i freeradius_1.1.3-3_i386.deb
#dpkg -i freeradius-eaptls_1.1.3-3_i386.deb
#dpkg -i freeradius-eappeap_1.1.3-3_i386.deb
#dpkg -i freeradius-dialupadmin_1.1.3-3_all.deb
#dpkg -i freeradius-iodbc_1.1.3-3_i386.deb
#dpkg -i freeradius-krb5_1.1.3-3_i386.deb
#dpkg -i freeradius-ldap_1.1.3-3_i386.deb
#dpkg -i freeradius-mysql_1.1.3-3_i386.deb
#ps aux | grep freeradius