This installation of Magento focuses on the 1.4.2 and 1.5.1 build using your own server (with an external database though a 2nd server or internal one using the same box as the magento installation). After sever testing we suggest you always separate the database of Magento from the live web server of Magento for performance and security reasons.
Included is a necessary walk though for upgrading the PHP version to the most recent 5.3u which is required to run magento (at the time of this post)
This is a more in depth walk though then we could find on the internet. Some of the steps are the same as you can find in other areas of the web by simply searching it. We are trying to put together an all inclusive tutorial for a novice user.
Note to advanced Linux users: Yes some of the software components used might not make particular sense. We suggest you run though it using this tutorial, then later if you want to re-install using only the components you want to. I personally have a friend that is a top end coder for over 10 years and when he tried to remove or short cut the installation presented here he could not get magneto to install, after spending 2 days tryingto prove me wrong he finally gave up and installed it using this set of instructions, which only took him about an hour to complete. So if you know Magneto well, which means you are probably not reading this tutorial do as you wish, for everyone else lets get started.
Operating System CentOS 5.6
CentOS is amongst the most well known and trusted web hosting operating systems around and so if you’re looking for a environment for your latest Magento store there’s perhaps no finer choice. There is a CentOS 6.0 Version available at the time of this tutorial, but since it is so new we decided to stick with the version that was 1 step older as the bugs were already worked out of CentOS 5.6 and tue community support is higher.
ISOs for CentOS are available to download here:
http://mirror.centos.org/centos/5/isos/
CentOS 5.6 x64 Installation
Burn the ISO onto a disc using software like PowerISO. CentoOS is a 2 disk install, you should only need disk one for this install.
Skip the disk testing if you’ve mounted an ISO, the testing takes a long time to complete.
In network devices, click ‘edit’ and assign a static IP – it saves having to do it later.
Disable IPv6 unless you desperately need it. Click OK and set the hostname to whatever you want – I normally use dev.domain.com. Set the DNS and Gateway to your requirements and click Next.
Select your time zone, click Next, enter your root password, click Next.
For the software selection, tick ‘Server’ and untick everything else.
Select the Customize Now button and click Next.
In the Customization window you need to de-select everything except for.
- Editors
- Text-based Internet
- Development Libraries
- Development Tools
- DNS Name Server
- FTP Server (Uncheck on your Data Base Server)
- Mail Server (Uncheck on your Data Base Server)
- MySQL Database
- Server Configuration Tools
- Web Server
- Administration Tools
- Base
- System Tools
I host my own servers, so I tend to install the KDE environment to make the management of unwanted folders or files easier. it is up to you if you want to install an GUI environment, but it should only be installed if you have your servers at your location (which most novice users of magento will probably not do).
The installer will now run through the installation phase which will take some time and will result in a reboot of the operating system.
CentOS 5.6 Configuration (Using the Command line of Linux)
I used Putty to do all of my command line work in Linux, it is a great tool to use your a remote machine to work on the linux box, you can find it by searching for ‘Putty.exe linux’
Now at the command line you will type several commands in sequence, if you receive an error while using these commands you should search the internet for reasons / workarounds, or in a worst case scenario re-install CentOS.
Time to update CentOS. Run the following one at a time. The comand line statments are in RED to make them easier to pull out of the text. Please read before you start blindly copying and paisting the comand line statements.
Update the repositories for updates:
yum check-update
Now update the kernel:
yum upgrade kernel
Reboot the computer!
Run a system wide update:
yum upgrade
Install Apache:
yum install httpd
Set Apache to start when the system boots:
chkconfig httpd on
Turn on Apache
service httpd start
Check that Apache and the webserver is operational. Now you need to make sure that your Apache software has loaded correctly by going to your domain http://www.yourdomain.com where you should see the default white and blue Apache screen.
It may be required to modify your apache conf file to direct incomeing traffic to your folder. do that by running the following command
nano /etc/httpd/conf/httpd.conf
at the bottom of the file there is section which is titled Virtual Host you need to change the settings of this file to resemble this.
<VirtualHost *:80> # ServerAdmin webmaster@dummy-host.example.com DocumentRoot /www/docs/dummy-host.example.com ServerName dummy-host.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost>where dummy-host-example.com is your url
Install MySQL:
yum install mysql-server
Set MySQL to start when the system boots:
chkconfig mysqld on
Turn on MySQL
service mysqld start
Configure MySQL:
mysql_secure_installation
You need to remove the following by following the steps the command below gives you.
- hit enter on password request (you do not have one yet)
- enter in a password that is not your root password (this will now be your root database password)
- anonymous users
- disallow remote root logins
- remove the test database
- reload the privilege tables
Install PHP 5.3u: you need to install php 5.2.x We are building out the instructions for this and will add it below
yum remove php php-*
Yes remove all when it asks
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-8.ius.el5.noarch.rpm
rpm -Uvh ius-release*.rpm epel-release*.rpm
Check PHP Version: it should read PHP 5.3.6
php -v
Check Apache. Should return: Syntax OK.
httpd -t
Start Apache webserver
service httpd start
Don’t forget!
In PHP 5.3u is required, not php 5.3, to run Magento due to Magento using PEAR. If you simply upgrade to php 5.3 you will not be sucessfull installing Magento and will have database connection issues.DATE/TIME Addition. php 5.3 and 5.3u requires you to add date.timezone to the php.ini file. we will do this later in the install.
Installing phpMyAdmin on CentOS 5.6
phpMyAdmin is an essential MySQL admin tool. Go here and find the latest version of phpMyAdmin
http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin
Then find the most recent version and convenient version for you in tar.gz – so for me it’s 3.3.5.1 in English with URL
http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.3.5.1/phpMyAdmin-3.3.5.1-english.tar.gz
Enter the command
wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.3.5.1/phpMyAdmin-3.3.5.1-english.tar.gz
Extract it, move it and delete the original file:
tar xvfz phpMyAdmin-3.3.5.1-english.tar.gz
mv phpMyAdmin-3.3.5.1-english/* /usr/share/phpmyadmin
rm phpMyAdmin-3.3.5.1-english.tar.gz
Now we need to make a couple of configuration changes to make it all work…
cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
nano /usr/share/phpmyadmin/config.inc.php
Now change the line that starts $cfg['blowfish_secret'] to something like below (with your own password):
$cfg['blowfish_secret'] = ‘supersecretpassw0rd!’;
Press CTRL+O and enter to write the changes to the file, then CTRL+X to close the file.
Now we need to add a line to the php configuration file to let it know where phpMyAdmin is and allocate an alias.
echo “Alias /phpMyAdmin /usr/share/phpmyadmin” >> /etc/httpd/conf.d/php.conf
Now restart Apache service:
service httpd restart
Now go to http://dev.domain.com/phpMyAdmin/ in your browser and you should see the phpMyAdmin login page. Login with your MySQL root credentials you set earlier and you’re in!
Installing an FTP Server onto CentOS 5.6
We’re now in a position to start testing our server to see whether Magento is compatible using the Magento Test File.
First, create the directory where Magento will be served.
mkdir /var/www/html/magento
Run the following command to edit the apache service…
nano /etc/httpd/conf/httpd.conf
Change…
DocumentRoot “/var/www/html”
to…
DocumentRoot “/var/www/html/magento”
and also change…
<Directory “/var/www/html”>
to…
<Directory “/var/www/html/magento”>
Hit CTRL+O to save and then CTRL+X to exit. Restart the httpd service
service httpd restart
Next, run this command to install the FTP Server
yum install vsftpd
And now edit the following files individually, removing all references to ‘root’, to allow the root user to access via FTP:
nano /etc/vsftpd/ftpusers
nano /etc/vsftpd/user_list
Run the following to start the FTP service and then get the service to start when the machine boots
service vsftpd start
chkconfig vsftpd on
Now using your chosen FTP client, connect to dev.domain.com with your root user’s credentials. Download the magento test file, unzip it and FTP it up to the /usr/share/magento folder for your webserver. Go to http://dev.domain.com/magento-check.php in your web browser and you will probably see a load of junk php code spewed out all over the page.
Worry not, it’s because php short tags are not enabled. Simply edit the php.ini file and enable short tags.
nano /etc/php.ini
change…
short_open_tag =off
to…
short_open_tag = on
restart the httpd service again…
service httpd restart
and refresh your browser – you should see a Congratulations page.
Installing Magento on CentOS 5.6
Magento suggests installation via FTP. Goodness knows why – it’s less reliable and more likely to provoke permissions and hidden file issues. The SSH route is far superior. Make sure you’re back in your home directory…
cd ~
and then run this to download Magento 1.5.1…
wget http://www.magentocommerce.com/downloads/assets/1.5.1.0/magento-1.5.1.0.tar.gz
or if you want to install Magento 1.4.2
wget http://www.magentocommerce.com/downloads/assets/1.4.2.0/magento-1.4.2.0.tar.gz
extract it to a folder called ‘magento’ use the version you downloaded
tar -zxvf magento-1.5.1.0.tar.gz magento
or
tar -zxvf magento-1.4.2.0.tar.gz magento
and dump the contents into our Magento directory that’s served by apache
mv magento/* /var/www/html/magento/
and then the .htaccess file (it sometimes needs its own special copy command)…
mv magento/.htaccess /var/www/html/magento/
Now we need to make a couple of directories writable by the Magento application…
chmod -R o+w /var/www/html/magento/media
chmod -R o+w /var/www/html/magento/var
chmod o+w /var/www/html/magento/app/etc
Now go to http://dev.domain.com in your browser and behold – the Magento web installation wizard.
Agree to the service agreement and set the localization and time zone settings. Click Next.
Now you’ll need to setup the database connection. First though we need to create the database in phpMyAdmin. In a new tab/window, go to http://dev.domain.com/phpMyAdmin and login using the root credentials.
Go to Privilages -> Add a new User
Call the user something like ‘magentodb’, enter a password and select ‘Create database with same name and grant all privilages’. Click OK in the bottom right.
Now, going back to the magento install wizard, enter the magento database name (in this case ‘magentodb’), the username (also ‘magentodb’) and the password.
Set the base url as http://dev.domain.com (it can be changed later when the website goes live) and the admin path. The admin path should be something fairly unobvious to prevent…the obvious.
Un-tick base URL validations, tick use web server rewrites and (if you’ve already installed an SSL certificate) click to use secure URLs. If you’ve not yet sorted out an SSL certificate then it can be installed/set at a later date. Click Next.
Set the admin account credentials (remembering the password NEEDS more than 7 letters, capitals and lowercase, numbers and symbolic characters). If you don’t fulfil all these and click next you WILL NEED to refresh the browser to try again.
That’s it! Your frontend store is http://dev.magento.com and the backend ishttp://dev.domain.com/{yourchosenadminpath}.
I’ll also shortly be posting how you can optimise your Magento store’s speed by customising your http server, MySQL server and Magento installation.


















This is one of the better blogs I frequent. Good job!
Thanks for the post
I learned a lot from this post, much appreciated!