-
-
Save LinuxPreacher/345ed35a5d17cd3ccbe0c583de9dfa66 to your computer and use it in GitHub Desktop.
How to Install FreeRADIUS and daloRADIUS on Ubuntu 18.04 LTS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
apt-get update -y | |
apt-get upgrade -y | |
#Install Apache | |
sudo apt-get install apache2 | |
#Install PHP | |
sudo apt-get install php libapache2-mod-php php-gd php-common php-mail php-mail-mime php-mysql php-pear php-db php-mbstring php-xml php-curl | |
#Install MariaDB | |
sudo apt -y install mariadb-server mariadb-client | |
#Configure Database for FreeRADIUS | |
mysql_secure_installation | |
Enter current password for root (enter for none): Just press the Enter | |
Set root password? [Y/n]: Y | |
New password: Enter password | |
Re-enter new password: Repeat password | |
Remove anonymous users? [Y/n]: Y | |
Disallow root login remotely? [Y/n]: Y | |
Remove test database and access to it? [Y/n]: Y | |
Reload privilege tables now? [Y/n]: Y | |
mysql -u root -p | |
CREATE DATABASE radius CHARACTER SET UTF8 COLLATE UTF8_BIN; | |
CREATE USER 'radius'@'%' IDENTIFIED BY 'G@s%w&rJ'; | |
GRANT ALL PRIVILEGES ON radius.* TO 'radius'@'%'; | |
QUIT; | |
#Install FreeRADIUS | |
sudo apt policy freeradius | |
sudo apt -y install freeradius freeradius-mysql freeradius-utils | |
#Once installed, import the freeradius MySQL database schema with the following command: | |
sudo su - | |
mysql -u root -p radius < /etc/freeradius/3.0/mods-config/sql/main/mysql/schema.sql | |
sudo mysql -u root -p -e "use radius;show tables;" | |
#Create a soft link for sql module under | |
sudo ln -s /etc/freeradius/3.0/mods-available/sql /etc/freeradius/3.0/mods-enabled/ | |
#Make the following changes as per your database: | |
nano /etc/freeradius/3.0/mods-enabled/sql | |
sql { | |
driver = "rlm_sql_mysql" | |
dialect = "mysql" | |
# Connection info: | |
server = "localhost" | |
port = 3306 | |
login = "radius" | |
password = "G@s%w&rJ" | |
# Database table configuration for everything except Oracle | |
radius_db = "radius" | |
} | |
read_clients = yes | |
client_table = "nas" | |
#Save and close | |
#Set the proper permission | |
sudo chgrp -h freerad /etc/freeradius/3.0/mods-available/sql | |
sudo chown -R freerad:freerad /etc/freeradius/3.0/mods-enabled/sql | |
systemctl restart freeradius | |
systemctl status freeradius | |
#Install daloRADIUS | |
sudo apt -y install wget unzip | |
wget https://github.com/lirantal/daloradius/archive/master.zip | |
unzip master.zip | |
mv daloradius-master daloradius | |
cd daloradius | |
#Configuring daloradius | |
sudo mysql -u root -p radius < contrib/db/fr2-mysql-daloradius-and-freeradius.sql | |
sudo mysql -u root -p radius < contrib/db/mysql-daloradius.sql | |
cd .. | |
sudo mv daloradius /var/www/html/ | |
sudo chown -R www-data:www-data /var/www/html/daloradius/ | |
sudo chmod 664 /var/www/html/daloradius/library/daloradius.conf.php | |
sudo nano /var/www/html/daloradius/library/daloradius.conf.php | |
#Make the following changes that match your database: | |
nano /var/www/html/daloradius/library/daloradius.conf.php | |
$configValues['CONFIG_DB_HOST'] = 'localhost'; | |
$configValues['CONFIG_DB_PORT'] = '3306'; | |
$configValues['CONFIG_DB_USER'] = 'radius'; | |
$configValues['CONFIG_DB_PASS'] = 'Str0ngR@diusPass'; | |
$configValues['CONFIG_DB_NAME'] = 'radius'; | |
sudo systemctl restart freeradius.service apache2 | |
#Visit: | |
http://localhost/daloradius/login.php | |
Username: administrator | |
Password: radius |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment