RADIUSdesk

logo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
getting_started:22_install_ubuntu_nginx [2022/09/02 22:21]
admin
getting_started:22_install_ubuntu_nginx [2023/11/22 09:58] (current)
admin
Line 1: Line 1:
 ====== Installing RADIUSdesk on Ubuntu 22.04 using Nginx ====== ====== Installing RADIUSdesk on Ubuntu 22.04 using Nginx ======
-===== Skills Required to Install =====+===== Skills required for the installation =====
  
-To install RADIUSdesk you need sufficient knowledge and experience on Linux to+To install RADIUSdeskyou need sufficient knowledge and experience with Linux: 
-  * Install the Linux operating system +  * Installing the Linux operating system. 
-  * Edit text files from the terminal using a text editor like **Vi** or **Nano**.+  * Edit text files from the terminal using a text editor such as Vi or Nano.
   * Install packages from a repository.   * Install packages from a repository.
-  * Be comfortable with the working of TCP/IP networking.+  * You must be familiar with how TCP/IP networks work.
  
 ===== Background ===== ===== Background =====
  
-  * **Nginx** is a web server that seems to have overtaken Apache in terms of popularity and number of active sites on the Internet today+  * 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 fresh, lightweight, fast, scales well and is able to take lot of load without overwhelming your system. +  *  It is new, lightweight, fast, highly scalable and capable of handling large load without overloading your system. 
-  * **Nginx** is the new Apache so to speak. +  * Nginx is the new Apache so to speak. 
-  * This section will cover the steps you have to go through to get RADIUSdesk working 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 
-     * A LEMP stack is one of those acronyms you can impress your friends with. It stands for Linux NginX MySQL and PHP.+     * A LEMP stack is one of those acronyms you can use to impress your friends. It stands for Linux NginX MySQL and PHP.
  
 <WRAP center round tip 100%> <WRAP center round tip 100%>
-  * We moved recently from CakePHPv3 to CakePHPv4. +  * We recently switched from CakePHPv3 to CakePHPv4. 
-  * If you manage devices using MESHdesk and APdesk be sure to also execute the instructions that include cake3 in order for your system to have backwards compatibility+  *  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 might still point to the **cake3** directory thus we need to include support for it +  * The firmware on these devices might still point to the cake3 directory, so we need to include support for this directory.
- +
 </WRAP> </WRAP>
- 
  
 ----------- -----------
  
-===== What do we require ===== 
  
-  * A standard **Nginx** install on Ubuntu is actually very simple. +===== What do we need ===== 
-  * The part that is more involved is to tweak **Nginx** to do the following:+ 
 +  *A standard Nginx installation on Ubuntu is actually very simple. 
 +  * The more complicated part is customising Nginx for the following tasks:
  
 ^ Requirement      ^ Comment        ^ Requirement      ^ Comment       
-Interpret PHP Scripts    | We would like the web server to call the PHP interpreter when a page ending with .php is requested. +Interpreting PHP scripts    | We want the web server to call the PHP interpreter when a page with the .php extension is requested. 
-Be able to have access to the MySQL functions of PHP | Since we set up a LEMP server, we need to have a MySQL server installed and accessible from PHP.  **We will install MariaDB which is a drop-in replacement for MySQL** +Access MySQL functions from PHP | Since we are setting up a LEMP server, we need to install a MySQL server and access it from PHP. We will install MariaDBwhich is a direct replacement for MySQL
-Modify the expiry date of HTTP headers to encourage caching | We want files that does not change (e.g. CSS or images) to be cached on the client'side to make the client'experience more pleasant | +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 experience more pleasant | 
-| Compress text before they are served to the client | We can compress the text that flows between the client and the server and in this way reduce the //over the line// bytes which in turn should also give the client a more pleasant experience | +| Compress the text before it is served 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 URL'| CakePHP makes use of the .htaccess files in Apache to enable pretty URLs. Since Nginx does not support .htaccess files, we need to change Nginx to behave in 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 43: Line 41:
 ===== HOWTO ===== ===== HOWTO =====
 <WRAP center round alert 100%> <WRAP center round alert 100%>
-  * Please note that the shell behavior in Ubuntu 22.04 changed+  * Please note that the behavior of the shell has changed in Ubuntu 22.04. 
-  * It seems that it **DOES NOT** execute multi line paste of commands. +  * It seems that it does NOT execute the multi-line insertion of commands. 
-  * You thus have to copy past these instructions line by line unfortunately.+  * So unfortunately you have to copy these commands line by line.
 </WRAP> </WRAP>
 +
 +
  
 ==== Add a sudo user  ==== ==== Add a sudo user  ====
-  * We assume you have a clean install of Ubuntu 22.04 WITHOUT Apache installed.+  * We assume that you have installed a clean installation of Ubuntu 22.04 WITHOUT Apache.
   * 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>
Line 55: Line 55:
 sudo adduser system sudo adduser system
 # Update the system to the latest # Update the system to the latest
-usermod -aG sudo system+sudo usermod -aG sudo system
 </code> </code>
  
-==== Networking Introduction on Ubuntu 22.04  ==== +==== Introduction to network technology under Ubuntu 22.04  ==== 
-  * If you do not yet have a working network configuration on the server you plan to do the installation on, please use this section as reference, else just proceed to the next section. +  * If you do not yet have a working network configuration on the server on which you want to perform the installation, please use this section as reference, otherwise simply continue with the next section. 
-  * Since there is such huge difference between the way of doing things in Ubuntu 16.04 and Ubuntu 22.04 we felt that adding this section will help those who are getting used to this newer way of doing things+  * Since there is a big difference between Ubuntu 16.04 and Ubuntu 22.04we feel that this section will help those who need to get used to the new way of working
-  * For this we assume you have a bare VM (like the ones from https://www.osboxes.org/ubuntu-server/+  * We assume that you have a bare VM (like the one from https://www.osboxes.org/ubuntu-server/
-  * We also assume you used this to create a VM in Virtualbox and are now faced with only the local loopback interface (127.0.0.1) when issuing 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 (yet some might just not yet be configured)+  *  To see which interfaces are available (although some may not yet be configured)
 <code bash> <code bash>
 ip a ip a
Line 152: Line 152:
 ==== Configure Nginx to interpret .php files ==== ==== Configure Nginx to interpret .php files ====
 === php-fpm === === php-fpm ===
-  * The default install of **Nginx** does not support the serving of **.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 will listen for requests to interpret+  * This service waits for requests for interpretation
-  * Install the php-fpm service by installing the default version 8.1 of the packages+  * Install the php-fpm service by installing the default version 8.1 of the packages 
 <code bash> <code bash>
 sudo apt-get -y install php-fpm sudo apt-get -y install php-fpm
Line 163: Line 163:
  
 ==== Modify Nginx ==== ==== Modify Nginx ====
-  * Now that the php-fpm service is installed we should change the default **Nginx** server to make use of it.+  * Now that the php-fpm service is installed, let's modify the default Nginx server to use it.
   * Edit the default server file:   * Edit the default server file:
 <code bash> <code bash>
Line 173: Line 173:
 index index.php index.html index.htm index.nginx-debian.html; index index.php index.html index.htm index.nginx-debian.html;
 </code> </code>
-  * Activate PHP processing by un-commenting this this section. Note that we use the UNIX socket and we are using **8.1** and not **7.4** which is specified originally in the config 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.4which was originally specified in the configuration file.
 <code bash> <code bash>
 # pass PHP scripts to FastCGI server # pass PHP scripts to FastCGI server
Line 186: Line 186:
 } }
 </code> </code>
-  * Enable the hiding of .htaccess files+  * Activate the hiding of .htaccess files.
 <code bash> <code bash>
 # deny access to .htaccess files, if Apache's document root # deny access to .htaccess files, if Apache's document root
Line 195: Line 195:
 } }
 </code> </code>
-  * Reload the **Nginx** web server's configuration+  * Reload the configuration of the Nginx web server
 <code bash> <code bash>
 sudo systemctl reload nginx.service sudo systemctl reload nginx.service
Line 209: Line 209:
 ?> ?>
 </code> </code>
-  * Navigate to http://127.0.0.1/test.php and see if the page display the PHP info.+  * Navigate to http://127.0.0.1/test.php and check that the page displays the PHP information.
  
 ----------- -----------
 ==== Install MariaDB ==== ==== Install MariaDB ====
 === Why MariaDB? === === Why MariaDB? ===
-  * We discovered that the version of MySQL that comes bundled by default with Ubuntu 22.04 are breaking things on RADIUSdesk. +  * We have found that the version of MySQL that is delivered by default with Ubuntu 22.04 causes problems with RADIUSdesk. 
-  * For this reason we install MariaDB as an alternative. +  * For this reasonwe have installed MariaDB as an alternative. 
-  * MariaDB is an open-source relational database management system, commonly used as an alternative for MySQL as the database portion of the popular LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack.  +  * 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/Python/Perl). 
-  * It is intended to be a drop-in replacement for MySQL. +  * It is intended as a drop-in replacement for MySQL. 
-  * Be sure to supply a root password for the MariaDB database when asked for it if you are security conscious else simply hit the ESC key.+  * 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.
 <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 227: Line 227:
  
 === Disable strict mode === === Disable strict mode ===
-  * With Ubuntu 22.04, the bundled release of MariaDB is at version 10.3 which introduced a few Strict modes which have some problems with RADIUSdesk database implementation. +  * With Ubuntu 22.04, the bundled version of MariaDB is on version 10.3which has introduced some strict modes that have some issues with the RADIUSdesk database implementation. 
-  * We will disable Strict SQL Mode in MariaDB by creating a new file /etc/mysql/conf.d/disable_strict_mode.cnf+  * We will disable the strict SQL mode in MariaDB by creating a new file /etc/mysql/conf.d/disable_strict_mode.cnf
 <code bash> <code bash>
 sudo vi /etc/mysql/conf.d/disable_strict_mode.cnf sudo vi /etc/mysql/conf.d/disable_strict_mode.cnf
Line 276: Line 276:
  
 ==== Install RADIUSdesk  ==== ==== Install RADIUSdesk  ====
-  * The first part prepared everything to install **RADIUSdesk**.  +  * In the first parteverything was prepared for the installation of **RADIUSdesk**. 
-  * This part will go through the steps to install the latest **RADIUSdesk**.+  * This part explains the steps for installing the latest **RADIUSdesk**.
   * 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.
Line 295: Line 295:
 sudo git clone https://github.com/RADIUSdesk/rdcore.git sudo git clone https://github.com/RADIUSdesk/rdcore.git
 </code> </code>
-  *  This will create an **rdcore** directory containing some sub-folders.+  *  This will create an **rdcore** directory that contains some subfolders. 
 +  * It is recommended that you also include the RD Mobile UI. 
 +  * Check out the **rd_mobile** git repository. 
 +<code bash> 
 +cd /var/www 
 +sudo git clone https://github.com/RADIUSdesk/rd_mobile.git 
 +</code>
  
-=== Create soft links === +=== Create softlinks === 
-  * We will create soft links in the directory where Nginx will serve the RADIUSdesk contents.+  * We will create softlinks in the directory where Nginx provides the RADIUSdesk content.
 <code bash> <code bash>
 cd /var/www/html cd /var/www/html
Line 308: Line 314:
 sudo ln -s ../rdcore/AmpConf/build/production/AmpConf ./conf_dev sudo ln -s ../rdcore/AmpConf/build/production/AmpConf ./conf_dev
 sudo ln -s ../rdcore/cake4/rd_cake/setup/scripts/reporting ./reporting sudo ln -s ../rdcore/cake4/rd_cake/setup/scripts/reporting ./reporting
 +#For the RD Mobile UI
 +sudo ln -s ../rd_mobile/build/production/RdMobile ./rd_mobile
 </code> </code>
  
-=== Change Ownerships ===+=== Change ownership ===
   * Change the ownership of the following files to www-data so Nginx can make changes to the files/directories   * Change the ownership of the following files to www-data so Nginx can make changes to the files/directories
 <code bash> <code bash>
Line 327: Line 335:
  
 === The Database === === The Database ===
-  * Make sure the timezone on the server is set to UTC +  * Make sure that the time zone on the server is set to UTC 
-  * Populate the timezone data on 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 THIS STEP will break the RADIUS graphs
Line 349: Line 357:
 sudo mysql -u root rd < /var/www/html/cake4/rd_cake/setup/db/rd.sql sudo mysql -u root rd < /var/www/html/cake4/rd_cake/setup/db/rd.sql
 </code> </code>
 +<WRAP center round important 100%>
 +  * RADIUSdesk is under active development and sometimes we add SQL patches.
 +  * The SQL patches are located at **/var/www/html/cake4/rd_cake/setup/db/**.
 +  * These patches are non-destructive and you can run them against the database
 +  * See the sample below
 +<code bash>
 +sudo mysql -u root rd < /var/www/rdcore/cake4/rd_cake/setup/db/8.068_add_email_sms_histories.sql 
 +</code>
 +</WRAP>
 +
  
 === Configure Nginx === === Configure Nginx ===
Line 396: Line 414:
 sudo cp -R /var/www/html/rd/build/production/Rd/* /var/www/html/ sudo cp -R /var/www/html/rd/build/production/Rd/* /var/www/html/
 </code> </code>
 +  * To load the RD Mobile UI, go to http://127.0.0.1/rd_mobile
  
 == Login Credentials ==  == Login Credentials == 
Line 403: Line 422:
 ----- -----
  
-===== Cron Scripts ===== +===== Cron scripts ===== 
-  * **RADIUSdesk** requires a few scripts to run periodically in order to maintain a healthy and working system. +  * **RADIUSdesk** requires some scripts that are executed at regular intervals to maintain a healthy and functioning system. 
-  * To activate the cron scripts execute the following command, which will add **RADIUSdesk**'s crons scripts to the Cron system+  * To activate the cron scriptsexecute the following command, which adds the **RADIUSdesk** cron scripts to the cron system
 <code bash> <code bash>
 sudo cp /var/www/html/cake4/rd_cake/setup/cron/cron4 /etc/cron.d/ sudo cp /var/www/html/cake4/rd_cake/setup/cron/cron4 /etc/cron.d/
 </code> </code>
-  * If you want to change the default intervals at which the scripts get executed, just edit the /etc/cron.d/cron3 file+  * If you want to change the default intervals at which the scripts are executed, simply edit the file /etc/cron.d/cron3.
  
 ===== Add LETSENCRYPT certificate ===== ===== Add LETSENCRYPT certificate =====
-  * Rather than repeating existing documentation we will just add a URL with the instructions to do it+  * Instead of repeating the existing documentationwe simply add a URL with the appropriate instructions. 
-  * You might want to run the following first before going to the instructions in the URL+  * You may want to do the following first before following the instructions in the URL
  
 <code bash> <code bash>