In particular, this connection comes about after negotiations at the network layer. Negotiation involves a series of activities including querying and exchanging packets with the correct information, such as B. Identification data and authentication port numbers. The result is that the RADIUS protocol provides account information, authentication, and authorization from authentication servers to the respective devices requesting access.
FreeRADIUS is the most popular free and open source implementation of this protocol. It refers to the Radius server. However, it’s important to note that there are other open-source implementations of the RADIUS protocol — and dolaRADIUS is another handy one example.
This tutorial describes how to install and use FreeRADIUS on Ubuntu 22.04. It also shows how to configure FreeRADIUS with MySQL. Let’s go!
How to install FreeRADIUS on Ubuntu 22.04 and configure it with MySQL
Ideally, FreeRADIUS supports all three main functions of the RADIUS protocol. Also, it can do this by supporting the different databases that are commonly used for different accounts. Databases include PostgreSQL, Oracle Database, MariaDB/MySQL, and Microsoft SQL Server, among others.
This step-by-step guide focuses on configuring FreeRADIUS with MariaDB/MySQL. You need to do the following steps:
Step 1: Confirm if your system meets all the requirements
Confirm that your system meets the following requirements;
1. A Linux server is running Ubuntu 22.04. It is important to note that this operation is possible with a server running a recent Ubuntu 20.04. Operating system aside, the process will be more efficient if your device has at least 300 MB of free disk space and 512 RAM.
If your device is running on the latest Ubuntu 22.04 or 20.04, you can update your system with the following command:
You can update your Ubuntu operating system with the following command to get the necessary packages. Note that you can also run these two commands at the same time.
2. Again, you can only perform this operation if you are a user of sudo privileges. Therefore, you must log in as non-root sudo User. Logging in as root user might harm your system as the system won’t question your operations.
Step 2: Install the relevant components
Some components are integral to this process. And among the components is a group of open source software used to build websites and web applications. Together they are called LAMP (Linux, Apache, MySQL, PHP) stack. And since we already have a Linux server, we will install ApacheMariaDB/MySQL and PHP as shown below:
1. Install the Apache web server
You can install Apache with the following command:
After successful installation, proceed to enable the service by starting it and enabling it at the same time with the following commands:
Finally add the Apache Service in the rules of your firewall. The firewall can block that Apache Service when you don’t have it. The following command helps:
2. Install MySQL/MariaDB
Another component you need to install before proceeding is MariaDB. It’s a drop-in alternative for MySQL. Although there are some differences between the two databases, they perform the same function. For this illustration we will use the MySQL database and install it with the following command:
After installation, proceed to set your password. If you want to set your password, the following command should help achieve a more secure installation:
The previous command prompts you to enter your current MySQL root password. Follow the prompts by pressing ENTER and setting your new root MySQL password. A plugin will ask you to validate your password and confirm whether you want to continue with the password or use a different one. Specifically, there are up to three levels of character strength based on length, characters, and case used.
3. Install PHP and related modules
Proceed to confirm the downloaded PHP version with the following command:
The installation process should provide PHP8 since PHP-7 is available in most Ubuntu versions.
Step 3: Install FreeRADIUS
FreeRADIUS requires two modules for a successful installation. Therefore, you should install the protocol together with the modules. The modules are the freeradius-mysql and the freeradius-utils. The former enables RADIUS to handle the accounting and authentication aspects of MySQL, while the latter adds other useful utilities to the protocol.
This command will help to install both modules:
Step 4: Test your FreeRADIUS server
In particular, FreeRADIUS runs automatically upon installation. However, you can verify that the FreeRADIUS server is running correctly by running it in debug mode. The first thing you need to do is stop the FreeRADIUS server with the following command:
It’s now time to run it in debug mode with the following command:
The result of the previous command should look like below:
After you have tested the functionality of the FreeRADIUS server, exit debug mode. You can reach this step by pressing Ctrl + C. Enable the FreeRADIUS protocol with the following command and proceed:
Step 5: Allow FreeRADIUS on UFW Firewall
The UFW firewall can restrict the ports used by FreeRADIUS. Make sure you set your firewall to allow FreeRADIUS with the following utilities:
Step 6: Configure FreeRADIUS for MySQL
Finally, configure FreeRADIUS to use the MySQL database. You can achieve this by accessing the MySQL console as the root user before following the prompts to change your credentials accordingly. This utility will help you access the MySQL console.
I hope that through this article you have the FreeRADIUS protocol installed and configured to use MySQL on Ubuntu 22.04 or 20.04 machines. Contact us if you encounter any problems during the installation process.