Skip to end of metadata
Go to start of metadata

Operating system installation notes

  • When partitioning a disk, it is highly recommended to allocate at least 10 GB for the /var partition. If a high load is planned, this value can be increased.

  • Recommended distribution FreeBSD 11.0-RELEASE (http://freebsd.org/)

  • Read more about installing FreeBSD here FreeBSD Handbook

Download: Official FTP

Download FreeBSD 11.0 AMD64

Download FreeBSD 11.0 i386

Operating system installation

Setup

Updating the system and software

pkg update && pkg upgrade -y

ABillS

Download ABillS (check here and check for newer versions):

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)

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

fetch --no-verify-peer https://sourceforge.net/projects/abills/files/abills/0.91/abills-0.91.27.tgz
Unzipping:
tar zxvf abills-0.91.27.tgz
cp -Rf abills /usr/

Create a system configuration file:

cp /usr/abills/libexec/config.pl.default /usr/abills/libexec/config.pl

write everything according to our needs

#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)

*/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

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:
pkg install -y mysql57-server mysql57-client
Autostart after reboot. /etc/rc.conf
echo mysql_enable=\"YES\" >> /etc/rc.conf
Starting MySQL
/usr/local/etc/rc.d/mysql-server start
Clear the password for a comfortable installation (only for 5.7)
mysqladmin -u root --password=`tail -1 /root/.mysql_secret` -h localhost password ""
Create a user and a database.
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):
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.
mysql --default-character-set=utf8 -D abills < /usr/abills/db/abills.sql
If Invalid default value for 'registration' occurs Run
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.
cd /usr/abills/misc/
perl perldeps.pl pkg
Create a symlink for the perl executable
ln -s /usr/local/bin/perl /usr/bin/perl

Web Server (Apache)

Install Apache
pkg install -y apache24
Copy apache config
cp /usr/abills/misc/apache/abills_httpd.conf /usr/local/etc/apache24/Includes/
Uncomment /usr/local/etc/apache24/httpd.conf modules
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.
/usr/abills/misc/certs_create.sh apache 
To automatically start apache make changes to rc.conf
echo apache24_enable=\"YES\" >> /etc/rc.conf   
Create a directory for the Abills web server logs
mkdir /var/log/httpd/

Starting Apache

/usr/local/etc/rc.d/apache24 start

Freeradius

cd /usr/ports/net/freeradius3 && make && make install clean
Manual configuration
Copy the configuration
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
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):
echo '' > /usr/local/etc/raddb/clients.conf
Autoconfiguration
cd /usr/abills/misc/
./autoconf PROGRAMS=freeradius FREERADIUS=3
press yes everywhere

Run

To automatically start the radius, make changes to /etc/rc.conf
echo radiusd_enable=\"YES\" >> /etc/rc.conf
start radius:
/usr/local/etc/rc.d/radiusd start

Remove

cd /usr/ports/net/freeradius3 && make deinstall clean
 rm -r /usr/local/etc/raddb
Clear config when reinstalling
make clean config
  • No labels