Wednesday, October 26, 2011

Installing Magento Via SSH

Installing Magento With The Full Download

Installing Into The Website Document Root

I took this content from the Magento WIKI page, since they have removed the Search feature for the Magento WIKI's I figured it would be easier to find this way for myself and others! Since this Post will soon become outdated, I must tell you to change the version number for your download. i.e. if you want version 1.5.1 you will put magento-1.5.1.0.tar.gz When version 1.7 comes out you will need magento-1.7.0.0
wget http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-1.6.1.0.tar.gz
tar -zxvf magento-1.6.1.0.tar.gz
mv magento/* magento/.htaccess .
chmod -R o+w media var
chmod o+w app/etc
rm -rf magento/ magento-1.6.1.0.tar.gz

Install Magento using the downloader

wget http://www.magentocommerce.com/downloads/assets/1.5.0.0/magento-downloader-1.5.0.0.tar.gz
tar -zxvf magento-downloader-1.5.0.0.tar.gz
rm -rf magento-downloader-1.5.0.0.tar.gz

Install into a Subdirectory

For this install you only need to replace SUBDIRECTORY below (two times) with the name of the subdirectory that you want Magento installed in.
mkdir SUBDIRECTORY
cd SUBDIRECTORY
wget http://www.magentocommerce.com/downloads/assets/1.5.0.0/magento-downloader-1.5.0.0.tar.gz
tar -zxvf magento-downloader-1.5.0.0.tar.gz
rm -rf magento-downloader-1.5.0.0.tar.gz

Installing Magento With The Downloader & Sample Data

Installing into the Root Web Directory

wget http://www.magentocommerce.com/downloads/assets/1.5.0.0/magento-downloader-1.5.0.0.tar.gz
wget http://www.magentocommerce.com/downloads/assets/1.2.0/magento-sample-data-1.2.0.tar.gz
tar -zxvf magento-downloader-1.5.0.0.tar.gz
tar -zxvf magento-sample-data-1.2.0.tar.gz
mv magento-sample-data-1.2.0/media/* magento/media/
mv magento-sample-data-1.2.0/magento_sample_data_for_1.2.0.sql magento/data.sql
mv magento/* magento/.htaccess .
chmod -R o+w media
mysql -h DBHOST -u DBUSER -p'DBPASS' DBNAME < data.sql
./mage mage-setup .
./mage install magento-core/Mage_All_Latest-stable
chmod o+w var app/etc
rm -rf magento/ magento-sample-data-1.2.0/
rm -rf magento-downloader-1.5.0.0.tar.gz magento-sample-data-1.2.0.tar.gz data.sql
Please visit the Magento site and post to the forum if you have any questions or problem. Click to visit Magento Forums

Monday, October 3, 2011

How to find the Magento version - Quick and Easy

Many Magento store leave the release notes in the root of their website. This is the fastest way to find out what version the site is running

http://www.domain.com/RELEASE_NOTES.txt

Of course if you remove the file or change the permissions you will not find it.

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

Saturday, August 27, 2011

Magento events: Cheat Sheet

This post is for me as well as for everyone else who is always looking for the Magento events.

My personal favorite is from Mastering Magento:

http://masteringmagento.com/2010/06/events-list-in-magento-community-1-4/

The section that I found most helpful is this

$this->_eventPrefix.'_add_is_active_filter
$this->_eventPrefix.'_delete_after
$this->_eventPrefix.'_delete_after_done
$this->_eventPrefix.'_delete_before
$this->_eventPrefix.'_delete_commit_after
$this->_eventPrefix . '_load_after
$this->_eventPrefix.'_load_after
$this->_eventPrefix . '_load_before
$this->_eventPrefix.'_move_after
$this->_eventPrefix.'_move_before
$this->_eventPrefix.'_'.$process.'_process_run_after
$this->_eventPrefix.'_'.$process.'_process_run_before
$this->_eventPrefix.'_save_after
$this->_eventPrefix.'_save_before
$this->_eventPrefix.'_save_commit_after
$this->_eventPrefix.'_validate_after
$this->_eventPrefix.'_validate_before

What we can do is take the event prefix from the list below and attach the action after. So for example you catalog_product event you want to do something after you simple do catalog_product_save_after. This is in no way a comprehensive list. The website Mastering Magento does offer a script to generate the Magento Events on your Linux server (I have not tried it)

admin_roles
 admin_user
 catalog_category
 catalog_category_collection
 catalog_compare_item
 catalog_entity_attribute
 cataloginventory_stock_item
 catalog_product
 catalogrule_rule
 cms_page
 core_abstract
 core_config_data
 customer
 customer_address
 customer_entity_attribute
 customer_group
 eav_entity_attribute
 eav_form_element
 eav_form_fieldset
 eav_form_type
 giftregisty_gift
 newsletter_subscriber
 review
 sales_creditmemo_item
 sales_invoice_item
 sales_order
 sales_order_creditmemo
 sales_order_invoice
 sales_order_item
 sales_order_shipment
 sales_order_shipment_track
 sales_quote
 sales_quote_address
 sales_quote_item
 sales_quote_payment
 salesrule_rule
 sales_shipment_item
 store
 store_group
 system_config_price_scope
 tag
 website
 wishlist_item

Nick Says has a very good list of Magento 1.5 Events here

http://www.nicksays.co.uk/magento_events_cheat_sheet/

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

Tuesday, August 23, 2011

Magento errors SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry during upgrade

If you are upgrading your Magento store and you have received this error:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

The solution is to modify your /app/etc/config.xml file with the following:

Original statement
SET NAMES utf8

Modified statement
SET NAMES utf8; SET FOREIGN_KEY_CHECKS=0; SET UNIQUE_CHECKS=0;

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

Sunday, August 21, 2011

Upgrading your Magento install to version 1.6

I have been hanging out a lot on the Magento 1.6 upgrade boards and I have been seeing all sorts of problems with upgrading.

Short of trying to upgrade via a new install and going through all the work of transferring your themes etc you can do it via ssh

The following worked for me: (Remember if you are running on a machine with low resources and you have many products the script will take longer to run)

rm -rf var/cache var/session
chmod 550 ./mage
./mage mage-setup .
./mage config-set preferred_state stable
./mage list-installed
./mage list-upgrades
./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
php shell/indexer.php reindexall

As always, your best resource for Magento information is the Magento site

You can access the 1.6 upgrade boards here

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

Friday, August 19, 2011

Truncate Customer Log tables in Magento

To keep the size of you Magento Database small it helps to truncate your log tables.

The following is for MySQL access to truncate all data in your tables.

Always BACKUP first

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` ;

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

The Windows 7 Dilemma

Windows vs. Mac

Welcome to my first Blog post. It seems that there has always been a divide between PC and Mac. I have always been on the PC side until recently...

Terminal Support

I love Windows 7, it is fast and mostly secure and offers nearly everything I need, except integrated Unix and there is my dilemma. My world now revolves around developing on LAMP and using a Windows box is more inconvenient than convenient. Using Putty is great and I find Cygwin exciting, but at the end of day they all have their shortcomings. I am using a Ubuntu (Soon to be Fedora) box at work now and I find I hardly ever turn to my PC. The simple fact that I spend most of my time in the command line is a big factor on why I want to switch.

Why not just go to Linux?

So I guess the next question has to be "Why not just switch to Linux?" The quick answer is that I would like to have access to mainstream programs that are only available for PC/Mac. So if I get a computer that has mainstream integration and has Unix support what do you choose? The answer seems simple.

Boot time

I rebooted my Windows 7 machine this morning, then went and took the trash out. When I first installed my machine I tried to make sure that I had only items I need, but as your machine gets older it loads more and more into start up. Wouldn't it be great if you didn't have to worry about that? Wouldn't it be great to have your machine ready to use in a couple of minutes?

Conclusion?

I think the verdict is still out, but I decided to look at the new Macbook Air. I think it will give me the portability and functionality that I want in a computer along with Mainstream support to use all the commercial programs I want to use.

I will keep you posted!

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