Wednesday, September 14, 2011

Super Easy Magento Compatible Centos Install

The Basic Magento Web Server Install Guide

This install guide assumes that you already have the basic install of Centos 5.6 complete. We will now install Apache, MySQL and PHP 5.2.17 First let's install some basic tools
yum groupinstall 'Development Tools'
yum groupinstall 'Development Libraries'
Ok let's install Apache, NTP and MySQL
yum install ntp httpd mysql-server httpd-devel
Look to see what PHP packages are installed and remove any if needed.
rpm -qa | grep php
remove all php 5.3 packages We are going to need some re-requisites for our PHP so lets install them now!!
yum install libc-client libmcrypt libmhash net-snmp libtidy  unixODBC-devel libpng-devel libmcrypt-devel
Now we are ready to install PHP5.2.17
cd ~/mkdir php5.2.17
cd php5.2.17
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-bcmath-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-cli-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-common-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-dba-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-devel-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-eaccelerator-5.2.17_0.9.6.1-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-gd-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-imap-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-ldap-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mbstring-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mcrypt-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mhash-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mysql-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-ncurses-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-odbc-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-pdo-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-pgsql-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-readline-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-snmp-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-soap-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-tidy-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-xml-5.2.17-1.x86_64.rpm'
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-xmlrpc-5.2.17-1.x86_64.rpm'
rpm -ivh *.rpm
(I removed wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mssql-5.2.17-1.x86_64.rpm') Make sure MySQL is on
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
And let's make sure we have MySQL locked down (follow instructions)
mysql_secure_installation
Make sure Apache is on
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
Finally, add another repo
cd /etc/yum.repos.d/
wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
then make the following changes:
vi /etc/yum.repos.d/kbsingh-CentOS-Extras.repo
gpgcheck to 0 and enabled to 1 in the [kbs-CentOS-Testing] You will need to configure your Apache and MySQL

The Best Dedicated Server for Magento

This posting is more for question answers than anything else.

Background:

I do a lot of Magento upgrades, the bottom line, your upgrading server matters. What I would like to do is collaborate (knowledge) on the best machine (and the cheapest) and the best configuration on a single dedicated server.

My best case example is a 4gb Magento 1.3 database run on a HPDL160 G6 Dual Quad Core 1.6ghz processors, 16gb RAM, and SATA 7200rpm drives.

I installed and configured CentOS 5.5 with MySQL 5.1. I tuned MySQL (I will post a script later)

I will use my desktop machine (at the time) as my benchmark.
Intel i7 Quad core
16gb Memory
7200 RPM SATA Drive
CentOS 5.5, MySQL 5.1
(Purchased all from Microcenter)

In addition, I also tested a Dual Intel i7 Quad Core with 16GB memory and a 7200RPM SATA drive running Ubuntu 10.04

My best completion time on my Desktop Machine was 12 hours
My best completion time for the Ubuntu Desktop was 10 hours
My best completion time for the HP G6 was just under 5 hours.

My latest endevor involves a HP DL385 AMD Quad -Dual Core server (4-dual core CPUs) with 32GB memory and RAID 5 SCSI Ultra 320.

A 2gb Magento database is taking more than 12 hours to upgrade.

I am not a hardware GURU, so I am looking for some explanations on why the G6 ran so much faster? In addition, I would be happy to post anyone configuration that allows for the fastest Magento upgrades. Ideally I would like to first find the optimum server configuration, then find the optimum server.




Monday, September 12, 2011

Magento MySQL my.cnf perfect setup

Here is my ever evolving my.cnf file for a Magento install. If anyone has anything to add please comment, I will add it to my script and test!
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql

#innodb settings
innodb_log_file_size=100M
innodb_additional_mem_pool_size=20M
innodb_flush_log_at_trx_commit=2
innodb_lock_wait_timeout=1800
innodb_buffer_pool_size=20G 

#other vars
net_read_timeout=120
skip-locking
skip-name-resolve
table_cache=2048
thread_cache_size=16
back_log=100
max_connect_errors=10000
open-files-limit=20000
interactive_timeout=3600
wait_timeout=1800
max_connections=200
key_buffer_size=1G
connect_timeout=120

#skip-name-resolve
max_allowed_packet=16M
tmp_table_size=64M
max_heap_table_size=64M
query_cache_size=256M
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=8M
join_buffer_size=3M

old_passwords=1

Friday, September 2, 2011

Magento Database Reduction

Here are a few tables that tend to bloat your Magento database. As always, before running any script: MAKE A BACKUP

If you want to save the data, it is easy enough to dump your database and extract the following tables. Over time there tables will grow quite large so it is a good idea to keep them clean!

truncate dataflow_batch_export;
truncate dataflow_batch_import;
truncate log_customer;
truncate log_quote;
truncate log_summary;
truncate log_summary_type;
truncate log_url;
truncate log_url_info;
truncate log_visitor;
truncate log_visitor_info;
truncate log_visitor_online; 
truncate report_viewed_product_index;
truncate report_compared_product_index;
truncate report_event;

Please comment on any other tables you find useful!

Wait! did I mention ALWAYS MAKE A BACKUP ?

Twitter: @brentwpeterson on Twitter
Linkedin: http://www.linkedin.com/in/brentwpeterson
View My Magento Profile