diff options
| author | davidtsadler <davidtsadler@googlemail.com> | 2012-05-06 23:49:10 +0100 |
|---|---|---|
| committer | davidtsadler <davidtsadler@googlemail.com> | 2012-05-06 23:49:10 +0100 |
| commit | 9e413de653ee517470e9027ee718514993fbbea9 (patch) | |
| tree | b2ae8b34d9211def5d1ea2ea38050291e136fdc1 /_site_build | |
| parent | d1fcacc019e96d50a58bada3bf610968616d14c2 (diff) | |
Save progress on posts.
Diffstat (limited to '_site_build')
| -rw-r--r-- | _site_build/_posts/2012-04-21-how-to-install-magento-on-ubuntu.markdown | 2 | ||||
| -rw-r--r-- | _site_build/_posts/2012-05-06-installing-node-js-on-ubuntu.markdown (renamed from _site_build/_posts/2012-05-04-installing-node-js-on-ubuntu.markdown) | 68 |
2 files changed, 57 insertions, 13 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 0ef8a87..3ce459d 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,7 +9,7 @@ comments: true google_plus: true twitter_share: true facebook_like: true -published: true +published: false 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. diff --git a/_site_build/_posts/2012-05-04-installing-node-js-on-ubuntu.markdown b/_site_build/_posts/2012-05-06-installing-node-js-on-ubuntu.markdown index c8b0f02..2866674 100644 --- a/_site_build/_posts/2012-05-04-installing-node-js-on-ubuntu.markdown +++ b/_site_build/_posts/2012-05-06-installing-node-js-on-ubuntu.markdown @@ -9,10 +9,10 @@ comments: true google_plus: true twitter_share: true facebook_like: true -published: true +published: false licensed: true --- -Node.js is ...... This guide will show you how to install Node.js on Ubuntu from either the source code or Git repository. I'm going to assume that you are using Ubuntu 12.04 (Precise Pangolin) and that you wish to install version 0.6.17 of Node.js. You're results may vary if you are using different versions. +This guide will show you how to install Node.js on Ubuntu from either the source code or Git repository. I'm going to assume that you are using Ubuntu 12.04 (Precise Pangolin) and that you wish to install version 0.6.17 of Node.js. You're results may vary if you are using different versions. ## Getting started. @@ -38,7 +38,7 @@ Node.js itself requires very little in the way of dependencies. sudo apt-get install python libssl-dev -y {% endhighlight %} -Wtih the dependencies installed we can now move onto installing Node.js itself. Since there is a very good chance that Node.js has been updated since this was written, you should check the <a href="http://nodejs.org/#download" rel="external nofollow" target="_blank" title="Go to the Node.js website">website</a> for the latest version number and subsitue it for the one used in the rest of this post. You have two options when it comes to the installation. You can download the source code or clone the Git repository. The process is similiar for both methods and so you should choose which ever one you are confortable with. I personally use Git as I find it easier to update Node.js to the latest version. +Wtih the dependencies installed we can now move onto installing Node.js itself. Since there is a very good chance that Node.js has been updated since this was written, you should check the <a href="http://nodejs.org/#download" rel="external nofollow" target="_blank" title="Go to the Node.js website">website</a> for the latest version number and substitute it for the one used in the rest of this post. You have two options when it comes to the installation. You can download the source code or clone the Git repository. The process is similar for both methods and so you should choose which ever one you are comfortable with. I personally use Git as I find it easier to update Node.js to the latest version. * [Installing from source.](#from-source) * [Installing with Git.](#via-git) @@ -62,16 +62,16 @@ cd node-v0.6.17 sudo ./configure {% endhighlight %} -The `make` command can now be used to compile and install Node.js. +The `make` command can now be used to compile and install Node.js. {% highlight bash %} sudo make sudo make install {% endhighlight %} -This will result in the commands `node` and `npm` been installed into the `/usr/local/bin` directory. Now that Node.js has been installed you may wish to try the example [code](#code). +This will result in the commands `node` and `npm` been installed into the `/usr/local/bin` directory. Now that Node.js has been installed you may wish to try the example [application](#application). -### Upgrading from source. +## Upgrading from source. To upgrade Node.js from source simply download the latest tar archive and repeat the above installation process. The updated version will overwrite the previous version. @@ -97,16 +97,16 @@ We now need to configure the source code by using the provided `configure` scrip sudo ./configure {% endhighlight %} -The `make` command can now be used to compile and install Node.js. +The `make` command can now be used to compile and install Node.js. {% highlight bash %} sudo make sudo make install {% endhighlight %} -This will result in the commands `node` and `npm` been installed into the `/usr/local/bin` directory. Now that Node.js has been installed you may wish to try the example [code](#code). +This will result in the commands `node` and `npm` been installed into the `/usr/local/bin` directory. Now that Node.js has been installed you may wish to try the example [application](#application). -### Upgrading via Git. +## Upgrading via Git. To upgrade Node.js you need to go back into the cloned repository and pull down the latest source code. @@ -116,7 +116,7 @@ sudo git checkout master sudo git pull origin master {% endhighlight %} -You can then checkout the version branch that you wish to upgrade to. To check which versions are available use the `git tag` command. The upgrade is then performed by using the normall install commands. +You can then checkout the version branch that you wish to upgrade to. To check which versions are available use the `git tag` command. The upgrade is then performed by using the normal install commands. {% highlight bash %} sudo git checkout vx.x.x @@ -125,7 +125,51 @@ sudo make sudo make install {% endhighlight %} -## Installing into a alternative directory. +<h2 id="single-user">Installing for a single user.</h2> +Node.js can be easily installed for a single user with the modified process outlined below. For the sake of brevity I will show how to do this using the Git repository. The method is the same when using the source code. -## Checking the install +The idea is that we create a custom directory located in the user's home directory and configure Node.js to install itself there by using the `--prefix` option. For this example we will create a directory called `~/local/src` into which we will clone the Git repository. We then configure the code so that Node.js will be installed into the directory `~/local`. Note that because we are installing into the user's home directory we no longer need the `sudo` command. + +{% highlight bash %} +mkdir -p ~/local/src +cd ~/local/src +git clone git://github.com/joyent/node.git +cd node +git checkout v0.6.17 +./configure --prefix=~/local +make +make install +{% endhighlight %} + +The install process will create several new directories under the `~/local` directory. One of them is the `bin` directory that contains the `node` and `npm` commands. Since the system will not look in this directory when searching for commands entered by the user, we will need to update the `PATH` environment variable. + +{% highlight bash %} +echo 'PATH=$PATH:$HOME/local/bin' >> $HOME/.bashrc +source ~/.bashrc +{% endhighlight %} + +Now when ever you enter `node` or `npm` on the command line the system will know where to locate them. + +<h2 id="application">Example application.</h2> + +This example is taken directly from the Node.js <a href="http://nodejs.org" rel="external nofollow" target="_blank" title="Go to the Node.js website">website</a> and is a web server that responds with 'Hello World' for every request. + +{% highlight bash %} +cat > ~/server.js <<EOF +var http = require('http'); +http.createServer(function (req, res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('Hello World\n'); +}).listen(1337, '127.0.0.1'); +console.log('Server running at http://127.0.0.1:1337/'); +EOF +{% endhighlight %} + +The server is started with the following command. + +{% highlight bash %} +node ~/server.js +{% endhighlight %} + +If everything has gone according to plan you should see 'Hello World' when you open a web browser at `http://localhost:1337/`. |
