Skip to content

Installing RdCore on Ubuntu 20.04

Dirk van der Walt edited this page Sep 1, 2022 · 3 revisions

Introduction

  • The previous section prepared everything to install RdCore. This section will go through the steps to install the latest version of RdCore.
  • RdCore consists of four directories
    • rd directory which contains all the HTML and JavaScript code and is used as the presentation layer for RdCore.
    • cake4 is a CakePHP v4 application and can be considered the engine room. Here the data is processed before being presented by the presentation layer.
    • login is a directory with various login pages which are centrally managed through the RdCore Dynamic Login Pages applet. Although this is optional, it is used by most installs.
    • AmpConf is a directory containing the Auto Captive Portal's login page which is used to attach a device to a mesh.
  • Later we will create various symbolic links from locations inside RdCore to locations inside the web server's document root directory.
  • We will use git to check out the latest version of RdCore.

Required packages

  • Make sure the following packages are installed:
sudo apt-get -y install php-cli php-mysql php-gd php-curl php-xml php-mbstring php-intl git wget
  • Check out the RdCore git repository.
cd /var/www
sudo git clone https://github.com/RADIUSdesk/rdcore.git
# Supply your gitlab username and password
  • This will create an rdcore directory containing some sub-folders.

Create soft links

  • We will create soft links in the directory where Nginx will serve the RdCore contents.
cd /var/www/html
sudo ln -s ../rdcore/rd ./rd
sudo ln -s ../rdcore/cake4 ./cake4
sudo ln -s ../rdcore/login ./login
sudo ln -s ../rdcore/AmpConf/build/production/AmpConf ./conf_dev
sudo ln -s ../rdcore/login/rd_client/build/production/AmpConf ./usage
sudo ln -s ../rdcore/cake4/rd_cake/setup/scripts/reporting ./reporting

Change Ownerships

  • Change the ownership of the following files to www-data so Nginx can make changes to the files/directories
# For CakePHP3
sudo mkdir -p  /var/www/html/cake4/rd_cake/logs
sudo mkdir -p /var/www/html/cake4/rd_cake/webroot/files/imagecache
sudo mkdir -p /var/www/html/cake4/rd_cake/tmp
sudo chown -R www-data. /var/www/html/cake4/rd_cake/tmp
sudo chown -R www-data. /var/www/html/cake4/rd_cake/logs
sudo chown -R www-data. /var/www/html/cake4/rd_cake/webroot/img/realms
sudo chown -R www-data. /var/www/html/cake4/rd_cake/webroot/img/dynamic_details
sudo chown -R www-data. /var/www/html/cake4/rd_cake/webroot/img/dynamic_photos
sudo chown -R www-data. /var/www/html/cake4/rd_cake/webroot/img/access_providers
sudo chown -R www-data. /var/www/html/cake4/rd_cake/webroot/img/hardwares
sudo chown -R www-data. /var/www/html/cake4/rd_cake/webroot/files/imagecache

The Database

  • Make sure the timezone on the server is set to UTC
  • Populate the timezone data on the DB
#NOTE FAILING THIS STEP will break the RADIUS graphs
sudo su
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root  mysql
  • Create an empty database called rd
sudo su
mysql -u root
CREATE DATABASE rd;
GRANT ALL PRIVILEGES ON rd.* to 'rd'@'127.0.0.1' IDENTIFIED BY 'rd';
GRANT ALL PRIVILEGES ON rd.* to 'rd'@'localhost' IDENTIFIED BY 'rd';
FLUSH PRIVILEGES;
exit;
  • Populate the database:
sudo mysql -u root rd < /var/www/html/cake4/rd_cake/setup/db/rd.sql
  • Configure Nginx to rewrite some RdCore URLs starting with /cake4/rd_cake.
  • Edit /etc/nginx/sites-enabled/default
sudo vi /etc/nginx/sites-enabled/default
  • Add this once section directly below server_name item. (This is so that this rule is 'hit' first for the reporting side. We do not use CakePHP for the reporting anymore due to performance issues.
server_name _;

location /cake4/rd_cake/node-reports/submit_report.json {
    try_files $uri $uri/ /reporting/reporting.php;
}
  • Add the following configuration block inside the server section (This you can add towards the end):
location /cake4/rd_cake {
   rewrite ^/cake4/rd_cake(.+)$ /cake4/rd_cake/webroot$1 break;
   try_files $uri $uri/ /cake4/rd_cake/index.php$is_args$args;
}
  • Reload the Nginx:
sudo systemctl reload nginx

Important URLs

sudo cp -R /var/www/html/rd/build/production/Rd/* /var/www/html/

Login Credentials

  • By default you can log in with the following credentials

Username: root Password: admin

Install RdCore Cron Scripts

  • RdCore requires a few scripts to run periodically in order to maintain a healthy and working system.
  • To install and activate the cron scripts, run the following command:
sudo cp /var/www/html/cake4/rd_cake/setup/cron/cron4 /etc/cron.d/
  • If you want to change the default intervals at which the scripts get executed, just edit the /etc/cron.d/cron4 file.

Add LETSENCRYPT certificate

  • Rather than repeating existing documentation we will just add a URL with the instructions to do it.
  • You might want to run the following first before going to the instructions in the URL
sudo apt-get update
sudo apt-get -y install software-properties-common

Next Steps