前提: ubuntu安装,并配好LAMP环境。
以下软件包需安装
sudo apt-get install php5-common php5-gd php-pear php-db libapache2-mod-php5 php-mail
—————————————————————————————————-
1.安装 freeradius :
sudo apt-get install freeradius freeradius-mysql freeradius-utils
测试freeradius状态:
#freeradius -X
下面显示正常
====================================
Listening on authentication address * port 1812
Listening on accounting address * port 1813
Listening on proxy address * port 1814
Ready to process requests.
=====================================
按 CTRL + C 退出.
如果显示1812端口已占用,
尝试:’service freeradius restart ‘ 然后 ‘service freeradius stop’ 这个时候在尝试 ‘freeradius -X’ ,会正常。
#mysql -uroot -p
mysql>GRANT ALL ON radius.* TO ‘radius’@’localhost’ IDENTIFIED BY ‘radpass’;
mysql>FLUSH PRIVILEGES;
mysql>quit
编辑设置 sql.conf
#vi /etc/freeradius/sql.conf
===========================
# Connection info:
server = “localhost”
login = “radius” –> radius数据库用户名
password = “radpass” –> radius数据库密码
radius_db = “radius” –> radius数据库名以下去掉 #.
readclients = yes
#vi /etc/freeradius/sites-enabled/default
找出含有#sql, 去掉 sql 前的 # 號.
authorize{} 部份
accounting{} 部份
session{} 部份
post-auth{} 部份
#mysql -uroot -p
mysql> use radius;
mysql> INSERT INTO radcheck (UserName, Attribute, Value) VALUES (‘sqltest’, ‘Password’, ‘testpwd’);
mysql> FLUSH PRIVILEGES;
mysql> quit
停用freeradius.(改完配置需要重启服务)
#/etc/init.d/freeradius stop运行Freeradius debug模式 (相当于再次启动)
#freeradius -X
#radtest sqltest testpwd localhost 1812 testing123
Sending Access-Request of id 226 to 127.0.0.1 port 1812
User-Name = “sqltest”
User-Password = “testpwd”
NAS-IP-Address = 127.0.1.1
NAS-Port = 1812
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=226, length=20看到以上的結果就成功了.

freeradius+mysql 亚马逊EC2安装笔记 was originally published on 静以养身