美文网首页
2020-01-03 AWS Ubuntu 18.04 安装 F

2020-01-03 AWS Ubuntu 18.04 安装 F

作者: AK蜗牛 | 来源:发表于2020-01-03 18:55 被阅读0次

记录一下如何在Ubuntu上安装FreeRadius以及图形管理界面daloRADIUS。

首先由于是在AWS EC2上安装,记得在AWS EC2实例的安全策略组入方向开放HTTP(80)端口以及Radius 1812/1813端口。

环境安装

1、安装 FreeRADIUS 3和 FreeRADIUS modules

apt update
apt upgrade
apt install freeradius freeradius-mysql freeradius-utils -y

2、安装php

apt install php-common php-gd php-curl php-mysql -y

装完看下版本,7.2版本

axing@ip-xxx-xx-9-xx:~$ php -v
PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

3、安装MySQL Server

apt install mysql-server mysql-client -y

装完后对mysql数据库安全设置

mysql_secure_installation

配置root密码,移除测试数据库,禁止远程登录等。

如果进数据库碰到以下报错:

# ERROR 1698 (28000): Access denied for user 'root'@‘localhost'

加 sudo mysql -u root 进入mysql后,使用下面命令重设密码

 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ‘Your Password’; 

FreeRadius 相关配置

1、首先创建radius数据库

mysql -u root -p
CREATE DATABASE radius;
Exit

2、导入radius 数据库结构

cd /etc/freeradius/3.0/mods-config/sql/main/mysql/
mysql -uroot -pYourMysqlPass radius < schema.sql
mysql -uroot -pYourMysqlpass radius < setup.sql

3、修改配置文件

建软链接

cd /etc/freeradius/3.0/mods-enabled
ln -s ../mods-available/sql sql

修改”default”配置文件

cd /etc/freeradius/3.0/sites-available/
vim default

把下面几段配置里的“file”注释掉,增加“sql”

authorize {
.....
sql
....
}
accounting {
......
sql
....
}
post-auth {
......
sql
....
}
session{
......
sql
.....}

修改radius SQL module配置文件

cd /etc/freeradius/3.0/mods-available
vim sql

按照以下修改,记得密码是刚改的那个

driver = "rlm_sql_mysql"

dialect = "mysql"
server = "localhost"
port = 3306
login = "root"
password = "YOURMYSQLPASSWORD"
radius_db = "radius"
read_clients = yes

运行 FreeRADIUS

freeradius -X

可以安装screen再执行这个命令

出现下面提示,说明运行正常

Listening on auth address 127.0.0.1 port 18120 bound to server inner-tunnel
Listening on auth address * port 1812 bound to server default
Listening on acct address * port 1813 bound to server default
Listening on auth address :: port 1812 bound to server default
Listening on acct address :: port 1813 bound to server default
Listening on proxy address * port 34554
Listening on proxy address :: port 48130
Ready to process requests

安装daloRADIUS图形界面

1、安装apache2及相关依赖

apt update
apt install apache2 -y
apt install php libapache2-mod-php -y
a2enmod mpm_prefork && sudo a2enmod php7.2
apt install php-gd php-mail php-mail-mime php-pear php-db -y
pear install DB
service apache2 restart

2、下载及安装daloRADIUS

wget [https://github.com/lirantal/daloradius/archive/master.zip](https://github.com/lirantal/daloradius/archive/master.zip)
unzip master.zip
mv daloradius-master /var/www/html/daloradius
rm master.zip

3、增加daloRADIUS SQL数据库结构

chmod 644 /var/www/html/daloradius/library/daloradius.conf.php
cd /var/www/html/daloradius/contrib/db
mysql -u root -pYOURPASS radius < mysql-daloradius.sql;

4、修改配置文件

vim /var/www/html/daloradius/library/daloradius.conf.php

参考以下配置,记得修改password

$configValues['DALORADIUS_VERSION'] = '0.9-9';
$configValues['FREERADIUS_VERSION'] = '2';
$configValues['CONFIG_DB_ENGINE'] = 'mysqli';
$configValues['CONFIG_DB_HOST'] = 'localhost';
$configValues['CONFIG_DB_PORT'] = '3306';
$configValues['CONFIG_DB_USER'] = 'root';
$configValues['CONFIG_DB_PASS'] = 'PASSWORD';
$configValues['CONFIG_DB_NAME'] = 'radius';
$configValues['CONFIG_DB_TBL_RADCHECK'] = 'radcheck';
$configValues['CONFIG_DB_TBL_RADREPLY'] = 'radreply';
$configValues['CONFIG_DB_TBL_RADGROUPREPLY'] = 'radgroupreply';
$configValues['CONFIG_DB_TBL_RADGROUPCHECK'] = 'radgroupcheck';

5、登录图形界面

http://<IP/URL>/daloradius/

默认用户名密码是 administrator/radius

image.png

相关文章

网友评论

      本文标题:2020-01-03 AWS Ubuntu 18.04 安装 F

      本文链接:https://www.haomeiwen.com/subject/emktactx.html