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
- Magento
- Web servers
- Written for CentOS 6
- Written for Magento 1
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
-
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/htmlwget <URL of the Magento 1 archive>tar -xzf <archive name>.tar.gzReplace 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.
-
Edit
/etc/httpd/conf/httpd.conf.Terminal window vi /etc/httpd/conf/httpd.confAdded note: the original does not say what to change. Magento 1 relies on its
.htaccessfile 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 -tservice httpd restart -
Install the extra packages and PHP extensions you might need.
Magento 1 needs the PHP
mcryptextension, which is not in the standard CentOS 6 repositories. I installed these packages from the EPEL repository:- PHP extension mcrypt:
epel.mirror.freedomvoice.com/6/i386/php-mcrypt-5.3.3-1.el6.i686.rpm - libmcrypt-devel:
http://epel.mirror.freedomvoice.com/6/i386/libmcrypt-devel-2.5.8-9.el6.i686.rpm - 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 thex86_64packages. The links may no longer work. -
A cleaner way is to enable the EPEL repository and let
yumfetch the right packages and their dependencies for your architecture:Terminal window yum install php-mcryptlibmcryptis installed automatically as a dependency.libmcrypt-develis 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 restartphp -m | grep mcrypt
- PHP extension mcrypt:
-
(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 restartbecamesystemctl restart httpd, andyumbecamednf(yumstill 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.