This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| getting_started:18_install_ubuntu_nginx [2019/12/19 06:10] – created admin | getting_started:18_install_ubuntu_nginx [2019/12/19 12:27] (current) – [Install RADIUSdesk] admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Installing RADIUSdesk on Ubuntu 18.04 using Nginx ====== | ====== Installing RADIUSdesk on Ubuntu 18.04 using Nginx ====== | ||
| - | * 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. | ||
| - | * For this we assume you have a bare VM (like the ones from https:// | ||
| - | * 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. | ||
| - | |||
| ===== Background ===== | ===== Background ===== | ||
| Line 30: | Line 26: | ||
| ===== HOWTO ===== | ===== HOWTO ===== | ||
| ==== Networking Introduction on Ubuntu 18.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. | ||
| + | * 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. | ||
| + | * For this we assume you have a bare VM (like the ones from https:// | ||
| + | * 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. | ||
| + | * To see which interfaces are available (yet some might just not yet be configured) | ||
| + | <code bash> | ||
| + | ip a | ||
| + | </ | ||
| + | * On my system it lists three since I plan to use the VM also as a router with Coova Chilli running on the one interface. So we have **lo**, **enp0s3** and **enp0s8**. | ||
| + | * For now I will just configure both of those interfaces to be DHCP clients. | ||
| + | <code bash> | ||
| + | sudo vi / | ||
| + | </ | ||
| + | * We edit the file to look like this (adapt to fit your system' | ||
| + | <code bash> | ||
| + | # This file is generated from information provided by | ||
| + | # the datasource. | ||
| + | # To disable cloud-init' | ||
| + | # / | ||
| + | # network: {config: disabled} | ||
| + | network: | ||
| + | version: 2 | ||
| + | ethernets: | ||
| + | enp0s3: | ||
| + | addresses: [] | ||
| + | dhcp4: true | ||
| + | optional: true | ||
| + | enp0s8: | ||
| + | addresses: [] | ||
| + | dhcp4: true | ||
| + | optional: true | ||
| + | </ | ||
| + | * Apply the network configuration using command: | ||
| + | <code bash> | ||
| + | sudo netplan --debug apply | ||
| + | </ | ||
| + | * If all went well our VM will now have an IP Address (via DHCP) which we can use. | ||
| + | <code bash> | ||
| + | ip addr | ||
| + | #Feedback contains | ||
| + | 1: lo: < | ||
| + | link/ | ||
| + | inet 127.0.0.1/8 scope host lo | ||
| + | | ||
| + | inet6 ::1/128 scope host | ||
| + | | ||
| + | 2: enp0s3: < | ||
| + | link/ether 08: | ||
| + | inet 192.168.1.111/ | ||
| + | | ||
| + | inet6 fe80:: | ||
| + | | ||
| + | 3: enp0s8: < | ||
| + | link/ether 08: | ||
| + | inet6 fe80:: | ||
| + | | ||
| + | </ | ||
| + | * Now that we have a working network setup on our machine we can continue. | ||
| + | |||
| ==== Install Nginx ==== | ==== Install Nginx ==== | ||
| * We assume you have a clean install of Ubuntu 18.04 **WITHOUT** Apache installed. | * We assume you have a clean install of Ubuntu 18.04 **WITHOUT** Apache installed. | ||
| Line 35: | Line 90: | ||
| * To remove Apache | * To remove Apache | ||
| < | < | ||
| - | sudo systemctl | + | sudo systemctl |
| sudo apt-get remove apache2 | sudo apt-get remove apache2 | ||
| </ | </ | ||
| </ | </ | ||
| + | * Make sure it is up to date. | ||
| + | <code bash> | ||
| + | # Get the latest package lists | ||
| + | sudo apt-get update | ||
| + | # Update the system to the latest | ||
| + | sudo apt-get upgrade | ||
| + | </ | ||
| * Ensure the English language pack is installed | * Ensure the English language pack is installed | ||
| <code bash> | <code bash> | ||
| Line 74: | Line 136: | ||
| <code bash> | <code bash> | ||
| sudo apt-get install php-fpm | sudo apt-get install php-fpm | ||
| + | sudo systemctl enable php7.2-fpm | ||
| + | sudo systemctl start php7.2-fpm | ||
| </ | </ | ||
| Line 94: | Line 158: | ||
| include snippets/ | include snippets/ | ||
| # | # | ||
| - | # # With php7.0-cgi | + | # # With php-fpm (or other unix sockets): |
| + | # ===HEADS-UP We use 7.2 and NOT 7.0 as commented out === | ||
| + | fastcgi_pass unix:/ | ||
| + | # # With php-cgi (or other tcp sockets): | ||
| # | # | ||
| - | # # With php7.0-fpm: | + | } |
| - | fastcgi_pass unix:/ | + | |
| - | | + | |
| </ | </ | ||
| * Enable the hiding of .htaccess files | * Enable the hiding of .htaccess files | ||
| Line 130: | Line 195: | ||
| <code bash> | <code bash> | ||
| sudo apt-get install mysql-server php-mysql | sudo apt-get install mysql-server php-mysql | ||
| + | sudo systemctl enable mysql | ||
| </ | </ | ||
| === Disable strict mode === | === Disable strict mode === | ||
| - | * With the 16.04 release of MySQL there were some changes to the MySQL configuration which causes problems on the current RADIUSdesk database implementation. | + | * With the 18.04 release of MySQL there were some changes to the MySQL configuration which causes problems on the current RADIUSdesk database implementation. |
| * We will disable Strict SQL Mode in MySQL 5.7. | * We will disable Strict SQL Mode in MySQL 5.7. | ||
| <code bash> | <code bash> | ||
| Line 147: | Line 213: | ||
| sudo systemctl restart mysql.service | sudo systemctl restart mysql.service | ||
| </ | </ | ||
| - | |||
| ----- | ----- | ||
| Line 161: | Line 226: | ||
| rewrite ^/ | rewrite ^/ | ||
| rewrite ^/ | rewrite ^/ | ||
| + | access_log off; | ||
| + | expires max; | ||
| + | add_header Cache-Control public; | ||
| + | } | ||
| + | |||
| + | location ~ ^/ | ||
| + | rewrite ^/ | ||
| + | rewrite ^/ | ||
| access_log off; | access_log off; | ||
| expires max; | expires max; | ||
| Line 170: | Line 243: | ||
| sudo systemctl reload nginx.service | sudo systemctl reload nginx.service | ||
| </ | </ | ||
| - | === Compress the text before sending it to client === | ||
| - | * Edit the main config file of **Nginx**. | ||
| - | <code bash> | ||
| - | sudo vi / | ||
| - | </ | ||
| - | * Change the compression section to contain the following: | ||
| - | < | ||
| - | gzip on; | ||
| - | gzip_disable " | ||
| - | |||
| - | gzip_vary on; | ||
| - | gzip_proxied any; | ||
| - | gzip_comp_level 6; | ||
| - | gzip_buffers 16 8k; | ||
| - | gzip_http_version 1.1; | ||
| - | gzip_types text/plain text/css application/ | ||
| - | |||
| - | </ | ||
| - | * Restart Nginx | ||
| - | <code bash> | ||
| - | sudo systemctl restart nginx.service | ||
| - | </ | ||
| - | |||
| ---------- | ---------- | ||
| Line 200: | Line 250: | ||
| * **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. | ||
| * **rd_cake** is a CakePHP application and can be considered the engine room. Here the data is processed before being presented by the presentation layer. **(We currently use one CakePHP v2 and one CakePHP v3 application in order to migrate from CakePHP v2 to CakePHP v3)** | * **rd_cake** is a CakePHP application and can be considered the engine room. Here the data is processed before being presented by the presentation layer. **(We currently use one CakePHP v2 and one CakePHP v3 application in order to migrate from CakePHP v2 to CakePHP v3)** | ||
| - | * **rd_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. Although this is optional, it is used by most installs. |
| * We will use SVN (subversion) to check out the latest version (trunk) of RADIUSdesk. | * We will use SVN (subversion) to check out the latest version (trunk) of RADIUSdesk. | ||
| === Install CakePHP === | === Install CakePHP === | ||
| - | <WRAP center round info 100%> | ||
| - | * As from December 2016 we started a migration process of migrating from CakePHP v2 to CakePHP v3. | ||
| - | * The ORM component of CakePHP v3 is completely new and different which makes the migration fairly involved. | ||
| - | * Since the architecture of RADIUSdesk is following modern design principles it allows us to run both CakePHP v2 and CakePHP v3 simultaneously. | ||
| - | * We can then do the migration gradually over time. | ||
| - | </ | ||
| - | |||
| == 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-gd php-curl php-xml php-mbstring php-intl | + | sudo apt-get install php-cli |
| </ | </ | ||
| == Install CakePHP v2 == | == Install CakePHP v2 == | ||
| - | * Download the 2.x version of CakePHP (Version 2.9.7 as of this writing). https:// | + | * Download the 2.x version of CakePHP (Version 2.10.19 as of this writing). https:// |
| * There are two formats to choose from when selecting to download, Zip or Tar.gz. Select Tar.gz. | * There are two formats to choose from when selecting to download, Zip or Tar.gz. Select Tar.gz. | ||
| * Copy and extract it inside the directory that Nginx is serving its content from (/ | * Copy and extract it inside the directory that Nginx is serving its content from (/ | ||
| <code bash> | <code bash> | ||
| - | sudo cp 2.9.7.tar.gz / | + | sudo cp 2.10.19.tar.gz / |
| cd / | cd / | ||
| - | sudo tar -xzvf 2.9.7.tar.gz | + | sudo tar -xzvf 2.10.19.tar.gz |
| - | sudo ln -s ./ | + | sudo ln -s ./ |
| </ | </ | ||
| - | * Reload php7.0-fpm | + | * Reload php7.2-fpm |
| <code bash> | <code bash> | ||
| - | sudo systemctl reload php7.0-fpm.service | + | sudo systemctl reload php7.2-fpm.service |
| </ | </ | ||
| Line 292: | Line 335: | ||
| sudo mysql -u root rd < / | sudo mysql -u root rd < / | ||
| </ | </ | ||
| - | |||
| - | <WRAP center round tip 80%> | ||
| - | * If you have a small server like a Raspberry Pi you, run the following SQL for better performance. | ||
| - | <code sql> | ||
| - | use rd; | ||
| - | delete from phrase_values where language_id=16 OR language_id=15 or language_id=13 or language_id=5 or language_id=14; | ||
| - | </ | ||
| - | </ | ||
| - | |||
| === 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 / | * 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 / | ||
| Line 360: | Line 394: | ||
| ===== Next steps ===== | ===== Next steps ===== | ||
| * Be sure to also install **FreeRADIUS** and **Node.js**, | * Be sure to also install **FreeRADIUS** and **Node.js**, | ||
| - | * [[Getting Started:install_ubuntu_freeradius_3|Install FreeRADIUS]] | + | * [[Getting Started:18_install_ubuntu_freeradius_3|Install FreeRADIUS]] |
| - | * [[getting_started: | + | * [[getting_started: |