RADIUSdesk

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:20_install_ubuntu_nginx [2021/01/17 17:12]
admin [Install RADIUSdesk]
getting_started:20_install_ubuntu_nginx [2022/01/14 13:09] (current)
admin [Install RADIUSdesk]
Line 1: Line 1:
-====== Installing RADIUSdesk on Ubuntu ​18.04 using Nginx ======+====== Installing RADIUSdesk on Ubuntu ​20.04 using Nginx ====== 
 +===== Skills Required to Install ===== 
 + 
 +To install RADIUSdesk you need sufficient knowledge and experience on Linux to: 
 +  * Install the Linux operating system 
 +  * Edit text files from the terminal using a text editor like **Vi** or **Nano**. 
 +  * Install packages from a repository. 
 +  * Be comfortable with the working of TCP/IP networking. 
 ===== Background ===== ===== Background =====
  
Line 18: Line 26:
 | Interpret PHP Scripts ​   | We would like the web server to call the PHP interpreter when a page ending with .php is requested. ​    | | Interpret PHP Scripts ​   | We would like the web server to call the PHP interpreter when a page ending with .php 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. | | 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. |
-| 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'​s side to make the client'​s experience more pleasant |+| 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'​s side to make the client'​s 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 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 |
 | Enable rewrite rules in CakePHP for pretty URL's | 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 URL's | 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. |
Line 35: Line 43:
 </​code>​ </​code>​
  
- +==== Networking Introduction on Ubuntu ​20.04  ====
-==== Networking Introduction on Ubuntu ​18.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 you plan to do the installation on, please use this section as reference, else just proceed to the next section.
-  * Since there is such a huge difference between the way of doing things in Ubuntu 16.04 and Ubuntu ​18.04 we felt that adding this section will help those who are getting used to this newer way of doing things.+  * Since there is such a huge difference between the way of doing things in Ubuntu 16.04 and Ubuntu ​20.04 we felt that adding this section will help those who are getting used to this newer way of doing things.
   * For this we assume you have a bare VM (like the ones from https://​www.osboxes.org/​ubuntu-server/​ )   * For this we assume you have a bare VM (like the ones 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 **ifconfig** command.+  * 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.
   * To see which interfaces are available (yet some might just not yet be configured)   * To see which interfaces are available (yet some might just not yet be configured)
 <code bash> <code bash>
Line 102: Line 109:
    <​code bash>    <​code bash>
    sudo systemctl stop apache2.service    sudo systemctl stop apache2.service
-   sudo apt-get remove apache2+   sudo apt-get ​-y remove apache2
    </​code>​    </​code>​
 </​WRAP>​ </​WRAP>​
Line 115: Line 122:
   * Ensure the English language pack is installed   * Ensure the English language pack is installed
 <code bash> <code bash>
-sudo apt-get install language-pack-en-base+sudo apt-get ​-y install language-pack-en-base
 </​code>​ </​code>​
   * Install Nginx   * Install Nginx
 <code bash> <code bash>
-sudo apt-get install nginx+sudo apt-get ​-y install nginx
 </​code>​ </​code>​
   * Ensure the web server starts up and is running   * Ensure the web server starts up and is running
Line 135: Line 142:
   * Install the php-fpm service:   * Install the php-fpm service:
 <code bash> <code bash>
-sudo apt-get install php-fpm+sudo apt-get ​-y install php-fpm
 sudo systemctl enable php7.4-fpm sudo systemctl enable php7.4-fpm
 sudo systemctl start php7.4-fpm sudo systemctl start php7.4-fpm
Line 198: Line 205:
   * 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.   * 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.
 <code bash> <code bash>
-sudo apt-get install mariadb-server php-mysql+sudo apt-get ​-y install mariadb-server php-mysql
 sudo systemctl enable mariadb sudo systemctl enable mariadb
 sudo systemctl restart mariadb sudo systemctl restart mariadb
 sudo systemctl status mariadb sudo systemctl status mariadb
 +</​code>​
 +
 +=== Disable strict mode ===
 +  * With Ubuntu 20.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.
 +  * We will disable Strict SQL Mode in MariaDB by creating a new file /​etc/​mysql/​conf.d/​disable_strict_mode.cnf
 +<code bash>
 +sudo vi /​etc/​mysql/​conf.d/​disable_strict_mode.cnf
 +</​code>​
 +  * Enter these two lines:
 +<code bash>
 +[mysqld]
 +sql_mode=IGNORE_SPACE,​NO_ZERO_IN_DATE,​NO_ZERO_DATE,​ERROR_FOR_DIVISION_BY_ZERO,​NO_AUTO_CREATE_USER,​NO_ENGINE_SUBSTITUTION
 +</​code>​
 +  * Save the file and restart the MySQL Server
 +<code bash>
 +sudo systemctl restart mariadb
 </​code>​ </​code>​
  
Line 227: Line 250:
 ---------- ----------
  
-==== Install RADIUSdesk ====+==== Install RADIUSdesk ​ ====
   * The first part prepared everything to install **RADIUSdesk**. ​   * The first part prepared everything to install **RADIUSdesk**. ​
-  * This part will go through the steps to install the latest RADIUSdesk.+  * This part will go through the steps to install 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.
     * **cake3** is a CakePHPv3 application and can be considered the engine room. Here the data is processed before being presented by the presentation layer.     * **cake3** is a CakePHPv3 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 RADIUSdesk **Dynamic Login Pages** applet. Although this is optional, it is used by most installs+    * **login** is a directory with various login pages which are centrally managed through the RADIUSdesk **Dynamic Login Pages** applet. 
-  * We will use git to  check out the latest version (master) of RADIUSdesk.+  * Later we will create various symbolic links from locations inside the **rdcore** directory ​to locations inside ​the web server'​s document root directory.
  
 === Required packages === === Required packages ===
   * Make sure the following packages are installed:   * Make sure the following packages are installed:
 <code bash> <code bash>
-sudo apt-get install php-cli php-mysql php-gd php-curl php-xml php-mbstring php-intl git wget+sudo apt-get ​-y install php-cli php-mysql php-gd php-curl php-xml php-mbstring php-intl git wget 
 +sudo systemctl restart php7.4-fpm
 </​code>​ </​code>​
-  * 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://blablabla+sudo git clone https://github.com/​RADIUSdesk/​rdcore.git
 </​code>​ </​code>​
-  * This will create an **rd_code** directory containing some sub-folders.+  *  This will create an **rdcore** directory containing some sub-folders.
  
 === Create soft links === === Create soft links ===
Line 252: Line 276:
 <code bash> <code bash>
 cd /​var/​www/​html cd /​var/​www/​html
-sudo ln -s ../rd_code/rd ./rd +sudo ln -s ../rdcore/rd ./rd 
-sudo ln -s ../rd_code/cake3 ./cake3 +sudo ln -s ../rdcore/cake3 ./cake3 
-sudo ln -s ../rd_code/login ./login+sudo ln -s ../rdcore/login ./login 
 +sudo ln -s ../​rdcore/​AmpConf/​build/​production/​AmpConf ./​conf_dev 
 +sudo ln -s ../​rdcore/​cake3/​rd_cake/​setup/​scripts/​reporting ./reporting
 </​code>​ </​code>​
  
Line 269: Line 295:
 sudo chown -R www-data. /​var/​www/​html/​cake3/​rd_cake/​webroot/​img/​dynamic_photos sudo chown -R www-data. /​var/​www/​html/​cake3/​rd_cake/​webroot/​img/​dynamic_photos
 sudo chown -R www-data. /​var/​www/​html/​cake3/​rd_cake/​webroot/​img/​access_providers sudo chown -R www-data. /​var/​www/​html/​cake3/​rd_cake/​webroot/​img/​access_providers
-sudo chown -R www-data. /​var/​www/​html/​cake3/​rd_cake/​webroot/​img/​nas+sudo chown -R www-data. /​var/​www/​html/​cake3/​rd_cake/​webroot/​img/​hardwares
 sudo chown -R www-data. /​var/​www/​html/​cake3/​rd_cake/​webroot/​files/​imagecache sudo chown -R www-data. /​var/​www/​html/​cake3/​rd_cake/​webroot/​files/​imagecache
 </​code>​ </​code>​
Line 278: Line 304:
 <code bash> <code bash>
 #NOTE FAILING THIS STEP will break the RADIUS graphs #NOTE FAILING THIS STEP will break the RADIUS graphs
 +#There might be some error messages in the output which is fine - no need to be alarmed
 sudo su sudo su
 mysql_tzinfo_to_sql /​usr/​share/​zoneinfo | mysql -u root  mysql mysql_tzinfo_to_sql /​usr/​share/​zoneinfo | mysql -u root  mysql
Line 295: Line 322:
 sudo mysql -u root rd < /​var/​www/​html/​cake3/​rd_cake/​setup/​db/​rd.sql sudo mysql -u root rd < /​var/​www/​html/​cake3/​rd_cake/​setup/​db/​rd.sql
 </​code>​ </​code>​
 +
 === Configure Nginx === === Configure Nginx ===
-  ​Since CakePHP uses rewrite rules, we have to configure ​Nginx in such a way as to allow rewriting of the URL's that starts ​with /cake2/rd_cake or with /​cake3/​rd_cake.+ 
 +  ​Configure ​Nginx to rewrite some RdCore URLs starting ​with ///​cake3/​rd_cake//.
   * Edit ///​etc/​nginx/​sites-enabled/​default//​   * Edit ///​etc/​nginx/​sites-enabled/​default//​
 <code bash> <code bash>
-    ​sudo vi /​etc/​nginx/​sites-enabled/​default+sudo vi /​etc/​nginx/​sites-enabled/​default
 </​code>​ </​code>​
-  * Add the following ​section ​inside the server section:+  ​* 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. 
 +<code bash> 
 +server_name _; 
 +location /​cake3/​rd_cake/​node-reports/​submit_report.json { 
 +    try_files $uri $uri/ /​reporting/​reporting.php;​ 
 +
 +</​code>​ 
 +  ​* Add the following ​configuration block inside the server section ​(This you can add towards the end):
 <code bash> <code bash>
 location /​cake3/​rd_cake { location /​cake3/​rd_cake {
Line 308: Line 344:
 } }
 </​code>​ </​code>​
-  * Reload the Nginx web server:+  * Reload the Nginx:
 <code bash> <code bash>
-   sudo systemctl reload nginx.service+sudo systemctl reload nginx
 </​code>​ </​code>​
  
------ +=== Important URLs ===   
- +  * The following URLs are important to reach the UI 
-==== Viewer component ==== +  * To load the optimized UI, go to http://127.0.0.1/rd/build/production/​Rd/​ 
-  * Check out the latest code of the viewer component under the /usr/share/nginx/htmldirectory:+  * If you want to serve the content directly out of the webroot, do the following:
 <code bash> <code bash>
-cd /usr/share/nginx/html/ +sudo cp -R /var/www/html/rd/build/production/Rd//var/www/html/
-sudo svn checkout svn://dvdwalt@svn.code.sf.net/p/radiusdesk/code/trunk/rd ./rd+
 </​code>​ </​code>​
  
-  * For the viewer component you need the ExtJS toolkit. We've added version 6.2.0 to the SVN repository for easy download :-) +== Login Credentials ==  
-  * Checkout and unzip the GPL version under the /​usr/​share/​nginx/​html/​rd directory. <wrap hi>​**NOTE**:​ This is a single big file which will take some time to download over slow connections.</​wrap>​ +  * By default you can log in with the following ​credentials 
-<code bash> +Username: ​**root** ​Password: ​**admin**
-cd /​usr/​share/​nginx/​html/​ +
-sudo svn checkout svn://​svn.code.sf.net/​p/​radiusdesk/​code/​extjs ./ +
-sudo mv  ext-6-2-sencha_cmd.tar.gz ./rd +
-cd /​usr/​share/​nginx/​html/​rd +
-sudo tar -xzvf ext-6-2-sencha_cmd.tar.gz +
-</​code>​ +
-  * Now try to log in on the following ​URL with username ​**root** ​and password ​**admin**: http://​127.0.0.1/​rd/​build/​production/​Rd/​index.html +
-  * Alternatively //(also if you do not have Internet Access on the machine)// use this URL which is a bit slower: http://​127.0.0.1/​rd/​index.html?​cache+
  
----------------------------+-----
  
 ===== Cron Scripts ===== ===== Cron Scripts =====
Line 340: Line 367:
   * To activate the cron scripts execute the following command, which will add **RADIUSdesk**'​s crons scripts to the Cron system   * To activate the cron scripts execute the following command, which will add **RADIUSdesk**'​s crons scripts to the Cron system
 <code bash> <code bash>
-sudo cp /usr/share/nginx/html/cake2/rd_cake/Setup/Cron/rd /​etc/​cron.d/​+sudo cp /var/www/html/cake3/rd_cake/setup/cron/cron3 /​etc/​cron.d/​ 
 +</​code>​ 
 +  * If you want to change the default intervals at which the scripts get executed, just edit the /​etc/​cron.d/​cron3 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 
 + 
 +<code bash> 
 +sudo apt-get update 
 +sudo apt-get -y install software-properties-common
 </​code>​ </​code>​
-  * If you want to change the default intervals at which the scripts get executed, just edit the /etc/cron.d/rd file+  * https://www.digitalocean.com/​community/​tutorials/​how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04
 ===== Next steps ===== ===== Next steps =====
-  * Be sure to also install **FreeRADIUS** ​and **Node.js**,​ +  * Be sure to also install **FreeRADIUS** 
-  * [[Getting Started:18_install_ubuntu_freeradius_3|Install FreeRADIUS]] +  * [[Getting Started:20_install_ubuntu_freeradius_3|Install FreeRADIUS]]
-  * [[getting_started:​18_install_ubuntu_node_js|Install node.js]]+