Convert Microsoft to LINUX: Magento Shopping Cart

If you want to install a shopping cart that everybody can add to try Magento Shopping Cart. It is built into most commercial web hosting distributions. To get it you also have to have php5, mysql (client and Server), httpd/Apache2 installed. Here is how to do it using Ubuntu. Type as root in a terminal window:
apt-get install apache2 php5 mysql-client mysql-server php5-mysql
Restart Apache2 to be safe with the command:
/etc/init.d/apache2 reload

To be sure you have all the php applications in there do this:
dpkg --get-selections | grep php
libapache2-mod-php5 install
php-pear install
php5 install
php5-cli install
php5-common install
php5-curl install
php5-dev install
php5-gd install
php5-mcrypt install
php5-mysql install
phpmyadmin install
Install anything that is missing. The phpmyadmin is optional but always nice to have if you get in a jam.

Fetch the tarred file by selecting the appropriate gzipped file from Magento  . Note, your version may be newer, at the time of this writing was the most recent version.
cd /var/www
sudo tar -zxvpf /home/victor/Downloads/magento-
After untaring using the above command, this will create a new directory /var/www/magento/

You are now ready to create the database that magento will use. Go to the terminal window and type:
mysqladmin -u root password 'your-brand-new-password' [quotes are required]
Make additional security-related changes to mysql. Type:
mysql -u root -p
You will now be at a mysql> prompt.
mysql> DROP DATABASE test; [removes the test database]
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]
Create a database and database user for your data. You will use this database and user name in your database connection string. The GRANT statement actually creates a new MySQL user account.
mysql> CREATE DATABASE magento_mysql;
mysql> GRANT ALL PRIVILEGES ON magento_mysql.* TO 'magento_admin'@'localhost' IDENTIFIED BY 'thepassword';
Edit the /etc/hosts file so it is like this: localhost
... other lines in file are fine

You are now ready to run the install, type: in your web browser. You can then login as the Magento Shopping Cart Administrator and configure the rest of the website. You will eventually want to configure the cron job to include backups of databases and the magento directory. Change permissions and ownership on the /var/www/magento sub-directories as called for by the install program. This is what I did:
cd /var/www/magento
sudo chown -R victor:victor .
This will recursively change the ownership. The install program also requested several executable permissions to be changed as in:
sudo chmod 777 -R ./media

Verify you can go in as admin with Admin Login
being typed in the web browser.
Now, that you have installed immediately remove the file install.php, i.e.
sudo rm /var/www/magento/install.php

Since this site now involves financial transactions you must keep a very close security watch on it. Make all your permissions as strict as possible for the directories so the site still works. And keep that key it uses in a safe place. Apply all security updates etc.


You may get the message:
"Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider."

To fix this go to /etc/apache2/sites-enabled
and modify the appropiate site. You want to change:
by setting to "All" the value of the "AllowOverride" directive applying to the directory where Magento has been installed. i.e.

Directory /var/www/magento/
Options Indexes FollowSymLinks MultiViews
# AllowOverride None
AllowOverride All
Order allow,deny
allow from all

You are done for now. Enjoy!