系统需求
- SmartAAA 建议安装在 CentOS 7.x 操作系统之上,使用 MariaDB 5.x、php7.2 及 nginx。
- SmartAAA 需要系统至少有 4G 内存及 1G 硬盘空间。
关闭防火墙
setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
source /etc/selinux/config
systemctl stop firewalld && systemctl disabled firewalld
数据库安装及初始化
#安装数据库
yum -y install mariadb mariadb-server
#启动数据库并设置为自启动
systemctl enable mariadb && systemctl start mariadb
#修改密码
mysql -uroot -p
Enter password:
MariaDB [(none)]>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
MariaDB [(none)]>exit
应用环境安装
安装配置 nginx
yum install nginx -y
没有可用软件包 nginx
#安装epel
yum install -y epel-release
在/etc/nginx/conf.d/下创建配置文件 www.conf
touch /etc/nginx/conf.d/www.conf
内容如下:
server {
listen 8001 default_server;
server_name _;
root /usr/share/nginx/html/smartaaa-admin/;
#Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / { index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
启动 nginx 并设置为自启动
systemctl start nginx && systemctl enable nginx
安装php
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php72w php72w-cli.x86_64 php72w-common.x86_64 php72w-gd.x86_64 php72w-mbstring.x86_64 php72w-mcrypt.x86_64 php72w-mysql.x86_64 php72w-pdo.x86_64 php72w-xml.x86_64 php72w-fpm.x86_64 php72w-process.x86_64
#安装 php 的 excel 插件,用于用户数据导入
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
composer require phpoffice/phpspreadsheet
#配置 php-fpm
vim /etc/php-fpm.d/www.conf
将 user 和 group 都设置为 nginx
; Unix user/group of processes; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
chown -R nginx.nginx /var/lib/php
#启动 php-fpm 并设置为自启动
systemctl start php-fpm && systemctl enable php-fpm
SmartAAA安装启动
#解压缩软件包
yum -y install unzip
unzip smartaaa-exe-v0623.zip,会解压成如下目录结构
smartaaa/
- smartaaa-admin/
- smartaaa-server/
- log/
- radius.sql
- ixed.7.2.lin
- manual.pdf
cd smartaaa-exe-v0623
rm -rf smartaaa-server
tar -vxf smartaaa-server.tar
mv smartaaa-admin /usr/share/nginx/html
chown -R nginx.nginx /usr/share/nginx/html
#安装加速库
mv ixed.7.2.lin /usr/lib64/php/modules/
vim /etc/php.ini,在 Dynamic Extensions 配置中增加 extension=ixed.7.2.lin
systemctl restart nginx
systemctl restart php-fpm
#创建表结构
mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS radius DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
MariaDB [(none)]> exit
mysql -uroot -p radius < radius.sql
mysql -uroot -p
Enter password:
MariaDB [(none)]> use radius
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [radius]> show tables;
+------------------+
| Tables_in_radius |
+------------------+
| ViewOnline |
| accounting |
| admin |
| group |
| nas |
| user |
+------------------+
6 rows in set (0.00 sec)
mysql -h192.168.248.135 -uroot -p
安装配置 web 管理界面
chown -R nginx.nginx /usr/share/nginx/html/*
vim /usr/share/nginx/html/smartaaa-admin/ewcfg15.php,修改数据库连接信息
// Database connection info
$CONNECTIONS["DB"] = array("conn" => NULL, "id" => "DB", "type" => "MYSQL", "host" => "127.0.0.1", "port" => 3306, "user" => "root", "pass" => "", "db" => "radius", "qs" => "`", "qe" => "`");
$CONNECTIONS[0] = &$CONNECTIONS["DB"];
#安装配置服务端
vim smartaaa-server/config.php,修改数据库连接信息。
$dbhost = '127.0.0.1';
$dbport = '3306';
$dbuser = 'root';
$dbpass = 'root';
运行
php smartaaa-server/smartaaa.php start -d
默认的 web 管理界面管理员为 admin/admin