- vi /usr/local/freeradius/etc/raddb/radiusd.conf //搜索 $INCLUDE sql.conf 去掉行首的注释(某些版本可能已经去掉注释了)
- vi /usr/local/freeradius/sites-enabled/default //将authorize{}段中file改为sql,同样accounting{}段中的file也改成sql.示例:
- authorize {
- preprocess
- chap
- mschap
- suffix
- eap
- sql
- pap
- }
- accounting {
- detail
- sql
- }
- mysql -uroot -p //开启一个mysqlshell
- create database radius;
- grant all on radius.* to radius@localhost identified by "radpass";
- exit;
- vi /usr/local/freeradius/etc/raddb/sql.conf //示例:
- server = "localhost"
- port = 3306
- login = "radius"
- password = "radpass"
- pear install DB-1.7.14RC2
- tar zxvf daloradius-0.9-9.tar.gz
- cp -r daloradius-0.9-9 /var/www/html/daloradius ///var/www/html是RHEL5上apache的DocumentRoot,我直接拷到它下面。也可以虚拟目录等其他方式,自由发挥吧
- chown -R apache:apache /var/www/html/daloradius //修改文件属主,apache是我的apache运行账户。
- cd /var/www/html/daloradius/contrib/db
- mysql -uroot -pyourpassword < mysql-daloradius.sql
- mysql -uroot -pyourpassword < fr2-mysql-daloradius-and-freeradius.sql
- vi /var/www/html/daloradius/library/daloradius.conf.php //主机、用户名、密码之类的。
- ssh steve@localhost //steve是我创建的用户
Troubleshooting
- 提示错误:rlm_sql (sql): Could not link driver rlm_sql_mysql: rlm_sql_mysql.so: cannot open shared object file: No such file or directory
这个错误通常出现编译安装情况下,原因正如他提示的那样找不到mysql驱动.解决方法是:
- 进入freeradius安装目录
- cd src/modules/rlm_sql/drivers/rlm_sql_mysql/
- ./configure --with-mysql-dir=/var/lib/mysql --with-mysql-lib-dir=/usr/lib/mysql
- //--with-mysql-dir 指定mysql的家目录。如果是用rpm或yum的方式安装mysql,这个目录为/var/lib/mysql
- //--with-mysql-lib-dir 指定mysql库文件目录。如果是用rpm或yum的方式安装mysql,这个目录为/usr/lib/mysql
- make
- make install