Configure FreeRADIUS to use MySQL installed by HomeBrew
Alan DeKok
aland at deployingradius.com
Wed Dec 4 15:29:28 UTC 2024
On Dec 4, 2024, at 10:18 AM, Hao Fu <h.fu at orb-connect.com> wrote:
> Hello. I'm new to FreeRADIUS. I am configuring FreeRADIUS to use the database in MySQL instead of the text files, so it's easier to manage.
>
> I installed FreeRADIUS by Homebrew using "brew install freeradius-server". The Current version is 3.2.6_2. I tested it using radtest and got the "Access-Accept".
That's good.
> The MySQL is also installed by Homebrew using "brew install MySQL". The current version is 9.0.1. I created the database "radius" and the default schema for it.
>
> Then I modified the radiusd.conf and mods-available/sql files to connect to the MySQL server as suggested in guide/SQL HOWTO: Configuring FreeRADIUS to use SQL. I didn't change anything in sites-available/default and inner-tunnel as the lines containing 'sql' are already uncommented (although they are in the form of '-sql').
>
> Trying to fire up the server by "radius -X" got me this error:
> ...
> Could not link driver rlm_sql_mysql: dlopen(/opt/homebrew/Cellar/freeradius-server/3.2.6_2/lib/rlm_sql_mysql.dylib, 0x0006): tried: '/opt/homebrew/Cellar/freeradius-server/3.2.6_2/lib/rlm_sql_mysql.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/freeradius-server/3.2.6_2/lib/rlm_sql_mysql.dylib' (no such file), '/opt/homebrew/Cellar/freeradius-server/3.2.6_2/lib/rlm_sql_mysql.dylib' (no such file)
> Make sure it (and all its dependent libraries!) are in the search path of your system's ld
> /opt/homebrew/Cellar/freeradius-server/3.2.6_2/etc/raddb/mods-available/sql[27]: Instantiation failed for module "sql"
Yes. The Homebrew package doesn't install any of the SQL drivers for FreeRADIUS.
See: https://github.com/Homebrew/homebrew-core/blob/master/Formula/f/freeradius-server.rb
That file doesn't install MySQL, and doesn't include any of the FreeRADIUS SQL drivers.
You'll have to install the server from source. This also means installing the MySQL development headers. Maybe Homebrew has a package for that.
Perhaps we can look into pre-built packages for OSX. I do all development on OSX, so it definitely works. But OSX packaging is sometimes a bit of a pain.
Alan DeKok.
More information about the Freeradius-Users
mailing list