From 2322bec7d13880acbe8616bc28190440b9377e69 Mon Sep 17 00:00:00 2001 From: davidtsadler Date: Sun, 13 May 2012 20:47:31 +0100 Subject: Save progress on posts. --- ...04-21-how-to-install-magento-on-ubuntu.markdown | 72 ++++++++++++++++++++- _site_build/img/localhost.magento-store.com.jpg | Bin 0 -> 73211 bytes 2 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 _site_build/img/localhost.magento-store.com.jpg diff --git a/_site_build/_posts/2012-04-21-how-to-install-magento-on-ubuntu.markdown b/_site_build/_posts/2012-04-21-how-to-install-magento-on-ubuntu.markdown index 3ce459d..4a8a5ee 100644 --- a/_site_build/_posts/2012-04-21-how-to-install-magento-on-ubuntu.markdown +++ b/_site_build/_posts/2012-04-21-how-to-install-magento-on-ubuntu.markdown @@ -9,10 +9,10 @@ comments: true google_plus: true twitter_share: true facebook_like: true -published: false +published: true licensed: true --- -By the end of this guide you will have installed Magento, and some sample data, locally on Ubuntu. This will allow you to get to grips with the software before installing it onto a production server. In addition to Magento I will take you through installing Apache, PHP and MySQL. I'm going to assume that you are using Ubuntu 12.04 (Precise Pangolin) and that you wish to install version 1.7.0.0 of Magento. You're results may vary if you are using different versions. +By the end of this guide you will have installed Magento, and some sample data, locally on Ubuntu. This will allow you to get to grips with the software before installing it onto a production server. In addition to Magento I will take you through installing Apache, PHP and MySQL. I'm going to assume that you are using Ubuntu 12.04 LTS (Precise Pangolin) and that you wish to install version 1.7.0.0 of Magento. You're results may vary if you are using different versions. As this is quite a long post I have broken it down into various sections. Feel free to ignore those parts that are not relevent for you. @@ -33,7 +33,7 @@ If you have never heard of Magento the following from the Magento Frequently Asked Questions -Magento is available in two editions, Community and Enterprise. The Enterpise edition is the company's commercial version of the software and is meant for large-scale eCommerce users. The Community edition on the other hand is available as a free download under the open source OSL 3.0 license and is the version that you will be installing. +Magento is available in two editions, Community and Enterprise. The Enterprise edition is the company's commercial version of the software and is meant for large-scale eCommerce users. The Community edition on the other hand is available as a free download under the open source OSL 3.0 license and is the version that you will be installing. This post will walk you through every thing you need to get a local copy of Magento running on Ubuntu. It is not meant as a guide to installing a fully working eCommerce store located on a production server. @@ -126,6 +126,72 @@ Before we get into the business of creating the directory I need to point out a Many of the commands that follow use absoulte paths when refering to directories located in my home directory. Since the username on my computer is `dev` you will need to replace any occurrences of this with your own username. Feel free to also change the location of any of the directories. Just remember that you must use the correct location when configuring the virtual host later on. +The first thing we need to do is ensure that you belong to the same group as the Apache process. Note that after entering the command you must log out and then log back in before the system will recognise that you belong to a new group. + +{% highlight bash %} +sudo usermod -a -G www-data dev +{% endhighlight %} + +You can use the `groups` command to check that you belong to the `www-data` group. As long as it appears in the list of groups you can move on to creating the required directories. + +{% highlight bash %} +mkdir /home/dev/public_html +chgrp www-data /home/dev/public_html +{% endhighlight %} + +As both you and Apache need read and write access to the directory we have used the `chgrp` command to change its group to be `www-data`. However any new files or directories that you create within `public_html` will not inherit the same group. We therefore need to change the permissions to include the "setgid" bit. + +{% highlight bash %} +sudo chmod 2750 /home/dev/public_html +{% endhighlight %} + +We can now create the directory that Magento will be served from and it will be given the `www-data` group automatically. + +{% highlight bash %} +mkdir -p /home/dev/public_html/magento-store.com/{public,log} +{% endhighlight %} +

Configuring the Apache Virtual Host.

+We will create a simple virtual host configuration file that will instruct Apache to serve the contents of the directory `/home/dev/public_html/magento-store.com/public` for any requests to `localhost.magento-store.com` + +{% highlight bash %} +sudo bash -c "cat >> /etc/apache2/sites-available/magento-store.com < + + ServerName localhost.magento-store.com + ServerAlias www.localhost.magento-store.com + + DocumentRoot /home/dev/public_html/magento-store.com/public + + LogLevel warn + ErrorLog /home/dev/public_html/magento-store.com/log/error.log + CustomLog /home/dev/public_html/magento-store.com/log/access.log combined + + +EOF" +{% endhighlight %} + +Using the `a2ensite` command and restarting Apache will ensure that the new configuration file is loaded. + +{% highlight bash %} +sudo a2ensite magento-store.com +sudo service apache2 restart +{% endhighlight %} + +To ensure that the domain `localhost.magento-store.com` resolves locally to the computer we need to add some entries to the system's `hosts` file. + +{% highlight bash %} +sudo bash -c "cat >> /etc/hosts < +![Browser showing the directory listing when going to localhost.magento-store.com](/img/localhost.magento-store.com.jpg "Visiting localhost.magento-store.com for the first time.") +

Installing Magento.

diff --git a/_site_build/img/localhost.magento-store.com.jpg b/_site_build/img/localhost.magento-store.com.jpg new file mode 100644 index 0000000..c7e6387 Binary files /dev/null and b/_site_build/img/localhost.magento-store.com.jpg differ -- cgit v1.2.3-13-gbd6f