Install FreeRADIUS 3 and FreeRADIUS modules Ubuntu 18.04

Start by updating your system packages to the latest version:

sudo apt update
sudo apt -y upgrade

Reboot system after doing an upgrade

sudo reboot

Once the system is up, begin the installation FreeRADIUS and Daloradius on your Ubuntu 18.04 / Ubuntu 16.04 system.

Step 1: Install Apache Web Server and PHP

Daloradius will require php and Apache web server to be installed on the host system.

Installing Apache on Ubuntu:

Install Apache web server by running:

sudo apt -y install apache2

For installation of PHP on Ubuntu 18.04 and Ubuntu 16.04, run:

sudo apt -y install php libapache2-mod-php php-{gd,common,mail,mail-mime,mysql,pear,db,mbstring,xml,curl}

Check the version of php installed:

$ php -v
PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.19-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies

Step 2: Install MariaDB and Create a database

Next is to install the MariaDB server and create a database for daloRADIUS. We have a comprehensive guide for installing MariaDB 10.x on Ubuntu

Install MariaDB 10.x on Ubuntu 18.04 and CentOS 7

Once installed and running, create a database for FreeRADIUS, this will be used at a later stage.

database name: radius
database user: radius
database user password: radiuspassword

If you have a dedicated database server, replace localhost with the IP of source FreeRADIUS Server.

$ mysql -u root -p
CREATE DATABASE radius;
GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "radiuspassword";
FLUSH PRIVILEGES;
quit

Step 3: Install and Configure FreeRADIUS

As of this writing, the default version of FreeRADIUS installed on Ubuntu 18.04 is v3.0. Install if from official Ubuntu apt repository using:

sudo apt -y install freeradius freeradius-mysql freeradius-utils

Among the packages installed are mysql module and utils package.

For Ubuntu 16.04 system, version 2.x is the package available from the official repository. To install version 3.0, add the Personal Package Archive (PPA) for the version 3 of FreeRADIUS.

sudo add-apt-repository ppa:freeradius/stable-3.0
sudo apt-get update

Install the following FreeRADIUS packages.

sudo apt-get install freeradius freeradius-mysql freeradius-utils

Import the freeradius MySQL database scheme:

sudo su -
mysql -u root -p radius < /etc/freeradius/3.0/mods-config/sql/main/mysql/schema.sql

Check tables created:

$ mysql -u root -p -e "use radius;show tables;"
Enter password: 
+------------------+
| Tables_in_radius |
+------------------+
| nas              |
| radacct          |
| radcheck         |
| radgroupcheck    |
| radgroupreply    |
| radpostauth      |
| radreply         |
| radusergroup     |
+------------------+

Create a soft link for sql module under /etc/freeradius/3.0/mods-enabled/

sudo ln -s /etc/freeradius/3.0/mods-available/sql /etc/freeradius/3.0/mods-enabled/

Configure SQL module and change the database connection parameters to suit your environment.

sudo vim /etc/freeradius/3.0/mods-enabled/sql

Your sql section should look similar to below.

sql {
driver = "rlm_sql_mysql"
dialect = "mysql"

# Connection info:
server = "localhost"
port = 3306
login = "radius"
password = "radiuspassword"

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

Then change group right of /etc/freeradius/3.0/mods-enabled/sql

sudo chgrp -h freerad /etc/freeradius/3.0/mods-available/sql
sudo chown -R freerad:freerad /etc/freeradius/3.0/mods-enabled/sql

Restart freeradius service:

sudo systemctl restart freeradius.service

Install and Configure Daloradius on Ubuntu 18.04 / 16.04

We need to install Daloradius to get FreeRADIUS web administration interface.

wget https://github.com/lirantal/daloradius/archive/master.zip
unzip master.zip
mv daloradius-master daloradius

Change directory for configuration

cd daloradius

Configuring daloradius

  • Now import Daloradius mysql tables
mysql -u root -p radius < contrib/db/fr2-mysql-daloradius-and-freeradius.sql 
mysql -u root -p radius < contrib/db/mysql-daloradius.sql
  • Configure daloRADIUS database connection details:
cd ..
sudo mv daloradius /var/www/html/

Then change permissions for http folder and set the right permissions for the daloradius configuration file.

sudo chown -R www-data:www-data /var/www/html/daloradius/
sudo chmod 664 /var/www/html/daloradius/library/daloradius.conf.php

You should now modify the filedaloradius.conf.php to adjust the MySQL database information. Open the daloradius.conf.php and add the database username, password and db name.

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

Especially relevant variables to configure are:

$configValues['CONFIG_DB_HOST'] = 'localhost';
$configValues['CONFIG_DB_PORT'] = '3306';
$configValues['CONFIG_DB_USER'] = 'radius';
$configValues['CONFIG_DB_PASS'] = 'radiuspassword';
$configValues['CONFIG_DB_NAME'] = 'radius';

To be sure everything works, restart freeradius and apache2

sudo systemctl restart freeradius.service apache2

Open Admin link using your system IP address or domain name:

http://ip-address/daloradius/login.php

A page like this will appear:

Default login details are:

Username: administrator
Password: radius

Change the password after first login.

Read more on daloRADIUS Configurations