Difference between revisions of "Installing Joomla on a Raspberry Pi"
From Joomla! Documentation
(Several markup changes. URL corrections.) |
|||
Line 1: | Line 1: | ||
<noinclude><languages /></noinclude> | <noinclude><languages /></noinclude> | ||
{{incomplete}} | {{incomplete}} | ||
− | |||
− | |||
− | |||
<translate><!--T:2--> | <translate><!--T:2--> | ||
− | The [https://www.raspberrypi.org/ Raspberry Pi] is a small single-board computer that was originally developed to promote the teaching of basic computer science in schools and developing countries. Because of its versatility it has become very popular and is used as media player, small stand-alone server, etc. You can use it as | + | The [https://www.raspberrypi.org/ Raspberry Pi] is a small single-board computer that was originally developed to promote the teaching of basic computer science in schools and developing countries. Because of its versatility it has become very popular and is used as media player, small stand-alone server, etc. You can use it as web server and install Joomla! on it. This page shows you how to get a your Joomla! website running on the Raspberry Pi.</translate> |
<translate> | <translate> | ||
Line 11: | Line 8: | ||
</translate> | </translate> | ||
<translate><!--T:4--> | <translate><!--T:4--> | ||
− | * ''' | + | * '''Raspberry Pi version 3 Model B''' - There are various models of Raspberry Pi. You can use most models that have an Ethernet port (the Model B types). However for performance we will use the latest version with most RAM memory.</translate> |
<translate><!--T:5--> | <translate><!--T:5--> | ||
− | * '''micro SD card''' - For the operating system + | + | * '''micro SD card''' - For the operating system + web server + Joomla. (RPi version 3 model B uses micro SD other versions might use normal SD cards)</translate> |
<translate><!--T:6--> | <translate><!--T:6--> | ||
− | * '''5 Volt adapter (1 Amp)''' - to power the Raspberry Pi you'll need to convert the mains power (230V or 110V) to 5 Volt. The | + | * '''5 Volt adapter (1 Amp)''' - to power the Raspberry Pi you'll need to convert the mains power (230V or 110V) to 5 Volt. The Raspberry Pi needs about 1 Amp, and maybe more if you connect USB devices to it.</translate> |
<translate><!--T:7--> | <translate><!--T:7--> | ||
* standard '''Ethernet cable''' - to connect the RPi to your Local Area Network / router / the internet.</translate> | * standard '''Ethernet cable''' - to connect the RPi to your Local Area Network / router / the internet.</translate> | ||
Line 23: | Line 20: | ||
</translate> | </translate> | ||
<translate><!--T:9--> | <translate><!--T:9--> | ||
− | The operating system Raspbian is a Debian Linux version specially compiled for the Raspberry Pi. There are two versions of [https://www.raspberrypi. | + | The operating system Raspbian is a Debian Linux version specially compiled for the Raspberry Pi. There are two versions of [https://www.raspberrypi.com/software/ Raspbian] available: '''Raspbian Jessie with Pixel Lite''' (version with PIXEL desktop based on Debian Jessie) and '''Raspbian Jessie Lite''' (minimal version based on Debian Jessie). Because we use the Raspberry Pi as a web server for Joomla, we won't need the GUI.</translate> |
<translate><!--T:10--> | <translate><!--T:10--> | ||
− | '''Download''' [https://www.raspberrypi.org/downloads/raspbian/ Raspbian Jessie Lite] and unzip the downloaded file, e.g. 2016-09-23-raspbian-jessie-lite | + | '''Download''' [https://www.raspberrypi.org/downloads/raspbian/ Raspbian Jessie Lite] and unzip the downloaded file, e.g. ''2016-09-23-raspbian-jessie-lite.zip'' (306 MB) to ''2016-09-23-raspbian-jessie-lite.img'' (1.4 GB).</translate> |
<translate><!--T:11--> | <translate><!--T:11--> | ||
− | Now we need to copy the .img file to the (micro) SD card. You can use a tool with graphical interface | + | Now we need to copy the ''.img'' file to the (micro) SD card. You can use a tool with graphical interface such as |
− | [https://unetbootin.github.io/ UNetbootin] (for Windows, Mac OS X and Linux) or do it on the command line | + | [https://unetbootin.github.io/ UNetbootin] (for Windows, Mac OS X and Linux) or do it on the command line.</translate> |
<translate><!--T:12--> | <translate><!--T:12--> | ||
− | '''Be | + | '''Be careful''' when writing the ''.img'' disk image to another disk. If you specify the wrong destination disk, you will overwrite that disk with the ''.img'' which makes that disk unusable, resulting in data loss.</translate> |
<translate> | <translate> | ||
Line 40: | Line 37: | ||
<translate><!--T:14--> | <translate><!--T:14--> | ||
In a terminal (CMD) check which device corresponds with the SD Card and do something like:</translate> | In a terminal (CMD) check which device corresponds with the SD Card and do something like:</translate> | ||
− | < | + | <syntaxhighlight lang="bash">dd bs=1M if=c:\temp\2016-09-23-raspbian-jessie-lite.img od=[the device of your SD Card]</syntaxhighlight> |
<translate><!--T:15--> | <translate><!--T:15--> | ||
See also [https://www.raspberrypi.org/documentation/installation/installing-images/windows.md Installing Operating System Images using Windows]</translate> | See also [https://www.raspberrypi.org/documentation/installation/installing-images/windows.md Installing Operating System Images using Windows]</translate> | ||
Line 48: | Line 45: | ||
</translate> | </translate> | ||
<translate><!--T:17--> | <translate><!--T:17--> | ||
− | Check which device is used for your SD Card. In our case it's disk1s1 and we'll do in Terminal:</translate> | + | Check which device is used for your SD Card. In our case it's ''disk1s1'' and we'll do in Terminal:</translate> |
− | < | + | <syntaxhighlight lang="bash">sudo dd bs=1M if=~/Downloads/2016-09-23-raspbian-jessie-lite.img of=/dev/disk1s1</syntaxhighlight> |
<translate><!--T:18--> | <translate><!--T:18--> | ||
See also: [https://www.raspberrypi.org/documentation/installation/installing-images/mac.md Installing Operating System Images on MacOS]</translate> | See also: [https://www.raspberrypi.org/documentation/installation/installing-images/mac.md Installing Operating System Images on MacOS]</translate> | ||
Line 57: | Line 54: | ||
</translate> | </translate> | ||
<translate><!--T:20--> | <translate><!--T:20--> | ||
− | We connect a SD Card reader with the (micro) SD Card to a computer. With | + | We connect a SD Card reader with the (micro) SD Card to a computer. With ''dmesg'' we can find the device name of the SD Card. In our case ''dmesg'' shows something like <syntaxhighlight lang="bash">[xxxxxx.xxxxxxx] sdd: sdd1 sdd2</syntaxhighlight> meaning that we have a SD Card with 2 partitions. Do not write the Raspbian image to a partition but to the whole disk ''sdd''.</translate> |
<translate><!--T:21--> | <translate><!--T:21--> | ||
− | We will use | + | We will use ''dd'' ("Disk Dump") to write an Input File (''if'') to an Output File (''of'') using a specified Block Size (''bs'').</translate> |
<translate><!--T:22--> | <translate><!--T:22--> | ||
− | '''Be | + | '''Be careful''' ''dd'' will write to a device without any warning. Double check that that you write to the correct device. If you write to the wrong disk, you'll always remember the ''dd'' command as "Disk Destroyer".</translate> |
− | < | + | <syntaxhighlight lang="bash">sudo dd if=~/Downloads/2016-09-23-raspbian-jessie-lite.img of=/dev/sdd bs=4M</syntaxhighlight> |
<translate><!--T:23--> | <translate><!--T:23--> | ||
Line 70: | Line 67: | ||
<translate> | <translate> | ||
− | |||
<!--T:113--> | <!--T:113--> | ||
− | '''WARNING for | + | '''WARNING for Raspbian Stretch version''': to have a SSH server working from boot you need to create an empty file ''ssh'' on the root partition. |
==Connecting Raspberry Pi to LAN== <!--T:24--> | ==Connecting Raspberry Pi to LAN== <!--T:24--> | ||
Line 79: | Line 75: | ||
When we have installed the Raspbian Operating System on the SD Card, we will:</translate> | When we have installed the Raspbian Operating System on the SD Card, we will:</translate> | ||
<translate><!--T:26--> | <translate><!--T:26--> | ||
− | * Insert the micro SD card in the SD Card slot on the Raspberry Pi.</translate> | + | * Insert the micro SD card in the SD Card slot on the Raspberry Pi.</translate> |
<translate><!--T:27--> | <translate><!--T:27--> | ||
* Connect an an Ethernet cable to the Raspberry Pi and to the Local Area Network (connect it to our router).</translate> | * Connect an an Ethernet cable to the Raspberry Pi and to the Local Area Network (connect it to our router).</translate> | ||
Line 86: | Line 82: | ||
<translate><!--T:29--> | <translate><!--T:29--> | ||
− | Booting up the Raspberry Pi takes roughly 30 seconds. We've to find the IP address to connect to it using SSH. We can use different approaches for that:</translate> | + | Booting up the Raspberry Pi takes roughly 30 seconds. We've to find the IP address to connect to it using SSH. We can use different approaches for that:</translate> |
<translate><!--T:30--> | <translate><!--T:30--> | ||
− | * log into the | + | * log into the web interface of your router and look up the connected devices;</translate> |
<translate><!--T:31--> | <translate><!--T:31--> | ||
− | * use a mobile phone connected the | + | * use a mobile phone connected the wi-fi router using a network scanning App called ''Fing Overlook'';</translate> |
<translate><!--T:32--> | <translate><!--T:32--> | ||
− | * use a command like | + | * use a command like ''nmap''. Assuming that our PC has IP address ''192.168.0.25'' we can find all other devices in the same network range by doing the following:</translate> |
− | < | + | <syntaxhighlight lang="bash">sudo nmap -sP 192.168.0/24</syntaxhighlight> |
<translate><!--T:33--> | <translate><!--T:33--> | ||
Which might show the following details:</translate> | Which might show the following details:</translate> | ||
Starting Nmap 6.47 ( http://nmap.org ) at 2016-10-22 17:42 CEST | Starting Nmap 6.47 ( http://nmap.org ) at 2016-10-22 17:42 CEST | ||
− | Nmap scan report for | + | Nmap scan report for 192.168.0.35 |
Host is up (0.00042s latency). | Host is up (0.00042s latency). | ||
MAC Address: 42:42:42:42:42:42 (Raspberry Pi Foundation) | MAC Address: 42:42:42:42:42:42 (Raspberry Pi Foundation) | ||
<translate><!--T:34--> | <translate><!--T:34--> | ||
− | To log into our Raspberry Pi, we'll use the command | + | To log into our Raspberry Pi, we'll use the command ''ssh''.</translate> |
− | < | + | <syntaxhighlight lang="bash">ssh pi@192.168.0.35</syntaxhighlight> |
<translate><!--T:35--> | <translate><!--T:35--> | ||
The first time you'll connect to it, it will show something like:</translate> | The first time you'll connect to it, it will show something like:</translate> | ||
The authenticity of host '192.168.0.35 (192.168.0.35)' can't be established. | The authenticity of host '192.168.0.35 (192.168.0.35)' can't be established. | ||
− | ECDSA key fingerprint is 42:42:42:42:42:42:42:42:42:42:42:42:42:42:42:42. | + | ECDSA key fingerprint is 42:42:42:42:42:42:42:42:42:42:42:42:42:42:42:42. |
Are you sure you want to continue connecting (yes/no)? | Are you sure you want to continue connecting (yes/no)? | ||
<translate><!--T:36--> | <translate><!--T:36--> | ||
− | We'll choose | + | We'll choose ''Yes''</translate> |
− | Warning: Permanently added | + | Warning: Permanently added 192.168.0.35 (ECDSA) to the list of known hosts. |
− | pi@192.168.0.35's password: | + | pi@192.168.0.35's password: |
<translate><!--T:37--> | <translate><!--T:37--> | ||
− | and use the | + | and use the ''default password'': ''raspberry'' |
which on successful login will show:</translate> | which on successful login will show:</translate> | ||
The programs included with the Debian GNU/Linux system are free software; | The programs included with the Debian GNU/Linux system are free software; | ||
the exact distribution terms for each program are described in the | the exact distribution terms for each program are described in the | ||
individual files in /usr/share/doc/*/copyright. | individual files in /usr/share/doc/*/copyright. | ||
− | + | ||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
permitted by applicable law. | permitted by applicable law. | ||
− | pi@raspberrypi:~ $ | + | pi@raspberrypi:~ $ |
<translate><!--T:38--> | <translate><!--T:38--> | ||
We can configure the Raspberry Pi using a text interface via:</translate> | We can configure the Raspberry Pi using a text interface via:</translate> | ||
− | < | + | <syntaxhighlight lang="bash">sudo raspi-config</syntaxhighlight> |
<translate> | <translate> | ||
− | ===Raspberry Pi Software Configuration Tool (raspi-config)=== <!--T:39--> | + | ===Raspberry Pi Software Configuration Tool (''raspi-config'')=== <!--T:39--> |
</translate> | </translate> | ||
<translate><!--T:40--> | <translate><!--T:40--> | ||
Line 139: | Line 135: | ||
</translate> | </translate> | ||
<translate><!--T:42--> | <translate><!--T:42--> | ||
− | By default the disk space on the SD Card is the same size as the 1.4GB .img file that you used to create the SD card for your Raspberry Pi. You can use this option to gain the rest of the disk space.</translate> | + | By default the disk space on the SD Card is the same size as the 1.4GB ''.img'' file that you used to create the SD card for your Raspberry Pi. You can use this option to gain the rest of the disk space.</translate> |
<translate> | <translate> | ||
Line 145: | Line 141: | ||
</translate> | </translate> | ||
<translate><!--T:44--> | <translate><!--T:44--> | ||
− | For security reasons it's best to '''change the default password''' | + | For security reasons it's best to '''change the default password''' ''raspberry''.</translate> |
<translate> | <translate> | ||
====3 Boot Options==== <!--T:45--> | ====3 Boot Options==== <!--T:45--> | ||
− | </translate> | + | </translate> |
<translate><!--T:46--> | <translate><!--T:46--> | ||
We would like the Raspberry Pi to boot the Text console</translate> | We would like the Raspberry Pi to boot the Text console</translate> | ||
<translate> | <translate> | ||
− | =====B2 Console Autologin Text | + | =====B2 Console Autologin Text Console, Automatically Logged In As ''pi'' User===== <!--T:47--> |
− | </translate> | + | </translate> |
<translate> | <translate> | ||
Line 163: | Line 159: | ||
</translate> | </translate> | ||
<translate><!--T:50--> | <translate><!--T:50--> | ||
− | Because we will use the Raspberry Pi as a headless server without connecting it to a monitor, we can decrease the memory used for the GPU from 64 to | + | Because we will use the Raspberry Pi as a headless server without connecting it to a monitor, we can decrease the memory used for the GPU from 64 to ''16''</translate> |
<translate> | <translate> | ||
− | ==== | + | ====Five Internationalisation Options==== <!--T:51--> |
</translate> | </translate> | ||
<translate> | <translate> | ||
Line 176: | Line 172: | ||
<translate><!--T:54--> | <translate><!--T:54--> | ||
After all changes we'll Reboot the Raspberry Pi, and will login again with our new password.</translate> | After all changes we'll Reboot the Raspberry Pi, and will login again with our new password.</translate> | ||
− | < | + | <syntaxhighlight lang="bash">ssh pi@192.168.0.35</syntaxhighlight> |
<translate><!--T:55--> | <translate><!--T:55--> | ||
Now it's time to install everything else.</translate> | Now it's time to install everything else.</translate> | ||
<translate> | <translate> | ||
− | ==Update | + | ==Update Software== <!--T:56--> |
</translate> | </translate> | ||
<translate><!--T:57--> | <translate><!--T:57--> | ||
Line 187: | Line 183: | ||
<translate><!--T:58--> | <translate><!--T:58--> | ||
* '''update''' the list of software versions from all external repositories</translate> | * '''update''' the list of software versions from all external repositories</translate> | ||
− | < | + | <syntaxhighlight lang="bash">sudo apt-get update</syntaxhighlight> |
<translate><!--T:59--> | <translate><!--T:59--> | ||
* '''upgrade''' all installed software</translate> | * '''upgrade''' all installed software</translate> | ||
− | < | + | <syntaxhighlight lang="bash">sudo apt-get upgrade</syntaxhighlight> |
<translate><!--T:60--> | <translate><!--T:60--> | ||
− | + | Updating the version list and upgrading all software is something that should be done regularly.</translate> | |
<translate> | <translate> | ||
− | ==Nginx | + | ==Nginx Web Server== <!--T:61--> |
</translate> | </translate> | ||
<translate><!--T:62--> | <translate><!--T:62--> | ||
− | A fast and lightweight alternative for Apache web server is the increasingly becoming popular | + | A fast and lightweight alternative for Apache web server is the increasingly becoming popular ''Nginx'' web server.</translate> |
<translate> | <translate> | ||
Line 205: | Line 201: | ||
</translate> | </translate> | ||
<translate><!--T:64--> | <translate><!--T:64--> | ||
− | We will install | + | We will install Nginx and all dependencies with:</translate> |
− | < | + | <syntaxhighlight lang="bash"> |
− | sudo apt-get install nginx</ | + | sudo apt-get install nginx</syntaxhighlight> |
<translate><!--T:65--> | <translate><!--T:65--> | ||
We'll get a message like:</translate> | We'll get a message like:</translate> | ||
Reading package lists... Done | Reading package lists... Done | ||
− | Building dependency tree | + | Building dependency tree |
Reading state information... Done | Reading state information... Done | ||
The following extra packages will be installed: | The following extra packages will be installed: | ||
Line 224: | Line 220: | ||
Do you want to continue? [Y/n] y | Do you want to continue? [Y/n] y | ||
<translate><!--T:66--> | <translate><!--T:66--> | ||
− | By choosing | + | By choosing ''y'' Nginx and all needed packages will be installed.</translate> |
<translate><!--T:67--> | <translate><!--T:67--> | ||
You can check the installation with a browser. Go to the IP address of your Raspberry pi, in our case http://192.168.0.35/ | You can check the installation with a browser. Go to the IP address of your Raspberry pi, in our case http://192.168.0.35/ | ||
We should see a message like:</translate> | We should see a message like:</translate> | ||
− | + | Welcome to nginx on Debian! | |
If you see this page, the nginx web server is successfully installed and working on Debian. Further configuration is required. | If you see this page, the nginx web server is successfully installed and working on Debian. Further configuration is required. | ||
For online documentation and support please refer to nginx.org | For online documentation and support please refer to nginx.org | ||
− | Please use the reportbug tool to report bugs in the nginx package with Debian. | + | Please use the reportbug tool to report bugs in the nginx package with Debian. |
However, check existing bug reports before reporting a new bug. | However, check existing bug reports before reporting a new bug. | ||
− | + | Thank you for using debian and nginx. | |
<translate> | <translate> | ||
− | ====Starting and | + | ====Starting and Stopping Nginx==== <!--T:68--> |
</translate> | </translate> | ||
<translate><!--T:69--> | <translate><!--T:69--> | ||
− | After installation Nginx will automatically be started. You can:</translate> | + | After installation Nginx will automatically be started. You can:</translate> |
<translate><!--T:70--> | <translate><!--T:70--> | ||
* Stop Nginx: sudo service nginx stop</translate> | * Stop Nginx: sudo service nginx stop</translate> | ||
Line 252: | Line 248: | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
− | ====Global Nginx | + | ====Global Nginx Configuration==== <!--T:74--> |
</translate> | </translate> | ||
<translate><!--T:75--> | <translate><!--T:75--> | ||
− | In the global configuration of Nginx we can configure default caching etc. The Raspberry Pi 3 uses 1.2 GHz 64-bit '''quad-core''' ARM Cortex-A53 processor. If you have an earlier version with | + | In the global configuration of Nginx we can configure default caching etc. The Raspberry Pi 3 uses 1.2 GHz 64-bit '''quad-core''' ARM Cortex-A53 processor. If you have an earlier version with fewer CPU cores, use <syntaxhighlight lang="bash">sudo nano /etc/nginx/nginx.conf</syntaxhighlight> to change the "worker_processes" to fit the amount of CPUs of your device. By default it's configured as |
worker_processes 4;</translate> | worker_processes 4;</translate> | ||
<translate><!--T:76--> | <translate><!--T:76--> | ||
Line 261: | Line 257: | ||
<translate><!--T:77--> | <translate><!--T:77--> | ||
− | After changing the Nginx configuration or virtual domain configuration, you have to do a < | + | After changing the Nginx configuration or virtual domain configuration, you have to do a <syntaxhighlight lang="php">sudo nginx reload</syntaxhighlight> to make the changes effective.</translate> |
<translate> | <translate> | ||
Line 270: | Line 266: | ||
<translate><!--T:80--> | <translate><!--T:80--> | ||
− | Put every website in a separate folder in the default webroot /var/www/ for example:</translate> | + | Put every website in a separate folder in the default webroot ''/var/www/'' for example:</translate> |
− | * /var/www/example.com/ | + | * ''/var/www/example.com/'' |
− | * /var/www/voorbeeld.nl/ | + | * ''/var/www/voorbeeld.nl/'' |
− | < | + | <syntaxhighlight lang="bash"> |
sudo mkdir /var/www/example.com | sudo mkdir /var/www/example.com | ||
sudo mkdir /var/www/voorbeeld.nl | sudo mkdir /var/www/voorbeeld.nl | ||
− | </ | + | </syntaxhighlight> |
<translate><!--T:81--> | <translate><!--T:81--> | ||
− | For every site we will create a virtual domain | + | For every site we will create a virtual domain that is a text file with domain specific information:</translate> |
* /etc/nginx/sites-available/example.com | * /etc/nginx/sites-available/example.com | ||
server { | server { | ||
Line 285: | Line 281: | ||
server_name example.com www.example.com; | server_name example.com www.example.com; | ||
root /var/www/example.com; | root /var/www/example.com; | ||
− | + | ||
access_log /var/log/nginx/example.com.access_log; | access_log /var/log/nginx/example.com.access_log; | ||
error_log /var/log/nginx/example.com.error_log info; | error_log /var/log/nginx/example.com.error_log info; | ||
− | + | ||
location / { | location / { | ||
index index.php index.html index.htm; | index index.php index.html index.htm; | ||
Line 299: | Line 295: | ||
server_name voorbeeld.nl www.voorbeeld.nl; | server_name voorbeeld.nl www.voorbeeld.nl; | ||
root /var/www/voorbeeld.nl; | root /var/www/voorbeeld.nl; | ||
− | + | ||
access_log /var/log/nginx/voorbeeld.nl.access_log; | access_log /var/log/nginx/voorbeeld.nl.access_log; | ||
error_log /var/log/nginx/voorbeeld.nl.error_log info; | error_log /var/log/nginx/voorbeeld.nl.error_log info; | ||
− | + | ||
location / { | location / { | ||
index index.php index.html index.htm; | index index.php index.html index.htm; | ||
Line 309: | Line 305: | ||
<translate><!--T:82--> | <translate><!--T:82--> | ||
− | We need to enable every site by linking from /etc/nginx/sites-enabled/ to the virtual domain in | + | We need to enable every site by linking from ''/etc/nginx/sites-enabled/'' to the virtual domain in ''sites-available''. We create a symbolic link for each virtual domain:</translate> |
− | < | + | <syntaxhighlight lang="bash"> |
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com | sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com | ||
sudo ln -s /etc/nginx/sites-available/voorbeeld.nl /etc/nginx/sites-enabled/voorbeeld.nl | sudo ln -s /etc/nginx/sites-available/voorbeeld.nl /etc/nginx/sites-enabled/voorbeeld.nl | ||
− | </ | + | </syntaxhighlight> |
<translate><!--T:83--> | <translate><!--T:83--> | ||
− | To make this virtual domain configuration effective, we do</translate> | + | To make this virtual domain configuration effective, we do</translate> |
<translate><!--T:84--> | <translate><!--T:84--> | ||
− | < | + | <syntaxhighlight lang="bash"> |
− | sudo nginx reload</ | + | sudo nginx reload</syntaxhighlight> and when everything has been configured correctly it will respond: |
Reloading nginx configuration: nginx.</translate> | Reloading nginx configuration: nginx.</translate> | ||
Line 327: | Line 323: | ||
<translate><!--T:86--> | <translate><!--T:86--> | ||
We can install MariaDB or MySQL; Joomla will work with both. Let's install MariaDB with:</translate> | We can install MariaDB or MySQL; Joomla will work with both. Let's install MariaDB with:</translate> | ||
− | < | + | <syntaxhighlight lang="bash">sudo apt-get install mariadb-server</syntaxhighlight> |
<translate><!--T:87--> | <translate><!--T:87--> | ||
− | During the installation you've to add a password for the | + | During the installation you've to add a password for the ''root'' user.</translate> |
<translate><!--T:88--> | <translate><!--T:88--> | ||
− | Lets create a | + | Lets create a ''database password'', for example ''correcthorsebatterystaple''.</translate> |
<translate><!--T:89--> | <translate><!--T:89--> | ||
− | Finally let's improve the security of our MariaDB installation by removing root accounts that are accessible from outside the local host, anonymous-user accounts and the test database. We can do that with < | + | Finally let's improve the security of our MariaDB installation by removing root accounts that are accessible from outside the local host, anonymous-user accounts and the test database. We can do that with <syntaxhighlight lang="bash">mysql_secure_installation</syntaxhighlight></translate> |
<translate> | <translate> | ||
Line 340: | Line 336: | ||
</translate> | </translate> | ||
<translate><!--T:91--> | <translate><!--T:91--> | ||
− | For PHP we will install the | + | For PHP we will install the ''php-fpm'' (FastCGI Process Manager) that runs as a daemon and receives Fast/CGI requests. Furthermore we will install ''php5-mysql'' which is a module for MySQL database connections directly from PHP scripts.</translate> |
− | more recent php7 should be installed with | + | more recent php7 should be installed with |
− | < | + | <syntaxhighlight lang="bash">sudo apt-get install php-fpm php-mysql</syntaxhighlight> |
<translate><!--T:92--> | <translate><!--T:92--> | ||
Now we need to let Nginx know that it should use php-fpm for .php files. We add a couple of lines to our virtual domains:</translate> | Now we need to let Nginx know that it should use php-fpm for .php files. We add a couple of lines to our virtual domains:</translate> | ||
− | < | + | <syntaxhighlight lang="bash">sudo nano /etc/nginx/sites-available/example.com</syntaxhighlight> |
add: | add: | ||
location ~ \.php$ { | location ~ \.php$ { | ||
Line 357: | Line 353: | ||
<translate><!--T:93--> | <translate><!--T:93--> | ||
Test it by creating the following PHP file</translate> | Test it by creating the following PHP file</translate> | ||
− | < | + | <syntaxhighlight lang="bash">sudo nano /var/www/example.com/test.php</syntaxhighlight> |
− | < | + | <syntaxhighlight lang="php"><?php phpinfo();?></syntaxhighlight> |
<translate><!--T:94--> | <translate><!--T:94--> | ||
We use a browser to test if we see the PHP configuration page at http://192.168.0.35/example.com/test.php</translate> | We use a browser to test if we see the PHP configuration page at http://192.168.0.35/example.com/test.php</translate> | ||
Line 365: | Line 361: | ||
<translate><!--T:95--> | <translate><!--T:95--> | ||
* to do</translate> | * to do</translate> | ||
− | < | + | <syntaxhighlight lang="bash">sudo wget https://github.com/joomla/joomla-cms/releases/download/3.6.3/Joomla_3.6.3-Stable-Full_Package.zip |
− | sudo unzip -x Joomla_3.6.3-Stable-Full_Package.zip</ | + | sudo unzip -x Joomla_3.6.3-Stable-Full_Package.zip</syntaxhighlight> |
<translate> | <translate> | ||
Line 372: | Line 368: | ||
</translate> | </translate> | ||
<translate><!--T:97--> | <translate><!--T:97--> | ||
− | We want people on the internet to be able to visit our Joomla website on our Raspberry Pi. In order to do that we need to | + | We want people on the internet to be able to visit our Joomla website on our Raspberry Pi. In order to do that we need to configure our Internet router to forward all incoming traffic on port 80 to our Raspberry Pi.</translate> |
<translate><!--T:98--> | <translate><!--T:98--> | ||
− | Use your web browser to connect to the | + | Use your web browser to connect to the web Interface of your router. A router is usually located on the first number of your IP range, in our case on 192.168.0.1. In our router we configure Port Forwarding:</translate> |
* External IP Address: 0.0.0.0 | * External IP Address: 0.0.0.0 | ||
* External Start Port: 80 | * External Start Port: 80 | ||
Line 387: | Line 383: | ||
<translate><!--T:100--> | <translate><!--T:100--> | ||
− | If everything is working correctly | + | If everything is working correctly you should see your own Joomla website on the Raspberry Pi by visiting your external IP address (Find your external IP address with a tool like [https://www.whatsmyip.org/ whatsmyip.org]).</translate> |
<translate> | <translate> | ||
− | ===Using a | + | ===Using a Domain Name=== <!--T:101--> |
</translate> | </translate> | ||
<translate><!--T:102--> | <translate><!--T:102--> | ||
− | Let's assume that our external IP address is 42.42.42.42. Let's also assume that we have registered a domain name called example.com. We would like to serve our Joomla site on our Raspberry Pi to visitors visiting example.com. If your domain name registrar gives us the possibility to configure the | + | Let's assume that our external IP address is 42.42.42.42. Let's also assume that we have registered a domain name called ''example.com''. We would like to serve our Joomla site on our Raspberry Pi to visitors visiting ''example.com''. If your domain name registrar gives us the possibility to configure the ''Domain Name System (DNS)'' server, we'll need to create an ''MX record'' in the DNS that points our ''domain name to'' our IP address 42.42.42.42. Note that it can take up to 24 hours until all internet providers will redirect the traffic of their customers to the configured MX record.</translate> |
<translate> | <translate> | ||
− | ===Static IP | + | ===Static IP Address=== <!--T:103--> |
</translate> | </translate> | ||
<translate><!--T:104--> | <translate><!--T:104--> | ||
Most routers will keep assigning the same internal IP address to your Raspberry Pi. Sometimes it's better to configure your Raspberry Pi to use a static IP address:</translate> | Most routers will keep assigning the same internal IP address to your Raspberry Pi. Sometimes it's better to configure your Raspberry Pi to use a static IP address:</translate> | ||
− | < | + | <syntaxhighlight lang="bash">sudo nano /etc/network/interfaces</syntaxhighlight> |
<translate><!--T:105--> | <translate><!--T:105--> | ||
− | change</translate> | + | change</translate> |
− | iface eth0 inet static | + | iface eth0 inet static |
<translate><!--T:106--> | <translate><!--T:106--> | ||
to</translate> | to</translate> | ||
− | iface eth0 inet static | + | iface eth0 inet static |
− | address 192.168.0.35 | + | address 192.168.0.35 |
netmask 255.255.255.0 | netmask 255.255.255.0 | ||
gateway 192.168.0.1 | gateway 192.168.0.1 | ||
Line 413: | Line 409: | ||
<translate><!--T:107--> | <translate><!--T:107--> | ||
The gateway is the IP address of your router. You can also find it using</translate> | The gateway is the IP address of your router. You can also find it using</translate> | ||
− | < | + | <syntaxhighlight lang="bash">route</syntaxhighlight> |
<translate> | <translate> | ||
Line 421: | Line 417: | ||
* [https://raspberrypi.org Raspberry Pi Foundation] (RPF) - official website and forums</translate> | * [https://raspberrypi.org Raspberry Pi Foundation] (RPF) - official website and forums</translate> | ||
<translate><!--T:110--> | <translate><!--T:110--> | ||
− | * [ | + | * [https://elinux.org/RPi_Hub Raspberry Pi Wiki], supported by the RPF</translate> |
<translate><!--T:111--> | <translate><!--T:111--> | ||
− | * Video of presentation [https:// | + | * Video of presentation [https://www.youtube.com/watch?v=u2MFQCoexD0 Joomla on Raspberry Pi (with Nginx)] at Joomla!Day Germany 2013 in Nuremberg, Germany</translate> |
<noinclude> | <noinclude> |
Latest revision as of 21:18, 16 November 2022
This article or section is incomplete, which means it may be lacking information. You are welcome to assist in its completion by editing it as well. If this article or section has not been edited in several days, please consider helping complete the content.
This article was last edited by Cmb (talk| contribs) 2 years ago. (Purge)
The Raspberry Pi is a small single-board computer that was originally developed to promote the teaching of basic computer science in schools and developing countries. Because of its versatility it has become very popular and is used as media player, small stand-alone server, etc. You can use it as web server and install Joomla! on it. This page shows you how to get a your Joomla! website running on the Raspberry Pi.
Hardware[edit]
- Raspberry Pi version 3 Model B - There are various models of Raspberry Pi. You can use most models that have an Ethernet port (the Model B types). However for performance we will use the latest version with most RAM memory.
- micro SD card - For the operating system + web server + Joomla. (RPi version 3 model B uses micro SD other versions might use normal SD cards)
- 5 Volt adapter (1 Amp) - to power the Raspberry Pi you'll need to convert the mains power (230V or 110V) to 5 Volt. The Raspberry Pi needs about 1 Amp, and maybe more if you connect USB devices to it.
- standard Ethernet cable - to connect the RPi to your Local Area Network / router / the internet.
Installing Operating System[edit]
The operating system Raspbian is a Debian Linux version specially compiled for the Raspberry Pi. There are two versions of Raspbian available: Raspbian Jessie with Pixel Lite (version with PIXEL desktop based on Debian Jessie) and Raspbian Jessie Lite (minimal version based on Debian Jessie). Because we use the Raspberry Pi as a web server for Joomla, we won't need the GUI.
Download Raspbian Jessie Lite and unzip the downloaded file, e.g. 2016-09-23-raspbian-jessie-lite.zip (306 MB) to 2016-09-23-raspbian-jessie-lite.img (1.4 GB).
Now we need to copy the .img file to the (micro) SD card. You can use a tool with graphical interface such as UNetbootin (for Windows, Mac OS X and Linux) or do it on the command line.
Be careful when writing the .img disk image to another disk. If you specify the wrong destination disk, you will overwrite that disk with the .img which makes that disk unusable, resulting in data loss.
Windows[edit]
In a terminal (CMD) check which device corresponds with the SD Card and do something like:
dd bs=1M if=c:\temp\2016-09-23-raspbian-jessie-lite.img od=[the device of your SD Card]
See also Installing Operating System Images using Windows
Apple OSX[edit]
Check which device is used for your SD Card. In our case it's disk1s1 and we'll do in Terminal:
sudo dd bs=1M if=~/Downloads/2016-09-23-raspbian-jessie-lite.img of=/dev/disk1s1
See also: Installing Operating System Images on MacOS
Linux[edit]
We connect a SD Card reader with the (micro) SD Card to a computer. With dmesg we can find the device name of the SD Card. In our case dmesg shows something like
[xxxxxx.xxxxxxx] sdd: sdd1 sdd2
meaning that we have a SD Card with 2 partitions. Do not write the Raspbian image to a partition but to the whole disk sdd.
We will use dd ("Disk Dump") to write an Input File (if) to an Output File (of) using a specified Block Size (bs).
Be careful dd will write to a device without any warning. Double check that that you write to the correct device. If you write to the wrong disk, you'll always remember the dd command as "Disk Destroyer".
sudo dd if=~/Downloads/2016-09-23-raspbian-jessie-lite.img of=/dev/sdd bs=4M
See also Installing Operating System Images on Linux
WARNING for Raspbian Stretch version: to have a SSH server working from boot you need to create an empty file ssh on the root partition.
Connecting Raspberry Pi to LAN[edit]
When we have installed the Raspbian Operating System on the SD Card, we will:
- Insert the micro SD card in the SD Card slot on the Raspberry Pi.
- Connect an an Ethernet cable to the Raspberry Pi and to the Local Area Network (connect it to our router).
- Connect the 5V power supply to the the Raspberry Pi.
Booting up the Raspberry Pi takes roughly 30 seconds. We've to find the IP address to connect to it using SSH. We can use different approaches for that:
- log into the web interface of your router and look up the connected devices;
- use a mobile phone connected the wi-fi router using a network scanning App called Fing Overlook;
- use a command like nmap. Assuming that our PC has IP address 192.168.0.25 we can find all other devices in the same network range by doing the following:
sudo nmap -sP 192.168.0/24
Which might show the following details:
Starting Nmap 6.47 ( http://nmap.org ) at 2016-10-22 17:42 CEST Nmap scan report for 192.168.0.35 Host is up (0.00042s latency). MAC Address: 42:42:42:42:42:42 (Raspberry Pi Foundation)
To log into our Raspberry Pi, we'll use the command ssh.
ssh pi@192.168.0.35
The first time you'll connect to it, it will show something like:
The authenticity of host '192.168.0.35 (192.168.0.35)' can't be established. ECDSA key fingerprint is 42:42:42:42:42:42:42:42:42:42:42:42:42:42:42:42. Are you sure you want to continue connecting (yes/no)?
We'll choose Yes
Warning: Permanently added 192.168.0.35 (ECDSA) to the list of known hosts. pi@192.168.0.35's password:
and use the default password: raspberry which on successful login will show:
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. pi@raspberrypi:~ $
We can configure the Raspberry Pi using a text interface via:
sudo raspi-config
Raspberry Pi Software Configuration Tool (raspi-config)[edit]
With this configuration tool we'll only change the following settings.
1 Expand Filesystem[edit]
By default the disk space on the SD Card is the same size as the 1.4GB .img file that you used to create the SD card for your Raspberry Pi. You can use this option to gain the rest of the disk space.
2 Change User Password[edit]
For security reasons it's best to change the default password raspberry.
3 Boot Options[edit]
We would like the Raspberry Pi to boot the Text console
B2 Console Autologin Text Console, Automatically Logged In As pi User[edit]
9 Advanced Options[edit]
A3 Memory Split[edit]
Because we will use the Raspberry Pi as a headless server without connecting it to a monitor, we can decrease the memory used for the GPU from 64 to 16
Five Internationalisation Options[edit]
I2 Change Timezone[edit]
We'll change the Timezone to our own time zone (e.g. Europe/Amsterdam)
After all changes we'll Reboot the Raspberry Pi, and will login again with our new password.
ssh pi@192.168.0.35
Now it's time to install everything else.
Update Software[edit]
Before installing anything else, we'll:
- update the list of software versions from all external repositories
sudo apt-get update
- upgrade all installed software
sudo apt-get upgrade
Updating the version list and upgrading all software is something that should be done regularly.
Nginx Web Server[edit]
A fast and lightweight alternative for Apache web server is the increasingly becoming popular Nginx web server.
Installation of Nginx[edit]
We will install Nginx and all dependencies with:
sudo apt-get install nginx
We'll get a message like:
Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libtiff5 libvpx1 libxpm4 libxslt1.1 nginx-common nginx-full Suggested packages: libgd-tools fcgiwrap nginx-doc ssl-cert The following NEW packages will be installed: fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libtiff5 libvpx1 libxpm4 libxslt1.1 nginx nginx-common nginx-full 0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded. Need to get 3,550 kB of archives. After this operation, 8,666 kB of additional disk space will be used. Do you want to continue? [Y/n] y
By choosing y Nginx and all needed packages will be installed.
You can check the installation with a browser. Go to the IP address of your Raspberry pi, in our case http://192.168.0.35/ We should see a message like:
Welcome to nginx on Debian! If you see this page, the nginx web server is successfully installed and working on Debian. Further configuration is required. For online documentation and support please refer to nginx.org Please use the reportbug tool to report bugs in the nginx package with Debian. However, check existing bug reports before reporting a new bug. Thank you for using debian and nginx.
Starting and Stopping Nginx[edit]
After installation Nginx will automatically be started. You can:
- Stop Nginx: sudo service nginx stop
- Start Nginx: sudo service nginx start
- Restart Nginx: sudo service nginx restart
Configure Nginx[edit]
Global Nginx Configuration[edit]
In the global configuration of Nginx we can configure default caching etc. The Raspberry Pi 3 uses 1.2 GHz 64-bit quad-core ARM Cortex-A53 processor. If you have an earlier version with fewer CPU cores, use
sudo nano /etc/nginx/nginx.conf
to change the "worker_processes" to fit the amount of CPUs of your device. By default it's configured as
worker_processes 4;
so for Raspberry Pi 3 you don't have to change it.
After changing the Nginx configuration or virtual domain configuration, you have to do a
sudo nginx reload
to make the changes effective.
Virtual Domains[edit]
It's possible to run multiple Joomla websites on the same server using virtual domains.
Put every website in a separate folder in the default webroot /var/www/ for example:
- /var/www/example.com/
- /var/www/voorbeeld.nl/
sudo mkdir /var/www/example.com
sudo mkdir /var/www/voorbeeld.nl
For every site we will create a virtual domain that is a text file with domain specific information:
- /etc/nginx/sites-available/example.com
server { listen 80; server_name example.com www.example.com; root /var/www/example.com;
access_log /var/log/nginx/example.com.access_log; error_log /var/log/nginx/example.com.error_log info;
location / { index index.php index.html index.htm; } }
- /etc/nginx/sites-available/voorbeeld.nl
server { listen 80; server_name voorbeeld.nl www.voorbeeld.nl; root /var/www/voorbeeld.nl;
access_log /var/log/nginx/voorbeeld.nl.access_log; error_log /var/log/nginx/voorbeeld.nl.error_log info;
location / { index index.php index.html index.htm; } }
We need to enable every site by linking from /etc/nginx/sites-enabled/ to the virtual domain in sites-available. We create a symbolic link for each virtual domain:
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com
sudo ln -s /etc/nginx/sites-available/voorbeeld.nl /etc/nginx/sites-enabled/voorbeeld.nl
To make this virtual domain configuration effective, we do
sudo nginx reload
and when everything has been configured correctly it will respond:
Reloading nginx configuration: nginx.
Database[edit]
We can install MariaDB or MySQL; Joomla will work with both. Let's install MariaDB with:
sudo apt-get install mariadb-server
During the installation you've to add a password for the root user. Lets create a database password, for example correcthorsebatterystaple.
Finally let's improve the security of our MariaDB installation by removing root accounts that are accessible from outside the local host, anonymous-user accounts and the test database. We can do that with
mysql_secure_installation
PHP[edit]
For PHP we will install the php-fpm (FastCGI Process Manager) that runs as a daemon and receives Fast/CGI requests. Furthermore we will install php5-mysql which is a module for MySQL database connections directly from PHP scripts.
more recent php7 should be installed with
sudo apt-get install php-fpm php-mysql
Now we need to let Nginx know that it should use php-fpm for .php files. We add a couple of lines to our virtual domains:
sudo nano /etc/nginx/sites-available/example.com
add:
location ~ \.php$ { fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; }
Test it by creating the following PHP file
sudo nano /var/www/example.com/test.php
<?php phpinfo();?>
We use a browser to test if we see the PHP configuration page at http://192.168.0.35/example.com/test.php
Joomla![edit]
- to do
sudo wget https://github.com/joomla/joomla-cms/releases/download/3.6.3/Joomla_3.6.3-Stable-Full_Package.zip
sudo unzip -x Joomla_3.6.3-Stable-Full_Package.zip
Connecting Raspberry Pi to Internet[edit]
We want people on the internet to be able to visit our Joomla website on our Raspberry Pi. In order to do that we need to configure our Internet router to forward all incoming traffic on port 80 to our Raspberry Pi.
Use your web browser to connect to the web Interface of your router. A router is usually located on the first number of your IP range, in our case on 192.168.0.1. In our router we configure Port Forwarding:
- External IP Address: 0.0.0.0
- External Start Port: 80
- External End Port: 80
- Internal IP Address: 192.168.0.35 ( = our Raspberry Pi)
- Internal Start Port: 80
- Internal End Port: 80
- Protocol: TCP
Make sure that it is enabled.
If everything is working correctly you should see your own Joomla website on the Raspberry Pi by visiting your external IP address (Find your external IP address with a tool like whatsmyip.org).
Using a Domain Name[edit]
Let's assume that our external IP address is 42.42.42.42. Let's also assume that we have registered a domain name called example.com. We would like to serve our Joomla site on our Raspberry Pi to visitors visiting example.com. If your domain name registrar gives us the possibility to configure the Domain Name System (DNS) server, we'll need to create an MX record in the DNS that points our domain name to our IP address 42.42.42.42. Note that it can take up to 24 hours until all internet providers will redirect the traffic of their customers to the configured MX record.
Static IP Address[edit]
Most routers will keep assigning the same internal IP address to your Raspberry Pi. Sometimes it's better to configure your Raspberry Pi to use a static IP address:
sudo nano /etc/network/interfaces
change
iface eth0 inet static
to
iface eth0 inet static address 192.168.0.35 netmask 255.255.255.0 gateway 192.168.0.1
The gateway is the IP address of your router. You can also find it using
route
External links[edit]
- Raspberry Pi Foundation (RPF) - official website and forums
- Raspberry Pi Wiki, supported by the RPF
- Video of presentation Joomla on Raspberry Pi (with Nginx) at Joomla!Day Germany 2013 in Nuremberg, Germany