Installing Joomla! on a LAMP Server

Creating a Basic Joomla! Site in Under 20 Minutes with a Linux, Apache, MySQL, PHP System

Brendan W Vittum
So you want a web site. You want it to be easy to use. You want to be able to update, edit, and manage content on the fly. You'd prefer not to pay an arm and a leg, but you also want to have a number of features in the system like commenting, maybe even a forum, member profiles.

Your list could go on indefinitely, but let me stop you right here. There is an Open Source Content Management System [CMS] known as Joomla! which can help you. Actually there are a number of systems, free or otherwise, you could use to accomplish this goal.

I may cover some of those other options later. For now let's simply assume you would like a system which could be running in a matter of minutes, has a massive base of add-ons, and a thriving community behind its development and security, the Joomla! Content Management System, or CMS for short, is one of the simplest and most thought-free systems around.

How simple? I can take a functional server from nothing to a base install of Joomla! in about twenty minutes flat. So can you with a little practice, or if you follow this walk through.

We will assume for the sake of this article that you have SSH access to your server, and that you have both a mySQL database and a phpMyAdmin interface. We also assume you have a basic knowledge of Linux, these various tools, and that you both run a caged domain name server, and your web server site folders are housed within the var folder.

Our first step is to create a folder on our web server to hold the install, and eventfully serve our pages. We do this like so:

Log in to the server via SSH. You may need to switch to the root user or use sudo to have appropriate privileges. It really depends on how your system is setup.

1. Switch to the top level where you'd like the install to go.
2. cd /var/www/

Now we need to make the folders for our new site. For my server we need four folders, first the main, then the three sub-folders required for the web server to function properly.

1. mkdir demo.testlive.us
2. mkdir demo.testlive.us/cgi-bin
3. mkdir demo.testlive.us/html
4. mkdir demo.testlive.us/logs

Now that the our folders are created let's add the site to our Domain Name Server. As you can see from the above folder names, I am using a sub-domain of the name testlive.us. Clearly you will need to use something else but the example serves.

Open the zone file containing the configuration for the domain you intend to use in your favorite text editor. We will open the zone file for our testlive.us site in this example using Nano. I run a "Caged" name server so my files an yours may be in different locations.

1. nano /var/cache/bind/testlive.us.zone
2. Add the proper line to the file; in our case it will be:

demo. IN CNAME mail

3. Restart the name server.
4. Finally, ping the new sub-domain to ensure everything works as it should; if you use an external name server such as GoDaddy, you'll need to add the name there as well if the outside world is to view your served site.

With our folders created, and the internal Name Server resolving properly, we need to next create the configuration for Apache to serve our new site. Because there are many ways to do this, I will again let you find the best means for your system. In my case it would like so:

1. nano /etc/apache2/sites-available/demo.testlive.us

# virtual host for demo.testlive.us

DocumentRoot /var/www/demo.testlive.us/html/
ScriptAlias /cgi-bin/ "/var/www/demo.testlive.us/cgi-bin/"
ServerAdmin webmaster@somedomain.com
ServerName demo.testlive.us
CustomLog /var/www/demo.testlive.us/logs/access.log combined
ErrorLog /var/www/demo.testlive.us/logs/error.log

Now we need to link it in the enabled sites folder

1. ln -s /etc/apache2/sites-available/demo.testlive.us.conf demo.testlive.us
2. Let's restart the server and see if things are good.
3. lynx http:// demo.testlive.us

If things went well and everything is working properly you see an empty index listing in your Lynx browser. If so, great! If not, try retracing your steps. On more than one occasion I have been thrown off by an accidental comma that should have been a period.

Assuming everything went well, let's get the latest stable version of Joomla! And download it to the HTML folder we just tested. Head over to the Joomla! download site located at http://www.joomla.org/download.html and download the latest stable release. Once you have downloaded the installation package you need to extract the files. As with configuring the apache settings above, there are many ways to do this and I'll let you choose the one which works for you.

Once you extract the files we need to set the permissions on the folders in order to be able to run the installation through a web browser interface.

First we give the web server ownership of the HTML folder and everything inside to our web sever user. In the case of my setup the user and group with privileges to run the web server is www-data. If you use a different name for this user you will need to substitute in the example below.

1. cd /var/www/demo.testlive.us/
2. chown www-data:www-data -R html
3. switch to the html folder: cd html

After setting ownership of the files and folders within the HTML folder to the web server user, we need to assign the privileges which will allow the public to view our site, yet only allowing our web server to make serious changes like writing configuration files in real-time. Change the permissions on the files and folders:

1. find . -type f -exec chmod 644 {} \;
2. find . -type d -exec chmod 755 {} \;

You are almost done! We need to make the database our Joomla! site will use. Again, there are a great deal of ways one can do this. I will use phpMyAdmin for the sake of ease.

1. Log in to your phpMyAdmin interface.
2. Create a blank database.
3. Create a user and a secure password.
4. Give your new user all privileges on the database you just created; only that user, and only that database. This will help to isolate access and control security. If you are going to run multiple databases on the server this is very important.

Now, our name server, web server, and database server are good to go. Let's install our Joomla! Content Management System. Open the URL for the site you configured earlier in your browser. The web-based installer is pretty straightforward, but here are the steps:

1. Choose your site's primary language and click Next.
2. Assuming your preinstallation check passes, click Next.

If it does not you'll need to address the failed tests marked with a red "no". Run through the aboove steps and see if you missed a permission or privilege. Click the button to Check Again and repeat if there are still failures, otherwise we move on to the next steps:

3. Review the license and, assuming you agree, accept.
4. On the database configuration tab fill in the data for the database and user you created.

There is no need to deal with the advanced configurations here, or the FTP data you see on the next screen because we are doing things much more securely and using SSH.

On the next screen give the site a name, enter your email address, and the password you want to use for the site, then decide if you want an empty site you build from scratch or if you would like to populate the system with sample data.

Finally in your SSH shell use these commands:

1. rm -R installation/
2. chmod 444 configuration.php

These two commands remove the files for the actual install and make your system configuration file unreadable by anyone but the web server user which tightens your security, You now have a functioning Joomla! Site you can use for all sorts of things. You are now set to start putting data on the web instantly and ready to start building a community.

Disclaimer: This article is not of a novice level. It assumes that the user is both knowledgeable and experienced with LAMP systems and shell editing. It is deigned to be an example and nothing more. Changing names and paths will allow this walk-through to be applied to any reasonable system. As always, use at your own risk - these are the steps that work for myself and on my system.

Published by Brendan W Vittum

Brendan W Vittum is a self-styled Poet, Author, Philosopher, Photographer, Graphic Designer, and Hardware & Software Specialist whose experience spans more than 25 years. His works have been published in a v...   View profile

To comment, please sign in to your Yahoo! account, or sign up for a new account.