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/07 17:45] – [Next steps] system | install_22_4 [2024/09/19 10:20] (current) – [Install MariaDB] system | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <nav type=" | ||
+ | * [[: | ||
+ | * [[: | ||
+ | </ | ||
- | ====== | + | ---- |
+ | |||
+ | ====== | ||
===== Skills required for the installation ===== | ===== Skills required for the installation ===== | ||
To install RADIUSdesk, you need sufficient knowledge and experience with Linux: | To install RADIUSdesk, you need sufficient knowledge and experience with Linux: | ||
* Installing the Linux operating system. | * Installing the Linux operating system. | ||
- | * Edit text files from the terminal | + | * Editing |
- | * Install | + | * Installing |
* You must be familiar with how TCP/IP networks work. | * You must be familiar with how TCP/IP networks work. | ||
Line 20: | Line 26: | ||
* We recently switched from CakePHPv3 to CakePHPv4. | * We 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 | + | * The firmware on these devices |
</ | </ | ||
- | |||
----------- | ----------- | ||
- | + | ===== What we need ===== | |
- | ===== What do 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 customising | + | * The more complicated part is customizing |
<panel type=" | <panel type=" | ||
^ Requirement | ^ Requirement | ||
| Interpreting PHP scripts | | Interpreting PHP scripts | ||
- | | Access | + | | Accessing |
- | | Change the expiration date of HTTP headers to encourage caching. | We want files that do not change (e.g. CSS or images) to be cached on the client side to make the client | + | | Change the expiration date of the HTTP headers to encourage caching. | We want files that do not change (e.g. CSS or images) to be cached on the client side to make the experience more pleasant |
- | | Compress the text before it is served | + | | Compress the text before it is sent to the client. | We can compress the text that flows between the client and the server and in this way reduce the number of bytes transmitted over the wire, which in turn should provide a more pleasant experience for the client | |
| Enable rewrite rules in CakePHP for pretty URLs | CakePHP uses the .htaccess files in Apache to enable pretty URLs. Since Nginx does not support .htaccess files, we need to modify Nginx to behave the same way. | | | Enable rewrite rules in CakePHP for pretty URLs | CakePHP uses the .htaccess files in Apache to enable pretty URLs. Since Nginx does not support .htaccess files, we need to modify Nginx to behave the same way. | | ||
Line 52: | Line 56: | ||
- | + | ==== Adding | |
- | + | * We assume that you have a clean installation of Ubuntu 22.04 WITHOUT Apache | |
- | + | ||
- | ==== Add a sudo user ==== | + | |
- | * We assume that you have installed | + | |
* If you have not yet added a sudo user add one now. | * If you have not yet added a sudo user add one now. | ||
<code bash> | <code bash> | ||
# Add the system user | # Add the system user | ||
sudo adduser system | sudo adduser system | ||
- | # Update the system to the latest | ||
sudo usermod -aG sudo system | sudo usermod -aG sudo system | ||
+ | # Update the system to the latest | ||
+ | sudo apt-get upgrade | ||
</ | </ | ||
==== Introduction to network technology under Ubuntu 22.04 ==== | ==== Introduction to network technology under Ubuntu 22.04 ==== | ||
- | * If you do not yet have a working network configuration on the server on which you want to perform the installation, | + | * If you do not yet have a working network configuration on the server on which you want to perform the installation, |
- | * Since there is a big difference between Ubuntu 16.04 and Ubuntu 22.04, we feel that this section will help those who need to get used to the new way of working. | + | * Since there is a big difference between Ubuntu 16.04 and Ubuntu 22.04, we believe |
* We assume that you have a bare VM (like the one from https:// | * We assume that you have a bare VM (like the one from https:// | ||
* We also assume that you have used it to create a VM in Virtualbox and now only see the local loopback interface (127.0.0.1) when you enter the ip a command. | * We also assume that you have used it to create a VM in Virtualbox and now only see the local loopback interface (127.0.0.1) when you enter the ip a command. | ||
- | * To see which interfaces are available (although | + | * To see which interfaces are available (even if some are not yet configured) |
<code bash> | <code bash> | ||
ip a | ip a | ||
</ | </ | ||
- | * On my system | + | * On my system, three interfaces are shown as I plan to use the VM as a router |
- | * For now I will just configure | + | * At the moment |
<code bash> | <code bash> | ||
sudo vi / | sudo vi / | ||
</ | </ | ||
- | * We edit the file to look like this (adapt to fit your system's interfaces) | + | * We edit the file so that it looks like this (adapt |
<code bash> | <code bash> | ||
- | # This file is generated from information provided by | + | # This file is generated from the information provided by |
- | # the datasource. Changes to it will not persist across an instance. | + | # the data source. Changes to it do not persist across an instance. |
- | # To disable cloud-init's network configuration capabilities, write a file | + | # To disable |
- | # / | + | # / |
# network: {config: disabled} | # network: {config: disabled} | ||
network: | network: | ||
Line 98: | Line 100: | ||
optional: true | optional: true | ||
</ | </ | ||
- | * Apply the network configuration | + | * Apply the network configuration |
<code bash> | <code bash> | ||
sudo netplan --debug apply | sudo netplan --debug apply | ||
</ | </ | ||
- | * If all went well our VM will now have an IP Address | + | * If everything |
<code bash> | <code bash> | ||
ip addr | ip addr | ||
Line 123: | Line 125: | ||
| | ||
</ | </ | ||
- | * Now that we have a working network | + | * Now that we have set up a working network on our computer, |
==== Install Nginx ==== | ==== Install Nginx ==== | ||
- | * We assume you have a clean install | + | * We assume |
Line 137: | Line 139: | ||
</ | </ | ||
- | * Make sure it is up to date. | + | * Make sure that it is up to date. |
<code bash> | <code bash> | ||
# Get the latest package lists | # Get the latest package lists | ||
Line 144: | Line 146: | ||
sudo apt-get upgrade | sudo apt-get upgrade | ||
</ | </ | ||
- | * Ensure | + | * Make sure that the English language pack is installed |
<code bash> | <code bash> | ||
sudo apt-get -y install language-pack-en-base | sudo apt-get -y install language-pack-en-base | ||
Line 152: | Line 154: | ||
sudo apt-get -y install nginx | sudo apt-get -y install nginx | ||
</ | </ | ||
- | * Ensure | + | * Make sure that the web server is started and running |
<code bash> | <code bash> | ||
sudo systemctl stop nginx.service | sudo systemctl stop nginx.service | ||
sudo systemctl start nginx.service | sudo systemctl start nginx.service | ||
</ | </ | ||
- | * Navigate | + | * Using a browser, navigate |
==== Configure Nginx to interpret .php files ==== | ==== Configure Nginx to interpret .php files ==== | ||
Line 171: | Line 173: | ||
</ | </ | ||
- | ==== Modify | + | ==== Change |
- | * Now that the php-fpm service is installed, | + | * Now that the php-fpm service is installed, |
* Edit the default server file: | * Edit the default server file: | ||
<code bash> | <code bash> | ||
Line 184: | Line 186: | ||
* 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.1 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 |
# | # | ||
location ~ \.php$ { | location ~ \.php$ { | ||
Line 208: | Line 210: | ||
sudo systemctl reload nginx.service | sudo systemctl reload nginx.service | ||
</ | </ | ||
- | * Create a test //.php// file to confirm that it does work | + | * Create a test //.php// file to confirm that it works. |
<code bash> | <code bash> | ||
sudo vi / | sudo vi / | ||
</ | </ | ||
- | * Contents: | + | * Content: |
<code bash> | <code bash> | ||
<?php | <?php | ||
Line 223: | Line 225: | ||
==== Install MariaDB ==== | ==== Install MariaDB ==== | ||
=== Why MariaDB? === | === Why MariaDB? === | ||
- | * We have found that the version of MySQL that is delivered | + | * We have found that the version of MySQL that is comes by default with Ubuntu 22.04 causes problems with RADIUSdesk. |
* For this reason, we have installed MariaDB as an alternative. | * For this reason, we have installed MariaDB as an alternative. | ||
* MariaDB is an open-source relational database management system that is often used as an alternative to MySQL as the database part of the popular LAMP stack (Linux, Apache, MySQL, PHP/ | * MariaDB is an open-source relational database management system that is often used as an alternative to MySQL as the database part of the popular LAMP stack (Linux, Apache, MySQL, PHP/ | ||
- | * It is intended as a drop-in | + | * It is intended as an immediate |
- | * Make sure to provide a root password for the MariaDB database when asked for it if you are security conscious, otherwise just press the ESC key. | + | * Be sure to provide a root password for the MariaDB database when prompted |
<code bash> | <code bash> | ||
sudo apt-get -y install mariadb-server php8.1-mysql | sudo apt-get -y install mariadb-server php8.1-mysql | ||
Line 235: | Line 238: | ||
</ | </ | ||
- | === Disable | + | === Deactivate |
- | * With Ubuntu 22.04, the bundled version of MariaDB is on version 10.3, which has introduced some strict modes that have some issues with the RADIUSdesk database implementation. | + | * On Ubuntu 22.04, the bundled version of MariaDB is on version 10.3, which has introduced some strict modes that have some issues with the RADIUSdesk database implementation. |
* We will disable the strict SQL mode in MariaDB by creating a new file / | * We will disable the strict SQL mode in MariaDB by creating a new file / | ||
<code bash> | <code bash> | ||
Line 246: | Line 249: | ||
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) | ||
</ | </ | ||
----- | ----- | ||
- | ==== Performance | + | ==== Performance |
- | === Modify | + | === Change the expiry date for certain files === |
- | * Edit the /// | + | * Edit the file /// |
<code bash> | <code bash> | ||
sudo vi / | sudo vi / | ||
</ | </ | ||
- | * Add the following | + | * Add the following |
<code bash> | <code bash> | ||
location ~ ^/ | location ~ ^/ | ||
Line 268: | Line 295: | ||
} | } | ||
</ | </ | ||
- | * Add below only if you require backward compatibility (MESHdesk and APdesk). | + | * Only add the following information |
<code bash> | <code bash> | ||
location ~ ^/ | location ~ ^/ | ||
Line 289: | Line 316: | ||
* 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 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 php-cli php-mysql php-gd php-curl php-xml php-mbstring php-intl php-sqlite3 git wget | sudo apt-get -y install php-cli php-mysql php-gd php-curl php-xml php-mbstring php-intl php-sqlite3 git wget | ||
Line 304: | Line 331: | ||
sudo git clone https:// | sudo git clone https:// | ||
</ | </ | ||
- | * This will create an **rdcore** directory | + | * |
* 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 312: | Line 339: | ||
</ | </ | ||
- | === 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> | ||
Line 328: | Line 355: | ||
=== 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 343: | Line 370: | ||
</ | </ | ||
- | === 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 369: | Line 396: | ||
<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 < / | sudo mysql -u root rd < / | ||
+ | </ | ||
+ | * 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 392: | Line 425: | ||
} | } | ||
</ | </ | ||
- | * 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 398: | Line 431: | ||
} | } | ||
</ | </ | ||
- | * Add the following configuration block inside | + | * Insert |
<code bash> | <code bash> | ||
location / | location / | ||
Line 405: | Line 438: | ||
} | } | ||
</ | </ | ||
- | * 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 418: | Line 451: | ||
=== 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 426: | Line 459: | ||
* 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 441: | Line 474: | ||
===== 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 450: | Line 482: | ||
* 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]] |