一、基础环境安装
1.安装基础环境
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel
2.安装apache
yum -y install httpd httpd-devel
3.安装数据库
yum -y install mariadb-server mariadb
4.安装php
yum -y install php php-devel php-mysql php-common php-gd php-mbstring php-mcrypt php-imap php-odbc php-pear php-xml php-xmlrpc php-pear-DB
5.设置开机启动,启动服务,检测状态
systemctl enable httpd systemctl enable mariadb systemctl start httpd systemctl start mariadb systemctl status httpd systemctl status mariadb
6.设置数据库
mysql_secure_installation
SQL自动配置(除设置root密码Aa123123,其余都回车)
7.创建数据库
mysql -u root -p //登录数据库,需要输入刚刚的root密码Aa123123 create database radius; 创建数据库radius grant all on radius.* to radius@localhost identified by 'radius123'; //设置radius用户名密码及权限 flush privileges; //刷新权限 exit //退出
二、freeradius安装与配置
1.freeradius安装
yum -y install freeradius freeradius-utils freeradius-mysql
启动radius和设置为开机启动
systemctl start radiusd.service systemctl enable radiusd.service
2.导入radius数据表
mysql -u root -p radius < /etc/raddb/mods-config/sql/main/mysql/schema.sql
需要输入root密码Aa123123
3.修改FreeRadius配置文件
vi /etc/raddb/mods-available/sql
修改下面的配置
driver = "rlm_sql_mysql" dialect = "mysql" server = "localhost" port = 3306 login = "radius" password = "radius123"
按Esc退出:wq保存
4.建立mysql调用
cd /etc/raddb/mods-enabled ln -s ../mods-available/sql
5.配置文件权限
chgrp -h radiusd /etc/raddb/mods-available/sql
6.重启radius
systemctl restart radiusd.service
三、安装freeradius管理界面Daloradius
1.先下载文件(master.zip,daloradius-0.9-9.tar.gz)
https://github.com/lirantal/daloradius/archive/master.zip
链接:https://pan.baidu.com/s/1SRjQbFEGi5iNNDVFAh5PwQ?pwd=dbbb
提取码:dbbb
链接:https://pan.baidu.com/s/1B0eao5LZ-YTVIjExZ4TDrg?pwd=s7vr
提取码:s7vr
下载后上传到centos中
2.解压和移动文件
unzip master.zip mv daloradius-master/ /var/www/html/daloradius //移动文件夹 tar -xzvf daloradius-0.9-9.tar.gz //解压缩包 mv daloradius-0.9-9/* /var/www/html/daloradius/ //覆盖源码
3.设置daloradius权限
chown -R apache:apache /var/www/html/daloradius chmod -R 664 /var/www/html/daloradius/library/daloradius.conf.php
4.修改配置
编辑数据库信息
导入SQL脚本
mysql -u root -p radius < /var/www/html/daloradius/contrib/db/fr2-mysql-daloradius-and-freeradius.sql mysql -u root -p radius < /var/www/html/daloradius/contrib/db/mysql-daloradius.sql
有报错
ERROR 1064 (42000) at line 149: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '6) ON UPDATE CURR
PRIMARY KEY (id),
KEY username (username(' at line 6
更改CREATE TABLE IF NOT EXISTS radpostauth中authdate TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
报错ERROR 1067 (42000) at line 180: Invalid default value for 'expiry_time'
更改CREATE TABLE IF NOT EXISTS radippool中expiry_time DATETIME NULL DEFAULT NULL,
5.更改daloradius.conf.php
vi /var/www/html/daloradius/library/daloradius.conf.php
修改
$configValues['CONFIG_DB_ENGINE'] = 'mysql';
$configValues['CONFIG_DB_HOST'] = 'localhost';
$configValues['CONFIG_DB_PORT'] = '3306';
$configValues['CONFIG_DB_USER'] = 'radius';
$configValues['CONFIG_DB_PASS'] = 'radius123';
$configValues['CONFIG_DB_NAME'] = 'radius';
configValues[‘CONFIG_FILE_RADIUS_PROXY‘] = ‘/etc/raddb/proxy.conf‘;(68行)
$configValues[‘CONFIG_PATH_DALO_VARIABLE_DATA‘] = ‘/var/www/html/daloradius/var‘; (70行)
$configValues[‘CONFIG_MAINT_TEST_USER_RADIUSSECRET‘] = ‘testing123‘; (86行) #注意这条,要和 /etc/raddb/clients.conf 文件设置的secret = xxxxxxxxxx 值一样。
5.
6.更改apache配置
vi /etc/httpd/conf/httpd.conf
找到Directory />部分修改为
<Directory />
AllowOverride none
Require all granted
</Directory>
防火墙里面放行端口
firewall-cmd --permanent --add-port=80/tcp firewall-cmd --reload
四、测试访问
http://192.168.31.114/daloradius/
其他:
设置可以远程访问数据库:
vi /etc/my.cnf.d/server.cnf
在 [mysqld]下添加
bind-address = 0.0.0.0
skip-networking = 0
保存
登录MariaDB并为root用户授权远程访问:
mysql -u root -p GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION; FLUSH PRIVILEGES;
重启mariadb
systemctl restart mariadb
防火墙允许3306端口
firewall-cmd --permanent --add-port=3306/tcp firewall-cmd --reload
标签:WEB,DaloRadius,FreeRadius3,daloradius,devel,systemctl,radius,mysql,php From: https://www.cnblogs.com/fanhua999/p/18371857