Saturday, July 26, 2008

Installing Matrix on Centos 5 - part 1 - OS preparation

I've had a couple of goes at installing Matrix 3.18.3 on a CentOS 5.1 and have it down fairly well now, so I thought I'd document it in case anyone else wants step-by-step instructions. Matrix 3.18+ have been designed to work with stock standard RH packages, so you should find installing on CentOS and other RedHat-based boxes a breeze.

There are a couple of caveats here:
  • I'm doing this in a VM. Shouldn't make too much difference procedurally, but I wouldn't recommend putting a production system on a vm. Postgresql generates a huge amount of I/O, and hypervisors tend to get clunky when you push their I/O throughput. The advantage of installing on a VM is that I can take screenshots for your viewing pleasure.
  • I'm using default partitioning. Again, not recommended for a live, public-facing web server, where performance is essential, but if you're a person who knows enough to want to use a different partitioning scheme then you are also a person who knows enough to set that up yourself ;)
  • I'm keeping the install as minimal as possible. This means some of your favourite management tools/languages/shells may have been left out. If you want to install more, go for it. That's your call.
  • I'll be using postgresql as the database of choice, located on the same machine as apache. If you are already using Oracle, then you should find enough information between the Squiz.net installation documentation and the matrix forums to make the necessary changes. Note that you will need to compile and install PHP5.2.6 or later.
  • I'll be installing the GPL version of Matrix. If you have specialised packages developed by Squiz that have other requirements, you may need to install more CentOS packages. Further details can be found in the Squiz installation documentation.
  • I'd like to do a doco like this on installing Matrix 3.18+ on RHEL5, but don't have a licence. If anyone wants to spring for one, I'd be more than happy to accept ;) If you're using RHEL5, this document should work, although you'll have to do the licence registration stuff.

I'm assuming you've already got the installation iso's (I couldn't find a dvd image on my ISP's mirror, so I'm using the 6 CDRom iso's). Now down to business...

1. Boot up from the installation medium. I have chosen the graphical install:



Press Enter.

2. If you want to, check the integrity of the installation images, otherwise skip... Since I'm using the iso's directly from my hdd, I chose to skip. If you burned your media, it's a good idea to test them/it.


3. The system will start Anaconda, probe for video hardware etc, then give you this.


Click 'Next'.

4. Choose your language...


Click 'Next'.

5. Choose your keyboard layout.


Click 'Next'.

6. If you're installing on an unformatted drive (like a vm) you'll get this message:


If you know the drive should be blank, it's safe to click 'Yes'. In this case, since I'm using a vm, it's all good.

7. You'll be presented with options for partitioning. I've gone with the default. As I said before, this one's up to you... If you want to use separate partitions, you'll need sizeable partitions for /home and /var (assuming you use the recommendation on the Squiz Matrix Installation guide about putting your matrix system in /home/websites) because postgresql will store it's data in /var/pgsql. If you're going to put matrix somewhere in /var, you'll obviously need to allocate most of your volume to /var.



When you've got your partitioning scheme sorted, click 'Next'. If you want to go with the default, just click 'Next' straight away.

8. You'll get the safety warning - be sure you're happy with your partitioning scheme and blowing away all the data on the drive. If you have any doubts, now is the time to chicken out...


Otherwise, you can click 'Next'.

9. You'll now be presented with a network setup screen. You can go with dhcp if you like, particularly if you can allocate a specific IP for the machine on your dhcp server, but generally for a webserver it's best to allocate a fixed IP. I've set these appropriately for my network, if you're not sure what to do, go with the default.


Click 'Next'.

10. Now you need to select your region of the world to set the timezone for your machine... Pinpoint the nearest location to you.

Click 'Next'.

11. You'll be asked to enter a root password. Make sure you choose a secure password that you can remember easily. Type the password into both fields.


Click 'Next'.

12. Next you get package selection. This is where it gets interesting, so pay close attention. For starters, deselect the default Gnome install. We don't want XWindows on a server! (Of course, if you have a machine with more resources and it's just for playing with and you REALLY want to manage it in a GUI environment, it's your choice. But if you're planning on running a webserver on linux, it's a good idea to get acquainted with the shell, here is a gentle introduction, and you'll also want to get to know vi better, so here's an introduction to vi.)

For this minimal install, I'm going to uncheck everything in the top section, and select the 'Customize now' radio button.


Click 'Next'.

13. You'll see a screen like this:


We don't want any graphical environments, so let's go straight to the "Servers" section. For starters, we'll want to select the "PostgreSQL Database" option.

Click on the 'Optional packages' button, and deselect perl-DBD-pg, postgresql-python, rhdb-utils and unixODBC. You should end up with only the postgresql-server package selected.

Click 'Close'.

Now, select the 'Web Server' option:

Click on 'Optional packages'. You'll only want the php, php-pear and php-pgsql packages (deselect everything else, unless of course you see something you want). We'll install more later, but at this point in the process these are the only ones we can select.

Click 'Close'. There are some other options that are selected by default in various groups, but they are all small, and some of them are useful/necessary (e.g. vi, sudo). You may want to deselct the 'Dialup Networking' option in the 'Base' group, though. When you're satisfied with your selections, click 'Next'.

Anaconda will check dependencies, and comes back with this:


Click 'Next' and the installer checks you have the right cd's. When it's done, click "Continue". The installer will format the filesystem and carry out the install. Make yourself a cup of coffee... You'll need to change the CD's as the installation progresses (unless your ISP carries a mirror of the DVD), but it's pretty straightforward.

Eventually you'll get this screen:

Remove any optical media and click on Reboot.

14. The system will reboot, go through some initialisation stuff, and eventually give you this screen:


Go to the Firewall configuration (arrow down), select 'Run Tool' (tab) and hit enter. You'll get a firewall config screen. Set Security Level to Enabled (use space to select/unselect), and SELinux to Disabled. (As far as I know, nobody has figured out how to get Matrix to work with SELinux. If you have, I'd be happy to hear how it's done.)


Select 'Customize' and hit Enter. On the next screen, we want to enable incoming www (http) traffic to the server.

Select Ok, then Ok on the Firewall configuration screen. Go into the System Services config, and deselect 'apmd' (unless you're running your server on a laptop), 'bluetooth', 'hidd', 'cups', 'gpm', 'pcscd', 'mcstrans', 'restorecond', 'portmap', 'nfslock', 'rpcidmapd', 'rpcgssd' (don't disable the last four if you're planning to use NFS, don't disable portmap if you're planning on using or anything that uses rpc) and 'isdn'. (I'm open for other suggestions here as to other services that can be removed).

Enable 'httpd' and 'postgresql'.

Select Ok. From the Setup Agent screen select 'Exit'. You will be presented with a login prompt.


15. Login as root. You *do* remember the root password you set, don't you?

16. We need to install some additional packages to support Matrix. We're going to use 'yum' to do that. First of all, we need to update yum's package list. To do this we run 'yum makecache' from the prompt. This will take a while.

17. Now we want to make sure all our packages are up to date with 'yum update'.


This will take a while too... I hope you like coffee ;) You will need to tell it that it's ok to download the updates (press 'y' then Enter), and that it's ok to import the signing key (press 'y' then Enter). Once it's done, you'll have to reboot to activate the updated kernel packages. Use 'shutdown -r now' from the prompt to reboot.


19. Once the server comes back up, you'll need to log in as the root user again. We're going to install some packages, first the php and pear packages we'll need (php-bcmath, php-gd, php-mbstring, php-tidy, php-xml, php-pear-Mail, and php-pear-Mail-Mime) :

You'll need to ok the downloads ('y' then Enter).

20. Update PEAR and install other Pear packages we'll need...

First, run 'pear upgrade-all' from the prompt:


NB: *** You'll need to run it twice, as the first time some dependencies will not be satisfied ***

Then install the other needed packages -XML_HTMLSax, XML_Parser, and Text_Diff, with 'pear install XML_HTMLSax XML_Parser Text_Diff' from the prompt:

21. Install external applications - html tidy, pdftohtml and antiword... 'yum install tidy poppler poppler-utils' will work for html tidy and pdftohtml, but we'll need to download and install the rpm for antiword ourselves. First pdftohtml. Again, you'll need to ok the download.


Next, antiword. We need to download the rpm from http://dag.wieers.com/rpm/packages/antiword/antiword-0.37-3.el5.rf.i386.rpm (or http://dag.wieers.com/rpm/packages/antiword/antiword-0.37-3.el5.rf.x86_64.rpm if you're using 64bit.) We'll use wget to download it. The command is 'wget http://dag.wieers.com/rpm/packages/antiword/antiword-0.37-3.el5.rf.i386.rpm'


When the download is done, install it with 'rpm -ivh antiword-0.37-3.el5.rf.i386.rpm'


22. Ok, that should do it for the OS preparation. In part 2, we install and configure Matrix! Stay tuned.

2 comments:

  1. Do you actually need antiword if you don't intend to use it? Also it looks like the rpm is for 32bit systems is there a 64bit option available?

    ReplyDelete
  2. Hi Anonymous,

    You don't need antiword if you're not going to be putting word documents on the site for download. Actually you don't need it then either. It's just used to extract the text from word documents so that they can be indexed for searching.

    You can get a 64bit rpm for antiword from rpmforge, the latest is here: http://packages.sw.be/antiword/antiword-0.37-3.el5.rf.x86_64.rpm

    ReplyDelete