Installing Joomla on a Raspberry Pi: Difference between revisions
From Joomla! Documentation
| Line 164: | Line 164: | ||
==Joomla!== | ==Joomla!== | ||
* to do | |||
<source lang="bash">sudo wget https://github.com/joomla/joomla-cms/releases/download/3.6.3/Joomla_3.6.3-Stable-Full_Package.zip | <source 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</source> | sudo unzip -x Joomla_3.6.3-Stable-Full_Package.zip</source> | ||
Revision as of 17:34, 22 October 2016
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 webserver and install Joomla! on it. This page shows you how to get a your Joomla! website running on the Raspberry Pi.
Hardware
- Rasberry 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 + webserver + 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 Rasperry 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
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 webserver 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 like UNetbootin (for Windows, Mac OS X and Linux) or do it on the command line.
Be very careful when writing the .img disk image to another disk. In case you use the wrong destination disk, you will overwrite that disk with the .img which makes that disk unusable, resulting in data loss.
Windows
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
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
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 VERY careful: dd will write to a device without any warning. Triple double check that that you write to the right device! If you write to the wrong disk, then 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
Connecting Raspberry Pi to LAN
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 webinterface of your router and look up the connected devices;
- use a mobile phone connected the Wifi 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)
With this configuration tool we'll only change the following settings.
1 Expand Filesystem
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
For security reasons it's best to change the default password "raspberry" as soon as possible.
3 Boot Options
We would like the Raspberry Pi to boot the Text console
B2 Console Autologin Text console, automatically logged in as 'pi' user
9 Advanced Options
A3 Memory Split
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
5 Internationalisation Options
I2 Change Timezone
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
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 Webserver
A fast and lightweight alternative for Apache web server is the increasingly becoming popular Nginx web server.
Installation of Nginx
We will install nginx and all dependencies (read: software that nginx needs to work) 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.
Configure Nginx
Global Nginx configuration
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 less CPU cores, then you should 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.
Virtual Domains
- to do
Starting Nginx webserver
sudo service nginx start
PHP
- to do
MySQL
- to do
Joomla!
- 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
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 then 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).
Static IP address
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
- 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 Joomladay Germany 2013 in Nuremberg, Germany