Installing concrete5 on Debian (2012)
Today I spent a little time looking at concrete5 — a PHP-based content management system I’d never heard of until recently. The message of concrete5 is strong “CMS made for Marketing but built for Geeks” — and so I decided to take a look at just how geek friendly it was. My first step was to get it installed and configured on Debian — the web server operating system of choice for many geeks.
The first step was to head over to the concrete5 website and download the software.
From the download page, I chose “Download from Sourceforge” as it’ll be quicker and easier to download it directly to my server from Sourceforge.
Once on the Sourceforge page, I simply right-click on the download button, and copy the link address. This is a nice, simply trick that’ll give me a URL I can paste directly into a terminal running on my server.
Paste that URL into a temporary text document for now, you’ll need it again later.
Now, I head over to my server for a few quick steps that’ll make installing concrete5 easy. These steps are:
- Installing Apache, MySQL and PHP.
- Configuring Apache with a temporary hostname for our testing site.
- Creating a MySQL database and user for concrete5.
- Extracting the concrete5 files into the correct location.
- Fixing file permissions on the server to allow Apache to write directly to concrete’s configuration folder.
I’m connecting to my server using a command line SSH client, but you can use PuTTY or whatever other SSH client you prefer.
Installing the packages
As root, I ran the following command:
apt-get install apache2 mysql-server php5 php5-gd php-pear php5-mysql dtrx
This will give me Apache (version 2.2), MySQL server, PHP5, the Graphics Draw (GD) library for PHP, the PEAR packaging system and finally the MySQL library for PHP. I find these all to be pretty essential with virtually any PHP/MySQL application (even GNU FM and GNU social) so it’s good to have them installed.
DTRX? DTRX is a tool that “does the right extraction” — it’s a useful tool to have installed if you deal with a variety of zip, tar, etc files from various people — it’ll detect if they failed to make a folder inside the archive and avoid you having a folder full of unwanted files. And its awesome.
With this completed, I move on to the next step, configuring Apache to give me a temporary hostname for this testing site.
Temporary hostnames
If you have your own domain name, and you build a lot of testing sites, you might find it easier to use a wildcard DNS of your own and simply point ALL subdomains of your domain at your server. My DNS situation is a little more complex, and so ironically I’ve taken to using a less orthodox approach to DNS of late, but only when it comes to testing sites — these tricks are bad ideas when used in a production environment, but for testing (especially if you’re running a web server on your own laptop or desktop), they work nicely.
First, you’ll need to know the IP address of your server. I tend to use the ‘ifconfig’ program to tell me this, and to save time, a quick use of ‘grep’ will get you the exact information you need in a hurry.
ifconfig | grep "inet addr"
This will return something along the lines of:
inet addr:89.555.444.333 Bcast:89.16.161.255 Mask:255.255.255.0 inet addr:127.0.0.1 Mask:255.0.0.0
Or in other words, the IP addresses for all of the network devices on my computer — the one I care about is the first one, with a public facing IP address, but for your laptop you can likely skip this step and use 127.0.0.1 instead (or whatever your local IP is)
With this information in hand, I set about creating, editing and enabling my Apache configuration.
Apache
Edit the file /etc/apache2/sites-available/concrete5
In this file, you’ll need the following (at a minimum)
<VirtualHost *:80>
ServerName concrete5.89.555.444.333.xip.io
DocumentRoot /var/www/concrete5/
</VirtualHost>
In this case, concrete5.89.16.161.44.xip.io is a special DNS name that includes the IP of the server and a made up name for this site, “concrete5” — xip.io is a public wildcard DNS server from 37signals that’s very useful for web developers everywhere.
Saving the file, and then typing:
a2ensite concrete5
Is all I need to tell Apache to start serving files for that site. A quick restart of Apache (as prompted) and we’re ready to move on to the next step — creating the directory structure and extracting the files.
Extracting the files
We told Apache that we were using /var/www/concrete5/ as the place for our concrete5 site. So, let’s create that location, download our copy of concrete5 from Sourceforge and extract it into the /var/www/concrete5/ folder.
mkdir -p /var/www/concrete5/ cd /var/www/concrete5/ wget http://sourceforge.net/projects/concretecms/files/latest/download dtrx download
DTRX will prompt you what to do with the file, press H to extract it here.
You’ll now find you have a new folder called ‘concrete5.5.2.1’ or similar and a file called ‘download’ — we’re going to tidy this mess up a little, quickly.
mv concre*/* . rm download rmdir concrete5.5.2.1
Now all the files are extracted, we need a database for this site.
Databases
By default, MySQL has no root password — you’ll want to fix this in a production environment.
mysql -u root
You’ll get a “mysql>” prompt, which you need to type the following two commands. Note they both have semi-colons on the end, as is the case with SQL in general.
CREATE DATABASE concrete5; GRANT ALL ON concrete5.* TO concrete@localhost IDENTIFIED BY 'secret';
In our example, we have a database called ‘concrete5’ and a user ‘concrete’ with a terribly insecure password.
When you’ve done this, type ‘exit’ at the ‘mysql>’ prompt and test you can log in to MySQL by typing:
mysql -u concrete -p concrete5
You’ll be prompted for your password, and if all’s well, you’ll see the ‘mysql>’ prompt again. Type exit, and let’s move on to the final steps: fixing the permissions and actually running the concrete installer.
Running the installer
In your web browser head over to the .xip.io site you created earlier. In my case, it’s the fictional http://concrete5.89.555.444.333.xip.io — you’ll see a screen that looks a little like this:
Hopefully, the only thing that’ll be wrong will be the permissions on files, which we can fix easily by typing:
chown www-data:www-data /var/www/concrete5/
Which gives Apache’s user (www-data) ownership over the concrete5 files, and permissions to create files as needed.
With that completed, head back to your browser and click the ‘Run tests’ button. Everything should be all set, and you’ll be able to process to the next screen.
Here, you’ll fill in all your own details, and server details for MySQL — hopefully you’ll not type ‘locahost’ by mistake and will actually be paying attention, otherwise you’ll get a nice red error pointing out your mistake.
Once that’s all done, you’ll get to sit and watch as concrete creates the various database tables and data for the system.
And with that, you’re all set. Now I’m off to play with templates for concrete5.
Published: Fri Jul 20 2012 16:02:07 GMT-0400 (Eastern Daylight Time) by Dr. Matt Lee