CentOS 7 FreeRadius + DaloRadius 安装与配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7 FreeRadius + DaloRadius 安装与配置相关的知识,希望对你有一定的参考价值。
(1)安装httpd服务器和MariaDB//安装Apache和MariaDB数据库
# yum -y update
# yum -y groupinstall "Development Tools"
# yum -y install httpd httpd-devel mariadb-server mariadb
//打开服务,设置开机运行
systemctl enable httpd
systemctl start httpd
systemctl start mariadb
systemctl enable mariadb
//初始化数据库
#mysql_secure_installation
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n (这里我开启了可以远程访问数据库)
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Thanks for using MariaDB!
//配置freeRADIUS的数据库
# mysql -u root -p -e "CREATE DATABASE radius"
# mysql -u root -p -e "show databases"
# mysql -u root -p
MariaDB [(none)]> GRANT ALL ON radius.* To [email protected] IDENTIFIED BY "radpass";
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q
Bye
(2)安装在CentOS 7的php 7
# cd ~
# curl '' -o setup-ius.sh
# sudo bash setup-ius.sh
# sudo yum remove php-cli mod_php php-common
# yum install php php-mysql php-gd php-pear-DB -y
# sudo apachectl restart
(3)安装FreeRADIUS
# yum -y install freeradius freeradius-utils freeradius-mysql freeradius-sqlite
//打开Radius服务,开机自动启动Radius服务
# systemctl start radiusd.service
# systemctl enable radiusd.service
//编辑radiusd服务文件内容
# vim /etc/systemd/system/multi-user.target.wants/radiusd.service
在Unit部分增加一条命令,其它内容保持不变
[Unit]
After=mariadb.service
//安全开启防火墙
# systemctl enable firewalld
# systemctl start firewalld
# systemctl status firewalld
//增加永久性规则到默认区域允许http、https和RADIUS服务
# firewall-cmd --get-services | egrep 'http|https|radius'
# firewall-cmd --add-service={http,https,radius} --permanent
//更改的重新加载firewalld能生效。
# firewall-cmd --reload
(4)配置FreeRADIUS
//导入RADIUSdatabase方案填充RADIUS数据库
# mysql -u root -p radius < /etc/raddb/mods-config/sql/main/mysql/schema.sql
//创建SQL的一条软链在/etc/raddb/mods-enabled下
# ln -s /etc/raddb/mods-available/sql /etc/raddb/mods-enabled/
//配置SQL模块/raddb/mods-available/sql并且更改数据库连接参数到套件您的环境
# vim /etc/raddb/mods-available/sql
sql {
driver = "rlm_sql_mysql"
dialect = "mysql"
# Connection info:
server = "localhost"
port = 3306
login = "radius"
password = "radpass"
# Database table configuration for everything except Oracle
radius_db = "radius"
}
# Set to ‘yes’ to read radius clients from the database (‘nas’ table)
# Clients will ONLY be read on server startup.
read_clients = yes
# Table to keep radius client info
client_table = “nas”
//更改权限组 etc/raddb/mods-enabled/sql组对radiusd的
[[email protected] ~]# chgrp -h radiusd /etc/raddb/mods-enabled/sql
(5)下载安装DaloRadius
//下载DaloRadius
wget http://nchc.dl.sourceforge.net/project/daloradius/daloradius/daloradius0.9-9/daloradius-0.9-9.tar.gz
//迁移到Apache网站目录
# mv -a daloradius-0.9-9 /var/www/html/daloradius
//导入DaloRadius 的数据库脚本
cd
/var/www/html/daloradius/contrib/db
mysql -uradius -pradpass radius < .
/mysql-daloradius
.sql
(6)配置DaloRadius配置文件
vim /var/www/html/daloradius/library/daloradius.conf.php
#具体根据自己的参数设定
$configValues['CONFIG_DB_HOST'] = 'localhost';
$configValues['CONFIG_DB_PORT'] = '3306';
$configValues['CONFIG_DB_USER'] = 'radius';
$configValues['CONFIG_DB_PASS'] = 'radpass';
$configValues['CONFIG_DB_NAME'] = 'radius';
…………
#这个路径和程序放置路径有关系
$configValues['CONFIG_PATH_DALO_VARIABLE_DATA'] = '/var/www/html/daloradius/var';
(7)具体的主机配置我这里不再介绍,启动Web服务,找一个浏览器输入:http://x.x.x.x/daloradius/login.php。从INSTALL文档中可以看
到,第一次登录的用户是administrator,密码是radius。如果生产环境使用的话一定要修改以下密码,这个用户的信息在表
operators里面。
以上是关于CentOS 7 FreeRadius + DaloRadius 安装与配置的主要内容,如果未能解决你的问题,请参考以下文章
CentOS PPTP配置LNMP+PPTP+FreeRADIUS+DaloRADIUS+流量控制
CentOS7.4+FreeRadius+ldap(Windows AD)认证 搭建radius服务
CentOS PPTP配置FreeRADIUS+DaloRADIUS实现高级用户控制+流量控制