Skip to main content

Node.js: Notes on Install and Upgrade on Ubuntu

To install Node.js, first install the below prerequisite and add the node.js repository.
# sudo apt-get install python-software-properties
# sudo apt-add-repository ppa:chris-lea/node.js 
Now install Node.js and npm (the Node Packet Manager).
# sudo apt-get update
# sudo apt-get install nodejs npm
Thats it. Your Node.js is ready. Test by running the below command.
# node -v
v0.6.18
Node.js stable releases are done quite frequently. To upgrade run,
# sudo apt-get update
# sudo apt-get upgrade nodejs npm  
You could also use the Ubuntu Update Manager to do the update.


If you are the kind who prefers to directly build from the sources then,
# cd <directory>
# sudo wget http://nodejs.org/dist/v0.6.18/node-v0.6.18.tar.gz
# sudo tar -zxf node-v0.6.18.tar.gz
# cd node-v0.6.18
# sudo ./configure
# sudo make
# sudo make install
# node -v
v0.6.18
The latest version was v0.6.18 at the time of writing this post.

For other platforms, installation is simple. See the Node.js installation web page.

Comments

  1. Hi! Thanks for the great instructions. I have a problem though. I'm trying to install the latest version of node on ubuntu and followed your instructions. However, it keeps saying that I have the latest version of node, even though when I node -v, it prints v0.5.11-pre. Any idea what could be going on?

    Thanks!
    -Daron

    ReplyDelete
  2. Hi Daron, Thanks for reading.

    I assume even this command shows v0.5.11-pre ?

    $ dpkg -l | grep node

    I have encountered the "You have the latest version of node" when trying apt-get update once earlier. I downloaded and built from the sources and it worked. Also ensure that you have all node processes killed before starting installation.

    Pls let me know if this solved the problem, so that I go and update the above blog.

    ReplyDelete

Post a Comment

Popular posts from this blog

Minimal required code in HTML5

I've encountered this question repeatedly of late.
"What are the tags required at bare minimum for a html file?"
Earlier there were a bunch of mandatory tags that were required for any html file. At bare minimum, the recommended structure was: (ref: http://www.w3.org/TR/html4/struct/global.html)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML>   <HEAD>     <TITLE>A small HTML</TITLE>   </HEAD>   <BODY>     <P>Small HTML file!</P>   </BODY> </HTML>
Yes, using capitals for the tags was the way to go! Those were the days of the purists and strict was the way to be. Now open your notepad and copy the above code, save the file as old.html and launch it in Chrome or Firefox. You will see only one line "Small HTML file!" shown. Now launch the developer tools in Chrome or Inspect Element in Firefox. This can be done by pressing CTRL+SHIFT+I in both…

Using duplicate IDs in HTML

Well today I'm being a bit controversial. Let us see what the HTML5 spec says about unique IDs in a HTML file.
The id attribute specifies its element's unique identifier (ID). The value must be unique amongst all the IDs in the element's home subtree and must contain at least one character. The value must not contain any space characters. An element's unique identifier can be used for a variety of purposes, most notably as a way to link to specific parts of a document using fragment identifiers, as a way to target an element when scripting, and as a way to style a specific element from CSS. Yes its been mentioned almost everywhere on the planet that ID must be unique. Now let us look at the below code,


Launch


dup.css


#p2 {
  background-color: yellow; 
}

dup-id.html

<!DOCTYPE html>
<html>
  <head>
    <title>Duplicate ID Tester</title>
<link rel="stylesheet" href="dup.css" />
  </head>
  <body>
<p><a href=&quo…

Fixing Date, Time and Zone on RHEL 6 command line

Had to fix all time related issues on a remote RHEL 6 server which runs without any windowing system. Plain ol' command line. Documenting steps here for future reference:

Check to see if your date and timezone settings are accurate:
# date
# cat /etc/sysconfig/clock

The server I accessed had wrong settings for both the commands. Here are the steps I used to correct:

Find out your timezone from the folder /usr/share/zoneinfo
# ls /usr/share/zoneinfo

Mine was pointing to America/EDT instead of Asia/Calcutta

Update and save the /etc/sysconfig/clock file to
# sudo vi /etc/sysconfig/clock
ZONE="Asia/Calcutta"
UTC=true
ARC=false

Remove the /etc/localtime
# sudo rm /etc/localtime

Create a new soft link to your time zone
# cd /etc
# sudo ln -s /usr/share/zoneinfo/Asia/Calcutta /etc/localtime
# ls -al localtime
Now it should show the link to your time zone

Set your hardware clock to UTC
# sudo hwclock --systohc --utc
# hwclock --show

Update your time from a NTP server (Red Hat NTP server use…