Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| install_22_4 [2024/02/08 16:21] – [Performance tune Nginx] system | install_22_4 [2026/08/16 10:26] (current) – system | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | <nav type=" | ||
| + | * [[: | ||
| + | * [[: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| ====== Installation of RADIUSdesk on Ubuntu 22.04 with Nginx ====== | ====== Installation of RADIUSdesk on Ubuntu 22.04 with Nginx ====== | ||
| ===== Skills required for the installation ===== | ===== Skills required for the installation ===== | ||
| Line 11: | Line 18: | ||
| * Nginx is a web server that seems to have overtaken Apache in terms of popularity and number of active websites on the Internet. | * Nginx is a web server that seems to have overtaken Apache in terms of popularity and number of active websites on the Internet. | ||
| - | * It is new, lightweight, | + | * It is new, lightweight, |
| * Nginx is the new Apache so to speak. | * Nginx is the new Apache so to speak. | ||
| * This section describes the steps you need to take to get RADIUSdesk up and running with a LEMP stack on Ubuntu 22.04 | * This section describes the steps you need to take to get RADIUSdesk up and running with a LEMP stack on Ubuntu 22.04 | ||
| Line 17: | Line 24: | ||
| <alert type=" | <alert type=" | ||
| - | * We recently switched from CakePHPv3 to CakePHPv4. | + | * We **(not so recently)** switched from CakePHPv3 to CakePHPv4. |
| - | * If you manage devices with MESHdesk and APdesk, make sure you also run the instructions that include cake3 so that your system is backwards compatible. | + | * If you manage devices with MESHdesk and APdesk, make sure you also run the instructions that include cake3 so that your system is backwards compatible. |
| * The firmware on these devices may still point to the cake3 directory, so we need to include support for this directory. | * The firmware on these devices may still point to the cake3 directory, so we need to include support for this directory. | ||
| </ | </ | ||
| Line 26: | Line 33: | ||
| ===== What we need ===== | ===== What we need ===== | ||
| - | *A standard Nginx installation on Ubuntu is actually very simple. | + | * A standard Nginx installation on Ubuntu is actually very simple. |
| - | * The more complicated part is customizing Nginx for the following tasks: | + | * The more complicated part is customizing Nginx for the following tasks: |
| <panel type=" | <panel type=" | ||
| Line 157: | Line 164: | ||
| === php-fpm === | === php-fpm === | ||
| * The default installation of Nginx does not support serving .php files. | * The default installation of Nginx does not support serving .php files. | ||
| - | * We will install a program (actually a service) called **php-fpm**. | + | * We will install a program (actually a service) called **php-fpm**. |
| * This service waits for requests for interpretation. | * This service waits for requests for interpretation. | ||
| - | * Install the php-fpm service | + | * Since Ubuntu 22.04 is quite dated by now, we can not use the standard |
| + | * RADIUSdesk' | ||
| + | * We will add an external, well maintained, repository from which we will install PHP 8.3. | ||
| + | * PHP 8.3 is the default version on Ubuntu 24.04, so it keeps things predictable and according to a convention. | ||
| <code bash> | <code bash> | ||
| - | sudo apt-get -y install php-fpm | + | sudo apt update && sudo apt upgrade |
| - | sudo systemctl enable php8.1-fpm | + | sudo apt install |
| - | sudo systemctl start php8.1-fpm | + | sudo add-apt-repository ppa:ondrej/php -y |
| + | sudo apt install php8.3 -y | ||
| + | sudo apt install php8.3-fpm | ||
| + | sudo systemctl enable php8.3-fpm | ||
| + | sudo systemctl start php8.3-fpm | ||
| </ | </ | ||
| Line 177: | Line 191: | ||
| index index.php index.html index.htm index.nginx-debian.html; | index index.php index.html index.htm index.nginx-debian.html; | ||
| </ | </ | ||
| - | * Enable PHP processing by leaving this section uncommented. Note that we are using the UNIX socket and that we are using 8.1 and not 7.4, which was originally specified in the configuration file. | + | * Enable PHP processing by leaving this section uncommented. Note that we are using the UNIX socket and that we are using 8.3 and not 7.4, which was originally specified in the configuration file. |
| <code bash> | <code bash> | ||
| # Pass PHP scripts to FastCGI server | # Pass PHP scripts to FastCGI server | ||
| Line 185: | Line 199: | ||
| # | # | ||
| # # With php-fpm (or other unix sockets): | # # With php-fpm (or other unix sockets): | ||
| - | fastcgi_pass unix:/ | + | fastcgi_pass unix:/ |
| # # With php-cgi (or other tcp sockets): | # # With php-cgi (or other tcp sockets): | ||
| # | # | ||
| Line 225: | Line 239: | ||
| <code bash> | <code bash> | ||
| - | sudo apt-get -y install mariadb-server php8.1-mysql | + | sudo apt-get -y install mariadb-server php8.3-mysql |
| sudo systemctl enable mariadb | sudo systemctl enable mariadb | ||
| sudo systemctl restart mariadb | sudo systemctl restart mariadb | ||
| Line 242: | Line 256: | ||
| sql_mode=IGNORE_SPACE, | sql_mode=IGNORE_SPACE, | ||
| </ | </ | ||
| - | | + | === Enable the Event Scheduler === |
| + | * MariaDB and MySQL has a built in Event Scheduler (like CRON for a database) which is disabled by default. | ||
| + | * We make use of this feature to automatically optimize some of the database tables. | ||
| + | * We will enable the Event Scheduler in MariaDB by creating a new file / | ||
| + | <code bash> | ||
| + | sudo vi / | ||
| + | </ | ||
| + | * Enter these two lines: | ||
| + | <code bash> | ||
| + | [mysqld] | ||
| + | event_scheduler=on | ||
| + | </ | ||
| + | | ||
| + | * Restart | ||
| <code bash> | <code bash> | ||
| sudo systemctl restart mariadb | sudo systemctl restart mariadb | ||
| + | </ | ||
| + | * You can confirm that it is now enabled by checking the following from the SQL terminal: | ||
| + | <code bash> | ||
| + | sudo mysql -u root | ||
| + | MariaDB [(none)]> | ||
| + | +-----------------+-------+ | ||
| + | | Variable_name | ||
| + | +-----------------+-------+ | ||
| + | | event_scheduler | ON | | ||
| + | +-----------------+-------+ | ||
| + | 1 row in set (0.001 sec) | ||
| </ | </ | ||
| Line 254: | Line 292: | ||
| sudo vi / | sudo vi / | ||
| </ | </ | ||
| - | * Add the following | + | * Add the following |
| <code bash> | <code bash> | ||
| location ~ ^/ | location ~ ^/ | ||
| Line 264: | Line 302: | ||
| } | } | ||
| </ | </ | ||
| - | * Add below only if you require backward compatibility (MESHdesk and APdesk). | + | * Only add the following information |
| <code bash> | <code bash> | ||
| location ~ ^/ | location ~ ^/ | ||
| Line 285: | Line 323: | ||
| * RADIUSdesk consists of three components. | * RADIUSdesk consists of three components. | ||
| * **rd** directory with its contents contains all the HTML and JavaScript code and is used as the presentation layer. | * **rd** directory with its contents contains all the HTML and JavaScript code and is used as the presentation layer. | ||
| - | * **cake4** is a CakePHPv4 application and can be considered the engine room. Here the data is processed before | + | * **cake4** is a CakePHPv5 (used to be CakePHPv4) application and can be considered the engine room. This is where the data is processed before |
| - | * **login** is a directory with various login pages which are centrally | + | * **login** is a directory with various login pages that are managed |
| - | * Later we will create various symbolic links from locations | + | * Later we will create various symbolic links from locations |
| === Required packages === | === Required packages === | ||
| - | * Make sure the following packages are installed. | + | * Make sure that the following packages are installed. |
| <code bash> | <code bash> | ||
| - | sudo apt-get -y install | + | sudo apt-get -y install |
| - | sudo systemctl restart php8.1-fpm | + | sudo systemctl restart php8.3-fpm |
| </ | </ | ||
| - | * Check out the **rdcore** git repository. | + | * Check out the **rdcore** git repository. |
| <code bash> | <code bash> | ||
| cd /var/www | cd /var/www | ||
| sudo git clone https:// | sudo git clone https:// | ||
| </ | </ | ||
| - | * This will create an **rdcore** directory | + | * This will create an **rdcore** directory |
| + | * Check out the CakePHPv5 API back-end application | ||
| + | <code bash> | ||
| + | cd /var/www | ||
| + | sudo git clone https:// | ||
| + | </ | ||
| * It is recommended that you also include the RD Mobile UI. | * It is recommended that you also include the RD Mobile UI. | ||
| * Check out the **rd_mobile** git repository. | * Check out the **rd_mobile** git repository. | ||
| Line 308: | Line 351: | ||
| </ | </ | ||
| - | === Create | + | === Create |
| * We will create softlinks in the directory where Nginx provides the RADIUSdesk content. | * We will create softlinks in the directory where Nginx provides the RADIUSdesk content. | ||
| <code bash> | <code bash> | ||
| cd / | cd / | ||
| sudo ln -s ../ | sudo ln -s ../ | ||
| - | sudo ln -s ../rdcore/ | + | sudo ln -s ../rd_cake5 |
| #If backward compatibility is required for older firmware of MESHdesk | #If backward compatibility is required for older firmware of MESHdesk | ||
| - | sudo ln -s ../rdcore/ | + | sudo ln -s ../rd_cake5 |
| sudo ln -s ../ | sudo ln -s ../ | ||
| sudo ln -s ../ | sudo ln -s ../ | ||
| - | sudo ln -s ../rdcore/ | + | sudo ln -s ../rd_cake5/ |
| #For the RD Mobile UI | #For the RD Mobile UI | ||
| sudo ln -s ../ | sudo ln -s ../ | ||
| Line 324: | Line 367: | ||
| === Change ownership === | === Change ownership === | ||
| - | * Change the ownership of the following files to www-data so Nginx can make changes to the files/ | + | * Change the ownership of the following files to www-data so that Nginx can make changes to the files/ |
| <code bash> | <code bash> | ||
| sudo mkdir -p / | sudo mkdir -p / | ||
| Line 339: | Line 382: | ||
| </ | </ | ||
| - | === The Database | + | === The database |
| * Make sure that the time zone on the server is set to UTC | * Make sure that the time zone on the server is set to UTC | ||
| * Fill the time zone data in the DB | * Fill the time zone data in the DB | ||
| <code bash> | <code bash> | ||
| - | #NOTE FAILING THIS STEP will break the RADIUS graphs | + | #NOTE FAILING |
| - | #There might be some error messages in the output which is fine - no need to be alarmed | + | #Some error messages |
| sudo su | sudo su | ||
| mysql_tzinfo_to_sql / | mysql_tzinfo_to_sql / | ||
| Line 365: | Line 408: | ||
| <alert type=" | <alert type=" | ||
| * RADIUSdesk is under active development and sometimes we add SQL patches. | * RADIUSdesk is under active development and sometimes we add SQL patches. | ||
| - | * The SQL patches are located | + | * The SQL patches are located |
| * These patches are non-destructive and you can run them against the database | * These patches are non-destructive and you can run them against the database | ||
| - | * See the sample | + | * See the example |
| <code bash> | <code bash> | ||
| - | sudo mysql -u root rd < /var/www/rdcore/ | + | sudo mysql -u root rd < /var/www/html/ |
| + | </ | ||
| + | * Some of these patches may add new columns to existing database tables. In this case, it is recommended to clear the CakePHP models (tables) cache to ensure that the latest changes are also applied there: | ||
| + | <code bash> | ||
| + | sudo su | ||
| + | cd / | ||
| + | rm * | ||
| + | exit | ||
| </ | </ | ||
| </ | </ | ||
| - | |||
| === Configure Nginx === | === Configure Nginx === | ||
| - | * Configure Nginx to rewrite some RdCore URLs starting | + | * Configure Nginx to rewrite some RdCore URLs that start with /// |
| * Edit /// | * Edit /// | ||
| <code bash> | <code bash> | ||
| sudo vi / | sudo vi / | ||
| </ | </ | ||
| - | * Add this once section directly | + | * Insert |
| <code bash> | <code bash> | ||
| server_name _; | server_name _; | ||
| Line 388: | Line 437: | ||
| } | } | ||
| </ | </ | ||
| - | * If you need backward compatibility | + | * If you need support for backward compatibility (MESHdesk and APdesk), add this section |
| <code bash> | <code bash> | ||
| location / | location / | ||
| Line 394: | Line 443: | ||
| } | } | ||
| </ | </ | ||
| - | * Add the following configuration block inside | + | * Insert |
| <code bash> | <code bash> | ||
| location / | location / | ||
| Line 401: | Line 450: | ||
| } | } | ||
| </ | </ | ||
| - | * If you need backward compatibility | + | * If you need support for backward compatibility (MESHdesk and APdesk), add this section |
| <code bash> | <code bash> | ||
| location / | location / | ||
| Line 414: | Line 463: | ||
| === Important URLs === | === Important URLs === | ||
| - | * The following URLs are important to reach the UI | + | * The following URLs are important to reach the user interface |
| - | * To load the optimized | + | * To load the optimized |
| - | * If you want to serve the content directly | + | * If you want to deliver |
| <code bash> | <code bash> | ||
| sudo cp -R / | sudo cp -R / | ||
| Line 422: | Line 471: | ||
| * To load the RD Mobile UI, go to http:// | * To load the RD Mobile UI, go to http:// | ||
| - | == Login Credentials | + | == Login credentials |
| * By default you can log in with the following credentials | * By default you can log in with the following credentials | ||
| Username: **root** Password: **admin** | Username: **root** Password: **admin** | ||
| Line 432: | Line 481: | ||
| * To activate the cron scripts, execute the following command, which adds the **RADIUSdesk** cron scripts to the cron system | * To activate the cron scripts, execute the following command, which adds the **RADIUSdesk** cron scripts to the cron system | ||
| <code bash> | <code bash> | ||
| - | sudo cp / | + | sudo cp / |
| </ | </ | ||
| * If you want to change the default intervals at which the scripts are executed, simply edit the file / | * If you want to change the default intervals at which the scripts are executed, simply edit the file / | ||
| ===== Add LETSENCRYPT certificate ===== | ===== Add LETSENCRYPT certificate ===== | ||
| - | * Instead of repeating the existing documentation, | + | * Instead of repeating the existing documentation, |
| - | * You may want to do the following first before following | + | * Before you follow |
| <code bash> | <code bash> | ||
| sudo apt-get update | sudo apt-get update | ||
| Line 446: | Line 494: | ||
| * https:// | * https:// | ||
| ===== Next steps ===== | ===== Next steps ===== | ||
| - | * Be sure to also install **FreeRADIUS** | + | * Make sure that you also install **FreeRADIUS**. |
| * [[install_22_4_freeradius|Install FreeRADIUS]] | * [[install_22_4_freeradius|Install FreeRADIUS]] | ||