free hit counter

The Raspberry Pi is such a wonderful device for hosting websites. Where else can you get a full time web server that not only costs about than $40 to purchase, but also the fact that it costs less than $5 a year to keep running is phenominal! I have been using Raspberry Pi's as webservers here at home since the Model A was introduced. I received my first Model A in May, 2012, and since then, I have also aquired two Model B (512MB RAM), One Model B+ and finally one Pi 2 (with another just ordered and on the way from Amazon).

The Two Model B's are running Samba and SFTP for my Network Attached Storage at home, The Model B+ was my primary webserver until the Pi 2 showed up, and now is a secondary internal network webserver. The Pi 2 is my live server, accessible from the internet through the home IP address and port forwarding. The second Pi 2 that is coming will actually be colocated at a datacenter.

The Raspberry Pi 2 is perfect for use as a small webserver. With a 900MHz Quad-core ARM Cortex-A7 and 1GB LPDDR2 RAM memory and the fact that it does indeed run off a 5V 2Amp Mobile Phone wall charger with a MicroUSB plug really makes it perfect for home (or small business) use.

Since this article is about installing Joomla on a Raspberry Pi 2 (Model B) on your home network, let's get into it!

20150720 223836Raspberry Pi 2, Model B with enclosure/fan combo - Purchased for $59USD from Amazon.com

A Note about MicroSD Cards:

I purchased 128GB MicroSD Cards specifically to use with the Pi2, but the Pi doesn't seem to recognize either one (made by Sandisk), but it does indeed recognize a 64GB Extreme Pro II card (also Sandisk) with write speeds Up To 95MB/s. It was well worth the $53 to have the faster speeds as this is going to be a web server, after all.

In the image above, I did attach the 128GB microSD through the USB adaptor for SFTP storage, not related to this tutorial.

Other Parts Purchased:

Also, The Pi 2 is housed in a TonTec Transparent Cover Box Enclosure with Mini FanTransparent Cover Box Enclosure with Mini Fan that was included in the $59 combo deal. It's powered by the GPIO pins so there's no worry about having to run an extra power line.

Not shown:

Powering the Raspberry Pi 2 is a RAVPower 4.8A Dual USB Wall Charger which supplies 2.4V to each of it's two USB ports (enough for two Pi 2 Model B's). I purchased two of these chargers also off Amazon for $8USD each.

This tutorial also works on a Raspberry Pi Model B and Model B+

If you haven't already downloaded, installed and configured the Raspbian OS, do so now. For the sake of those who already know, there's a wonderful tutorial on how to get the MicroSD card setup from Lifehacker:

You will need to SSH to your Raspberry Pi 2 and use the command line to perform the work. If you don't know how to connect via SSH to your Pi, check out "Use SSH to Talk With Your Raspberry Pi" on Instructables.

This Tutorial Covers A Home Web Server That Is NOT Accessible From The Internet (I do not cover port forwarding, apache2 virtual host configuration or Pointing the Domain name)

What Is The Pi's IP Address?

You can see what the Pi's IP address is by either logging into your router and checking the connected IPs, or if you have the Pi connected to a keyboard and monitor, just open up the terminal and type in:

ifconfig

You will find the IP address under ETH0 if you are cable connected, or WLAN0 if you are on WI-FI.

Setting The Raspberry Pi Server Time

You'll want to make sure that the Raspberry Pi clock is running in your timezone, so first thing you should do is run:

sudo dpkg-reconfigure tzdata

Just set your country and select the correct timezone.

Next update and upgrade your Raspberry Pi:

sudo apt-get update && sudo apt-get upgrade -y

IMPORTANT: If you haven't done so already, change the default password for user "pi" now. Since my Pi will be accessible on the internet, we don't need to make life easy for hackers by leaving the generic password in place. To change the password for the "pi" user (I'm assuming you've connected via SSH with the pi user):

sudo passwd pi

Now, just enter your new password twice to set the password.

Install Apache2, PHP and MySQL:

sudo apt-get install apache2 php5 libapache2-mod-php5 php5-gd php5-curl mysql-server mysql-client php5-mysql -y

The installer will ask you to enter a password for the root MySQL user twice during this operation.

Now, just restart Apache2:

sudo service apache2 restart

Create The Joomla Database and Database User:

Enter into MySQL by typing the following command:

MSQL -u root -p

It will prompt you for a password. use the one you just set up in the previous step.

Create the Joomla Database

We will call the database "joomla" for this tutorial, but you can name it whatever you wish.

CREATE DATABASE joomla;

Now, Create the Database user: (replace newuser with a desired username, and password with the desired password (a-z, 0-9))

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

Now, you have to grant the permissions to the user on the database

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost' identified by 'password';

Lastly, reload all the privileges:

FLUSH PRIVILEGES;

Install Joomla on your Raspberry Pi 2

Now you want to go to the web accessible directory.

cd /var/www

once here, you need to download Joomla! Go to the Joomla! Github releases page and copy the link for the latest ZIP version.

copy joomla link

On the command prompt in your SSH window, type:

wget (paste link here)

so in this case, it looks like this:

wget https://github.com/joomla/joomla-cms/releases/download/3.4.3/Joomla_3.4.3-Stable-Full_Package.zip

Joomla will now download. Once complete, unzip it:

unzip (packagename_here.zip)

which in my tutorial here, would look like this:

unzip Joomla_3.4.3-Stable-Full_Package.zip

The Joomla files have now been installed.

Now you need to give "www-data" ownership of the www folder:

chown -R www-data:www-data /var/www

Configure Joomla From Your Web Browser

At this time, open your web browser and enter the IP address of your Raspberry PI. You will find the standard Joomla web install page:

1

Fill in the site name, your email address, the username and password for the admin user (you), and click the next button.

2

The next screen is the database screen. Fill the field out with your database name, database username and password that you previously created in the MySQL part of the tutorial above. The table prefix is automatically populated, so you can leave this alone. Also, you can leave "Old Database Process" alone because this is a new installation.

3j

Finally, you can just click Install on the "Finalisation" page to begin the installation.

installing joomla

The installer will complete within 5 minutes and you'll see the "Congratulations" screen below:

congrats

Click the orange "Remove installation folder" button to remove the install folder. The button will change to say "Installation folder successfully removed" when complete.

install folder removed

Finally, you can click either the SITE button to view the front end of your new Joomla site running on the Raspberry Pi 2:

frontend

Or you can login to the admin panel at http://(yourIPaddresshere)/administrator - for this tutorial, if my raspberry Pi's IP address was 192.168.1.100, then the login URL would be:

http://192.168.1.100/administrator

joomla administrator login

And successfully logging in, you will be greeted by your Joomla Administrator Control Panel!

joomla admin control panel

Speeding Up Your Joomla Website Running On A Raspberry Pi 2, Model B

Don't be suprised if your Joomla site is running slow right now. That's expected. We need to go back to the control panel and install memcached and APC in order to speed things up a bit.

Back in your command line SSH terminal, install Memcached:

sudo apt-get install memcached -y

Memcashed will install and complete.

Install APC on Raspberry Pi

Now install the APC dependencies first:

sudo apt-get install php-pear php5-dev make libpcre3-dev php5-apc

Now install APC itself:

sudo pecl install apc

You will be asked a number of questions but unless you know exactly what you are enabling, go with the defaults by hitting Enter.

Now, you will need to edit the php.ini file on your raspberry pi, but in order to do this, you have to install "NANO" a simple text editor:

sudo apt-get install nano -y

Now that nano is installed, edit the PHP.ini file:

sudo nano /etc/php5/apache2/php.ini

scoll down to the bottom of the file by hitting the "page down" button repeatedly until you can't go any further, then type:

extension = apc.so

and hit CTRL-x

Then the Y key

This will save the file. You now need to restart Apache2 for the changes to take place:

sudo service apache2 restart

And that's It! You've installed Joomla on a Raspberry Pi 2 (model b)! Have fun!


About Joomla Resources

JoomlaResources.com is an unofficial blog for Joomla! news, extensions, templates and other useful information. We are in no way affiliated with or endorsed by Open Source Matters or the Joomla! Project. The official resources page is located at resources.joomla.org

powered by Joomla

Web Hosting