summaryrefslogtreecommitdiff
path: root/_site_build
diff options
context:
space:
mode:
authordavidtsadler <davidtsadler@googlemail.com>2012-05-13 22:34:28 +0100
committerdavidtsadler <davidtsadler@googlemail.com>2012-05-13 22:34:28 +0100
commitb0c51b1e74203f54ca7418e85b64086387bfaeac (patch)
treef6d66b744f6d57cb3f417a500aedf55f4e094024 /_site_build
parent2322bec7d13880acbe8616bc28190440b9377e69 (diff)
Save work in progress.
Diffstat (limited to '_site_build')
-rw-r--r--_site_build/_posts/2012-04-21-how-to-install-magento-on-ubuntu.markdown108
1 files changed, 97 insertions, 11 deletions
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 4a8a5ee..3175803 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
@@ -12,7 +12,7 @@ facebook_like: true
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 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.
+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.
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.
@@ -87,12 +87,12 @@ you can instead use,
In order to take advantage of this feature we need to enable Apache's rewrite module with the `a2enmod` command.
{% highlight bash %}
-sudo a2enmod rewrite
+sudo a2enmod rewrite
sudo service apache2 restart
{% endhighlight %}
<h2 id="php">Installing the PHP scripting language.</h2>
-As can be seen from the list of system <a href="http://www.magentocommerce.com/system-requirements" rel="external nofollow" target="_blank" title="Go to the list of Magento requirements">requirements</a>, Magento needs PHP version 5.2.13 or later with the following extensions.
+As can be seen from the list of system <a href="http://www.magentocommerce.com/system-requirements" rel="external nofollow" target="_blank" title="Go to the list of Magento requirements">requirements</a>, Magento needs PHP version 5.2.13 or later with the following extensions.
* PDO_MySQL
* simplexml
@@ -121,18 +121,18 @@ sudo apt-get install mysql-server -y
Before we get into the business of creating the directory I need to point out a few things. The process below is heavly infulenced by how I setup websites when developing locally. The actual whys and wherefores of how I do this is are too long to go into detail in this post but can be summarised as such.
* Each site is served from its own directory named after the site's domain name. E.g, `my-example-site.com`
-* Group ownership of these directories, and their contents, is set as `www-data`. The same group that the Apache process runs under.
+* Group ownership of these directories, and their contents, is set as `www-data`. The same group that the Apache process runs under.
* The directories are located in a `public_html` directory that has been created in my home directory.
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.
+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.
+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
@@ -145,7 +145,7 @@ As both you and Apache need read and write access to the directory we have used
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.
+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}
@@ -153,7 +153,7 @@ mkdir -p /home/dev/public_html/magento-store.com/{public,log}
<h2 id="vhost">Configuring the Apache Virtual Host.</h2>
-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`
+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 <<EOF
@@ -172,14 +172,14 @@ sudo bash -c "cat >> /etc/apache2/sites-available/magento-store.com <<EOF
EOF"
{% endhighlight %}
-Using the `a2ensite` command and restarting Apache will ensure that the new configuration file is loaded.
+Using the `a2ensite` command and restarting Apache will load the new configuration file.
{% 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.
+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 <<EOF
@@ -190,8 +190,94 @@ sudo bash -c "cat >> /etc/hosts <<EOF
EOF"
{% endhighlight %}
-If everything has gone according to plan you should be able to open a browser and navigate to `localhost.magento-store.com` and see a directory listing as shown below.
+If everything has gone according to plan you should be able to open a browser and navigate to `localhost.magento-store.com` where you will see a directory listing as shown below.
+
<figure>
![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.")
</figure>
+
<h2 id="magento">Installing Magento.</h2>
+
+Log into MySQL with the following command. Note that it will prompt you to enter the root user password that you specified as part of the MySQL install.
+
+{% highlight bash %}
+mysql -u root -p
+{% endhighlight %}
+
+We need to create a database for Magento and a MySQL user that it can use to access it. For local development it is fine to use the value &quot;magento&quot; for not only the database name but for the user's name and password. On a production server you would use something a lot more secure.
+
+{% highlight mysql %}
+CREATE DATABASE magento;
+INSERT INTO mysql.user (User,Host,Password) VALUES('magento','localhost',PASSWORD('magento'));
+FLUSH PRIVILEGES;
+GRANT ALL PRIVILEGES ON magento.* to magento@localhost;
+FLUSH PRIVILEGES;
+exit
+{% endhighlight %}
+
+Change into the directory where we wish to perform the install.
+
+{% highlight bash %}
+cd /home/dev/public_html/magento-store.com/public
+{% endhighlight %}
+
+You now need to download the tar archive of the source code and unpack it.
+
+{% highlight bash %}
+wget http://www.magentocommerce.com/downloads/assets/1.7.0.0/magento-1.7.0.0.tar.gz
+tar -xzvf magento-1.7.0.0.tar.gz
+{% endhighlight %}
+
+The source code is located in a directory called `magento`. Since we don't want Apache to serve Magento from this sub-directory we need to move the source code out of it.
+
+{% highlight bash %}
+mv magento/* magento/.htaccess .
+{% endhighlight %}
+
+We should now tidy up after ourselves by removing any unnecessary files.
+
+{% highlight bash %}
+rm magento-1.7.0.0.tar.gz
+rm -r magento
+{% endhighlight %}
+
+Since testing an eCommerce store without any products is not much fun we will install some sample data. First download and extract the tar archive that Magento provides for us.
+
+{% highlight bash %}
+wget http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz
+tar -xzvf magento-sample-data-1.6.1.0.tar.gz
+{% endhighlight %}
+
+The archive provides a sql file and various assets such as images. The assets need to be moved from the sample sub-directory and put into the `media` directory of the Magento source. The sql file is also moved to make it easier for loading into MySQL.
+
+{% highlight bash %}
+mv magento-sample-data-1.6.1.0/media/* media/
+mv magento-sample-data-1.6.1.0/magento_sample_data_for_1.6.1.0.sql data.sql
+{% endhighlight %}
+
+We need to log into MySQL again but this time we will use the MySQL user `magento` that we set up earlier.
+
+{% highlight bash %}
+mysql -u magento -p
+{% endhighlight %}
+
+When prompted enter `magento` as the password and then enter the following sql statements to load in the sample data.
+
+{% highlight sql %}
+use magento;
+source data.sql
+exit
+{% endhighlight %}
+
+Again we can now remove any unnecessary files.
+
+{% highlight bash %}
+rm magento-sample-data-1.6.1.0.tar.gz
+rm -r magento-sample-data-1.6.1.0
+rm data.sql
+{% endhighlight %}
+
+{% highlight bash %}
+chmod g+w var var/connect/ var/.htaccess app/etc
+chmod -R g+w var/package/ media
+{% endhighlight %}