ag@linux:~$

history 35 of 36

How to Install Magento 1 on CentOS 6

My short checklist for installing Magento 1 on CentOS 6: download it, adjust Apache's httpd.conf and add the PHP mcrypt packages from EPEL.

Written

From my Linux study notes, 2018. Some commands and versions here are old, so please reuse them carefully. Anything marked "added later", and the notes at the end, explain what has changed since.

(Added later.) This post is for Magento 1 on CentOS 6. Magento 1 reached end of life on 30 June 2020 and CentOS 6 on 30 November 2020; neither receives security updates. These steps do not apply to Magento 2 / Adobe Commerce.

Here is my simple way to install Magento on CentOS 6.

Before you start

(Added later.)

  • Run the commands as root or with sudo.
  • You need a working Apache (httpd), PHP and MySQL setup on the server, and a MySQL database and user for Magento. The original post does not cover these.
  • Check the system requirements for the exact Magento 1 version you are installing, especially the supported PHP version.

Steps

  1. Download Magento with wget.

    Added note: the original just said “wget magento” without a download address, and the original link is not known. The general pattern is to download the archive into your web directory and unpack it:

    Terminal window
    cd /var/www/html
    wget <URL of the Magento 1 archive>
    tar -xzf <archive name>.tar.gz

    Replace the placeholders with the real address and file name of the Magento 1 release you are installing. Because Magento 1 is end of life, I am not giving a download link here.

  2. Edit /etc/httpd/conf/httpd.conf.

    Terminal window
    vi /etc/httpd/conf/httpd.conf

    Added note: the original does not say what to change. Magento 1 relies on its .htaccess file for URL rewrites and security rules, so the usual change is to allow overrides for the Magento directory, for example:

    <Directory "/var/www/html">
    AllowOverride All
    </Directory>

    Use the directory where you unpacked Magento. Then check the configuration and restart Apache:

    Terminal window
    httpd -t
    service httpd restart
  3. Install the extra packages and PHP extensions you might need.

    Magento 1 needs the PHP mcrypt extension, which is not in the standard CentOS 6 repositories. I installed these packages from the EPEL repository:

    1. PHP extension mcrypt: epel.mirror.freedomvoice.com/6/i386/php-mcrypt-5.3.3-1.el6.i686.rpm
    2. libmcrypt-devel: http://epel.mirror.freedomvoice.com/6/i386/libmcrypt-devel-2.5.8-9.el6.i686.rpm
    3. libmcrypt: http://epel.mirror.freedomvoice.com/6/i386/libmcrypt-2.5.8-9.el6.i686.rpm

    Added notes:

    • These links point to a third-party EPEL mirror and are for 32-bit (i386/i686) systems only. On a 64-bit server you need the x86_64 packages. The links may no longer work.

    • A cleaner way is to enable the EPEL repository and let yum fetch the right packages and their dependencies for your architecture:

      Terminal window
      yum install php-mcrypt

      libmcrypt is installed automatically as a dependency. libmcrypt-devel is only needed if you are compiling software against libmcrypt.

    • Restart Apache afterwards so PHP loads the new extension, then check it is loaded:

      Terminal window
      service httpd restart
      php -m | grep mcrypt
  4. (Added later.) Run the Magento installer. Open your site in a browser; Magento 1 shows a web-based installation wizard that asks for the database details and creates the admin account.

Notes for today

  • Do not use this on a live shop. Magento 1 and CentOS 6 are both end of life. For a new shop, use Magento 2 (Magento Open Source / Adobe Commerce) on a supported system and follow its own installation documentation.
  • CentOS replacements: Rocky Linux and AlmaLinux are the common free replacements; Debian and Ubuntu are alternatives.
  • Commands on newer systems: service httpd restart became systemctl restart httpd, and yum became dnf (yum still works as an alias).
  • mcrypt: the mcrypt extension was removed from PHP’s core in PHP 7.2 because the underlying library is no longer maintained. Newer software uses OpenSSL or Sodium instead.
  • EPEL for CentOS 6 has been moved to the Fedora archive, so normal mirrors no longer carry these packages.