Table of Contents |
---|
Info | ||
---|---|---|
| ||
Download: Official FTP |
Operating system installation
Widget Connector | ||
---|---|---|
|
Setup
Updating the system and software
Code Block | ||
---|---|---|
| ||
pkg update && pkg upgrade -y |
ABillS
Download ABillS (check here and check for newer versions):
Code Block | ||
---|---|---|
| ||
fetch https://sourceforge.net/projects/abills/files/abills/0.91/abills-0.91.27.tgz |
If you have problems with certificates, you can:
a) Renew certificates and try again (recommended)
Code Block | ||
---|---|---|
| ||
pkg install -y ca_root_nss && fetch https://sourceforge.net/projects/abills/files/abills/0.91/abills-0.91.27.tgz |
b) Run without checking them
Code Block | ||
---|---|---|
| ||
fetch --no-verify-peer https://sourceforge.net/projects/abills/files/abills/0.91/abills-0.91.27.tgz |
Code Block | ||
---|---|---|
| ||
tar zxvf abills-0.91.27.tgz
cp -Rf abills /usr/ |
Create a system configuration file:
Code Block | ||
---|---|---|
| ||
cp /usr/abills/libexec/config.pl.default /usr/abills/libexec/config.pl |
write everything according to our needs
Code Block | ||
---|---|---|
| ||
#DB configuration
$conf{dbhost}='localhost';
$conf{dbname}='abills';
$conf{dblogin}='abills';
$conf{dbpasswd}='sqlpassword'; #измените на свой пароль
$conf{ADMIN_MAIL}='info@your.domain'; |
The value of $conf{secretkey} is recommended to be changed from "test12345678901234567890" to a random long string. If you change the value in $conf{secretkey}, change it in the /usr/abills/db/abills.sql file as well
Add periodic processes to cron /etc/crontab. These programs control the status of sessions (billd), monthly and daily subscription fees, scheduled tariff plans (periodic)
Code Block | ||
---|---|---|
| ||
*/5 * * * * root /usr/abills/libexec/billd -all
1 0 * * * root /usr/abills/libexec/periodic daily
1 1 * * * root /usr/abills/libexec/periodic monthly |
Set read and write permissions by the web server for web interface files
Code Block | ||
---|---|---|
| ||
mkdir /usr/abills/backup
chown -Rf www /usr/abills/cgi-bin /usr/abills/Abills/templates /usr/abills/backup
mkdir -p /usr/abills/var/log
touch /usr/abills/var/log/sql_errors
chmod 666 /usr/abills/var/log/sql_errors
chown nobody /usr/abills/var/log/sql_errors |
MySQL
Installing the package:
Code Block | ||
---|---|---|
| ||
pkg install -y mysql57-server mysql57-client |
Autostart after reboot. /etc/rc.conf
Code Block | ||
---|---|---|
| ||
echo mysql_enable=\"YES\" >> /etc/rc.conf |
Starting MySQL
Code Block | ||
---|---|---|
| ||
/usr/local/etc/rc.d/mysql-server start |
Clear the password for a comfortable installation (only for 5.7)
Code Block | ||
---|---|---|
| ||
mysqladmin -u root --password=`tail -1 /root/.mysql_secret` -h localhost password "" |
Create a user and a database.
Code Block | ||
---|---|---|
| ||
mysql --default-character-set=utf8 -u root |
In the mysql console, do (If you changed the password in /usr/abills/libexec/config.pl, we also change it in the request):
Code Block | ||
---|---|---|
| ||
GRANT ALL ON abills.* TO `abills`@localhost IDENTIFIED BY "sqlpassword"; -- вместо sqlpassword подставляем своё значение из $conf{dbpasswd}
CREATE DATABASE abills DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
quit; |
Loading tables into the database.
Code Block | ||
---|---|---|
| ||
mysql --default-character-set=utf8 -D abills < /usr/abills/db/abills.sql |
If Invalid default value for 'registration' occurs Run
Code Block | ||
---|---|---|
| ||
sed -i -e "1 s/^/SET SQL_MODE='NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO';/;" /usr/abills/db/abills.sql
mysql --default-character-set=utf8 -D abills < /usr/abills/db/abills.sql |
Perl modules
Perl modules are required for the system to work.
Code Block | ||
---|---|---|
| ||
cd /usr/abills/misc/
perl perldeps.pl pkg |
Create a symlink for the perl executable
Code Block | ||
---|---|---|
| ||
ln -s /usr/local/bin/perl /usr/bin/perl |
Web Server (Apache)
Install Apache
Code Block | ||
---|---|---|
| ||
pkg install -y apache24 |
Copy apache config
Code Block | ||
---|---|---|
| ||
cp /usr/abills/misc/apache/abills_httpd.conf /usr/local/etc/apache24/Includes/ |
Uncomment /usr/local/etc/apache24/httpd.conf modules
Code Block | ||
---|---|---|
| ||
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
LoadModule cgi_module libexec/apache24/mod_cgi.so
LoadModule ssl_module libexec/apache24/mod_ssl.so
LoadModule include_module libexec/apache24/mod_include.so |
By default, we work on HTTPS, so certificates are needed.
Code Block | ||
---|---|---|
| ||
/usr/abills/misc/certs_create.sh apache |
To automatically start apache make changes to rc.conf
Code Block | ||
---|---|---|
| ||
echo apache24_enable=\"YES\" >> /etc/rc.conf |
Create a directory for the Abills web server logs
Code Block | ||
---|---|---|
| ||
mkdir /var/log/httpd/ |
Starting Apache
Code Block | ||
---|---|---|
| ||
/usr/local/etc/rc.d/apache24 start |
Freeradius
Code Block | ||
---|---|---|
| ||
cd /usr/ports/net/freeradius3 && make && make install clean |
Manual configuration
Copy the configuration
Code Block | ||
---|---|---|
| ||
cd /usr/abills/
rm /usr/local/etc/raddb/sites-enabled/*
cp misc/freeradius/v3/mods-enabled/perl /usr/local/etc/raddb/mods-enabled/perl
cp misc/freeradius/v3/mods-enabled/sql /usr/local/etc/raddb/mods-enabled/sql
cp misc/freeradius/v3/sites-enabled/abills_default /usr/local/etc/raddb/sites-enabled/abills_default
cp misc/freeradius/v3/sites-enabled/control-socket /usr/local/etc/raddb/sites-enabled/control-socket
cp misc/freeradius/v3/users /usr/local/etc/raddb/users |
In the file /usr/local/etc/raddb/mods-enabled/sql write data to the database
Code Block | ||
---|---|---|
| ||
sql {
database = "mysql"
driver = "rlm_sql_${database}"
server = "localhost"
port = 3306
login = "abills"
password = "sqlpassword" #instead of sqlpassword we substitute our value from $conf{dbpasswd}
radius_db = "abills"
At the end of the file
'%secretkey%' change to your value, which is written in $conf{secretkey} |
Clear the list of access servers from /usr/local/etc/raddb/clients.conf (so that there are no duplicates due to entries in the database):
Code Block | ||
---|---|---|
| ||
echo '' > /usr/local/etc/raddb/clients.conf |
Autoconfiguration
Code Block | ||
---|---|---|
| ||
cd /usr/abills/misc/
./autoconf PROGRAMS=freeradius FREERADIUS=3 |
press yes everywhere
Run
To automatically start the radius, make changes to /etc/rc.conf
Code Block | ||
---|---|---|
| ||
echo radiusd_enable=\"YES\" >> /etc/rc.conf |
start radius:
Code Block | ||
---|---|---|
| ||
/usr/local/etc/rc.d/radiusd start |
Remove
Code Block | ||
---|---|---|
| ||
cd /usr/ports/net/freeradius3 && make deinstall clean
rm -r /usr/local/etc/raddb |
Clear config when reinstalling
Code Block | ||
---|---|---|
| ||
make clean config |