1 ubuntu 安装LAMP 环境(安装nginx代替apache):
Ubuntu 22.04.4 LTS 安装 php apache LAMP 环境nginx-CSDN博客
2 安装freeradius
sudo apt update
sudo apt-get install libmysqld-dev
sudo apt-get install freeradius
#先安装libmysqld-dev,否则启动可能报错
Could not link driver rlm_sql_mysql: /usr/lib/freeradius/rlm_sql_mysql.so: cannot open shared object file: No such file or direc>
#rlm_sql_mysql.so 拷贝到/usr/lib/freeradius/
#为方便下载提供百度云链接
3 创建数据库和用户(mysql8)
create database radius;
create user radius@'%' IDENTIFIED WITH mysql_native_password BY '密码';
Grant all privileges on radius.* TO 'radius'@'%';
flush privileges;
4 导入 FreeRADIUS 目录中的预构建数据到 mysql radius库
#使用root 账号导入数据库
sudo su -
sudo mysql -uroot -p radius < /etc/freeradius/3.0/mods-config/sql/main/mysql/schema.sql
#配置软链接
sudo ln -s /etc/freeradius/3.0/mods-available/sql /etc/freeradius/3.0/mods-enabled/
sudo chown -R freerad.freerad /etc/freeradius/3.0/mods-enabled/sql
#修改sql
sudo vim /etc/freeradius/3.0/mods-enabled/sql
dialect = "sqlite" ---> dialect = "mysql"
driver = "rlm_sql_null" ---> driver = "rlm_sql_${dialect}"
# server = "localhost" ---> server = "localhost"
# port = 3306 ---> port = 3306
# login = "radius" ---> login = "radius"
# password = "radpass" ---> password = "密码"
# read_clients = yes ---> read_clients = yes
#注释mysql ssl部分
5 启动freeradius服务
#freeRadius调试模式
sudo freeradius -X
#启动
sudo systemctl restart freeradius
#查看服务
sudo systemctl status freeradius
6 安装并配置 Daloradius
wget https://github.com/lirantal/daloradius/archive/master.zip
unzip master.zip
sudo mv daloradius-master/ /data/www/html/daloradius
#更改目录权限
sudo chown www-data:www-data -R /data/www/html/daloradius
cd /data/www/html/daloradius/app/common/includes
sudo cp daloradius.conf.php.sample daloradius.conf.php
sudo chmod 664 daloradius.conf.php
#修改配置文件
sudo vim daloradius.conf.php
$configValues['CONFIG_DB_USER'] = 'raduser';
$configValues['CONFIG_DB_PASS'] = 'radpass';
$configValues['CONFIG_DB_NAME'] = 'raddb';
改成实际的信息
#导入到mysql
cd /data/www/html/daloradius/contrib/db
mysql -uroot -p radius < fr3-mariadb-freeradius.sql
mysql -uroot -p radius < mariadb-daloradius.sql
7 登录报错
PHP Fatal error: Uncaught Error: Class "DB" not found in /var/www/daloradius/app/common/includes/db_open.php:59\nStack t
race:\n#0 /var/www/daloradius/app/operators/dologin.php(59): include()\n#1 {main}\n thrown in /var/www/daloradius/app/common/includes/db_open.php on line 59
#解决
sudo apt install php-pear
sudo pear install DB
#报错
PHP Fatal error: Uncaught Error: Undefined constant "MYSQLI_NOT_NULL_FLAG" in /usr/share/php/DB.php:561\nStack trace:\n#
0 /var/www/daloradius/app/common/includes/db_open.php(59): DB::connect()\n#1 /var/www/daloradius/app/operators/dologin.php(59): include('...')\n#2 {main}\n thrown in /usr/share/php/DB.php on line 561
#解决
sudo apt-get install php-mysqli
#报错
PHP Fatal error: Uncaught Error: Call to undefined function mb_strpos()
#解决
sudo apt-get install php-mbstring
8 登录daloradius,修改界面中文
#默认用户和密码
Username: administrator
Password: radius
9 daloRADIUS修改默认密码