Radius Servers Installation Guide (FreeRADIUS + Ubuntu + MySQL)

To install FreeRADIUS on Ubuntu and do some basic testings, you should follow the steps below:
1)     Install lamp-server: 
Actually, install MySQL and PHP are enough already. But to make sure that there are no dependencies errors later,
I prefer installing the whole      package (lamp-server stands for Linux-Apache-MySQL-PHP server).
We install lamp-server using the command below:
sudo tasksel install lamp-server
(you will need to enter root password, which is “setupRADIUS” by default, to continue the installation)
2)     Install freeradius package
sudo apt-get install freeradius
(Enter password when asked. When you are asked to continue, type ‘y’, then press Enter)
3)     Install freeradius with ldap authentication
sudo apt-get install freeradius-ldap
4)     Install freeradius to run with mysql
sudo apt-get install freeradius-mysql
5)     After finishing the above installations, restart the FreeRADIUS service
sudo /etc/init.d/freeradius restart
6)     Now, you can test the Radius Server using radtest, the command will be as below:

At this stage, you will get an error as follow:

If that’s the case, you can do the steps in part II.1/ to fix the error. The correct result should be as follow:

7)     Now, we create the database for FreeRADIUS and an user account which will be used by FreeRADIUS to access into database. We run the following command:

  • Login MySQL Database

(Enter the password for root user)

  • Then you can create user, database, and set permissions as follow:

8)     Then, you copy the folder sql (comes along with this document in the folder “necessary setup files”) into the folder /etc/freeradius/

9)     Import current schema of the database for FreeRADIUS into the “radius” database (the current Radius database schema for our project can be found in the file radius.sql, which comes along with this document in the folder “necessary setup files”)

10)    Configure the file /etc/freeradius/sites-enabled/default so that the FreeRADIUS can startup, creates a default virtual host, and connects to MySQL Database. We follow the below steps:
Run the command:
sudo gedit /etc/freeradius/sites-enabled/default
In the file “default”, you check if the following settings are correct or not (the settings in the below pictures are correct settings):
In the authorize{} module

(uncomment the sql setting)
In the accounting{} module

In the session{} module

In the post-auth{} module

11)    Now, we configure the “radiusd.conf”. This file contains general settings for the Radius Server. We follow the below steps:
sudo gedit /etc/freeradius/radiusd.conf
Then, we check if the settings in the file radiusd.conf are correct or not.
The port for radius server to listen for authentication request is 1812

Port for accounting is 1813

Some settings for logging username, password, etc

12)    Now, we configure the file “sql.conf”. This file contains information about how to connect to database, database tables that are used by the FreeRADIUS server, etc
Run the command:
sudo gedit /etc/freeradius/sql.conf
Then, you should check the following settings:

Check the setting that allow FreeRADIUS to read Radius Clients from database

In the module modules{}

13)    Now, you clear all contents in the file /etc/freeradius/clients.conf because when radius server start running, it will read Radius Clients from both clients.conf and database (current settings). So, we clear the file clients.conf so that radius server only load Radius Clients from database (and to avoid conflicts like clients.conf and database contain the same Radius Client)
14)    Now, the installation is finished. You can start using the Radius Server.
PS: sorry,the files about “necessary setup files” are some sql files,which are used to the sql table of the our project.
you just create table you used in MYSQL access.
ที่มา: http://www.mydeveloperblog.com/linux-tutorial/radius/radius-servers-installation-guide-freeradius-ubuntu-mysql/