Setting up a Magento Host Server

This article is based on Magento’s own system requirements, which can be found here:
click here

Operating System

Magento requires Linux x86-64. I have found that CentOS is the most popular OS to run Magento on and has been the easiest for me to install, configure, and troubleshoot issues.

You can begin by downloading the ISO here and installing it on your server.

www.centos.org/download/

There are several different install types as you run through the install wizard. I prefer the Desktop Install. There are some cases where logging into the GUI is more beneficial than the command line such as searching through logfiles or config files. It is also time consuming to install the desktop components after the OS is installed.

Magento Hosting Server

Apache and NGINX are the two web servers that Magento recommends. The easier of the two as far as setting up and modifying is Apache. Once your OS is installed and setup you can install Apache by opening the terminal and using the yum command.


# yum install httpd

After Apache is installed you will need to make sure that the server will start automatically at startup. In terminal type:

# chkconfig httpd on

Now start the service

# service httpd start

You will also need to make sure that the iptables, (aka. Linux firewall) will allow traffic on port 80. If you have a perimeter firewall installed, it is not necessary to use iptables. In this case you should disable it:

#chkconfig iptables off

#service iptables stop

You can now setup the Virtual Host section in the Apache config file to point to your Magento installation directory. Locate the Apache config file in the default location of /etc/httpd/conf/http.conf and open it with your favorite editor.

Find the Virtual Host section at the bottom of the file. You can use the example in the file and fill in your own info for your server:


<VirtualHost *:80>

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot /www/docs/dummy-host.example.com (Your Magento Install Folder)

ServerName dummy-host.example.com (Your Magento Website Domain Name)

ErrorLog logs/dummy-host.example.com-error_log

CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>

After editing this file you will need to restart Apache:

# service httpd restart

You should be able to test your config in a browser by adding a test.html page in the website root directory. If the test page displays without error, then download the magento install package and place it in this directory.

Setting up Magento Hosting Server

Magento requires either PHP 5.4 or PHP 5.5 for CE 1.9. Installing PHP could be a challenge if you do not have any prior experience. If you are comfortable with installing PHP by compiling it from the source, then you should have no troubles and can skip this section. However, if you are new to PHP it will be much easier to install it using the yum utility.

The tricky part is that your install of CentOS might not have the proper repos by default in order to install the PHP version you will need. To test this you can run this command in a shell

# yum list php

This will show you which version will be available through the yum repos. If it is less than PHP version 5.4 then you will need to complete the following two steps.

1) Install the following rpms

# wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

If you are running CentOS 7 then use these instead


# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm

2) Enable the Repo
Now you will need to browse to /etc/yum.repos.d and open the remi.repo in a text editor.
The first section is called [remi], make sure this is enabled. It should include this line:

enabled=1

The following sections are version specific for PHP. Find the version you want and again make sure you set:

enabled=1

Save and exit the editor.

Now when you run the following command you should see the PHP version available that you need:

# yum list php

You can now install php and the php modules required for Magento:

  • PDO_MySQL
  • simplexml
  • mcrypt
  • hash
  • GD
  • DOM
  • iconv
  • curl
  • SOAP (if Webservices API is to be used)

Magento Hosting Server - installing MySQL

Magento recommends installing MySQL version 5.6. You might run into the same dilemma as with PHP because your CentOS release will not download the latest version through the default repos. In that case you will need to install the following rpm

# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# rpm -ivh mysql-community-release-el6-5.noarch.

You will now be able to setup MySQL version 5.6

# yum install mysql-server

After it has been installed start the service and set it to start at boot:


# /etc/init.d/mysqld start
# chkconfig mysqld on

Now you can start the mysql setup wizard

# mysql_secure_installation

This will run through the process of setting up a root user and access to your mysql server.

Now that the MySQL server is setup and running you can login and create a database and user for the Magento store:

# mysql –u root –p


mysql> create database magento_store;
mysql> create user magento_user;
mysql> grant all on magento_store.* to ‘magento_user’@’localhost’ identified by ‘your_password’;

Please make note of your database name, user, and password. You will need this during the Magento setup wizard.

You should also consider tuning the MySQL config to better server your Magento store. The following directives can be added to the my.cnf config file. These setting are based on a dedicated database server with a dual core processor and 2GB of RAM.

  • query_cache_size = 512M
  • query_cache_limit = 256M
  • tmp_table_size = 256M
  • key_buffer_size = 64M
  • read_buffer_size = 128M
  • read_rnd_buffer_size = 128M
  • bulk_insert_buffer_size = 64M
  • myisam_sort_buffer_size =
  • myisam_max_sort_file_size = 128M
  • myisam_max_extra_sort_file_size = 128M
  • myisam_repair_threads = 2
  • innodb_lock_wait_timeout = 120
  • innodb_additional_mem_pool_size = 256M
  • innodb_log_buffer_size = 128M
  • innodb_log_file_size = 128M
  • innodb_log_files_in_group = 2
  • innodb_flush_log_at_trx_commit = 0
  • innodb_buffer_pool_size = 512M
  • innodb_data_home_dir = /var/lib/mysql/
  • innodb_data_file_path = ibdata1:256M:autoextend
  • innodb_autoextend_increment=32

You will need to restart the MySQL service whenever changes are made to this file.

Congratulations, you have now setup a host server to run Magento. Please read the follow up article “Installing Magento” and start setting up your Magento store.

Get expert Magento development from a company with a team of U.S. based developers with 18 years of development experience. Our work on hundreds of complex e-commerce projects includes:

m-logo
  • New Site Development
  • Magento Upgrades
  • 3rd Party Web Services Integrations
  • Mobile-friendly Designs

Contact UsSupport

Name*

Phone Number*

Email Address*

Project Description*

Input this code:*

captcha

Support

For 24 x 7 support on your current project or hosted website, visit our help desk. Our knowledgeable staff is ready to assist you with any issue or question. We also offer an ever-expanding knowledge base with helpful tools and how-to information.

Visit the Help Desk

logo

Areas of Service

Insightful Strategies

  • Business strategy
  • Ecommerce tactics

Beautiful Designs

  • Responsive design
  • HTML 5
  • CSS 3

Skilled Development

  • Data migrations
  • Custom extensions
  • Integrating ERP, order
    management, accounting
    and other systems

Managed Services

  • Magento Hosting
  • SEO & advertising
  • Training & support

Testimonials

“Web2Market has surpassed our expectations. Everyone on staff is very knowledgeable, always available and willing to do what it takes to meet our needs. Our confidence in Web2Market’s design, programming and management abilities allows us to relax and focus on other projects, knowing the job will be done right, on time and within budget.”
– Greg Owens, Webmaster, BBB Industries
Read more testimonials

Magento Case Study

img_cont

[mp_code]

Portfolio

[/mp_code] View more designs