Tuesday 3 January 2012

Installing Joomla 1.7 on CentOS 6.2 (netinstall)

I've been looking at using a CMS for a while as an alternative to designing websites from scratch. I finally have had a reason to use one (long story) but the short end of it is that it needs to run on Linux. There appear to be three main choices when it comes to open source CMSs:
Note, that they all seem to run on Windows, but that's by the by as Windows servers tend to be more expensive than Linux servers. At any rate, although Ubuntu seems to be the most popular offering among VPS providers, I decided to use CentOS 6.2 because I feel more comfortable with Red Hat based Linux distros.

I did not want to download the whole iso as I'm running on a laptop with limited hard disk space, so I decided to use the Netinstall, which in essence contains a bare bones system and grabs packages as needed. When I say that this is bare bones I'm not kidding, man is not actually installed. 

Below are the steps needed to install Joomla on CentOS 6.2 using the netinstall iso, note that I'm running this from a VM using VirtualBox on a Kubuntu 11.10 system:

I have created a script to install Joomla, see this post, note that the script is only for Joomla, you will still need to manually install CentOS/RHEL.

Note that if no screenshot is shown that means that you should use the default values or your own values (e.g. keyboard, time zone, etc.)
  1. Download Netinstall iso from http://isoredirect.centos.org/centos/6/isos/i386/ or http://isoredirect.centos.org/centos/6/isos/x86_64/ for 64 bit versions.
  2. Start a brand new VM and boot from the iso downloaded in step 1. 
  3. Select Install or upgrade an existing system.
  4. Select URL and press OK.
  5. Enter http://mirror.centos.org/centos/6.2/os/i386/or http://mirror.centos.org/centos/6.2/os/x86_64/ for the 64 bit version.
  6. I only gave 512 MB of ram to the VM, which meant that the TUI installer ran instead of a graphical interface.
  7. After selecting the hard drive, I received this prompt. Select Re-Initialize All.
  8. Once the installation has finished and you are back into your system (remember to remove the mounted iso) I decided to install not only mandatory packages but also optional so I added this line to /etc/yum.conf:
    group_package_types=default,mandatory,optional
  9. Install Apache:
    yum groupinstall "Web Server"
  10. Install MySQL:
    yum groupinstall "MySQL Database server" 
  11. Install wget, man, php-mysql, unzip and policycoreutils-python (see step 26 about this package):
    yum install man wget php php-mysql unzip policycoreutils-python -y
  12. Create a temporary directory to extract and download Joomla:
    mkdir /joomla; cd /joomla 
  13. Download Joomla (note that this is likely to change, check here for the latest version):
    wget http://joomlacode.org/gf/download/frsrelease/16024/69674/Joomla_1.7.3-Stable-Full_Package.zip
  14. Extract downloaded package:
    unzip Joomla_1.7.3-Stable-Full_Package.zip
  15. Move all files to home web directory:
    mv /joomla/* /var/www/html
  16. Start MySQL and set it to start at boot time:
    service mysqld start; chkconfig mysqld on
  17. Set root's password to MySQL and get MySQL production-ready (Essentially type Y to everything):
    /usr/bin/mysql_secure_installation
  18. Create Joomla User:
    mysql -u root -p
    CREATE USER 'JoomlaUser'@'localhost' IDENTIFIED BY 'mypass';
  19. Create Joomla Database:
    mysqladmin -u root -p create Joomla
  20. Provide appropriate privileges to the JoomlaUser user:
    mysql -u root -p
    GRANT ALL PRIVILEGES ON Joomla.*
                    TO JoomlaUser@localhost IDENTIFIED BY 'mypass';
            where:
            'Joomla' is the name of your database
            'JoomlaUser@localhost' is the userid of your webserver MySQL account
            'mypass' is the password required to log in as the MySQL user
  21. Apply privileges and exit:
    flush privileges; \q
  22. Open Firewall for port 80 and save changes:
    iptables -I INPUT -p tcp --dport http -j ACCEPT ; service iptables save
  23. Turn output buffering off by editing /etc/php.ini change:
    output_buffering=4096
    to
    output_buffering=Off
  24. Create empty configuration.php file and set permissions:
    touch /var/www/html/configuration.php
    chmod 666 /var/www/html/configuration.php
  25. Start Apache and set it to start on boot:
    service httpd start; chkconfig httpd on
  26. Disable SELinux (I recommend having a look at this post for a fix that will allow you to run SELinux and Joomla. Do ensure that you test everything that you are likely and unlikely to do, e.g. add articles, add blogs, etc..). Alternatively edit /etc/selinux/config and change:
    SELINUX=enforcing
    to
    SELINUX=disabled
  27. Start the Joomla install proper by navigating to:
    http://<yourserverip>
  28. On step 4 use the following settings:
  29. I chose to install the sample data on step 6.
  30. Ensure that you remove the installation directory
    rm -rf /var/www/html/installation/
  31. You can now go and administer your site or view the sample sites if you chose to install the sample data. Enjoy!

Note that if if you do decide to use SELinux, see step 26, you need an extra step to change the context for the Joomla files:
chcon -R  unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/

    5 comments:

    1. Excellent article. Used it to install Joomla 1.7.3 on an AWS instance and it works perfectly.

      Thanks...

      ReplyDelete
    2. Hi many

      worked perfect for me with a 2.5.4 installation of joomla. Thanks for the precise description!

      rvw

      P.S. After point 26) the apache main page appeared. I needed to reboot the server in order to access the joomla installation web-page.

      ReplyDelete
    3. This comment has been removed by a blog administrator.

      ReplyDelete
    4. Really good article, Working perfect for 2.5.6 Joomla

      ReplyDelete