Install Node.js with MongoDB

From ivc wiki
Jump to navigationJump to search

Node.js is a complete server and client environment, as in the server processing and client interaction is coded in Coffee (an abstract Javascript layer). This makes it a very efficient stack with little overhead.

Install OS X

Node.js

Download the latest stable Node.js package, the current versions is 0.4.10.

wget http://nodejs.org/dist/node-v0.4.10.tar.gz
tar zxvf node-v0.4.10.tar.gz
cd node-v0.4.10
ls

Check and build Node.js. Superuser to install it under /usr/local

./configure
make
make install
sudo make install

MongoDB

MongoDB is a document-oriented database, oposite to a relational-oriented database. Structured in JSON-documents and easy to create data models.

Download MongoDB 64-bit and extract the binaries.

wget http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-1.8.2.tgz
tar zxvf mongodb-osx-x86_64-1.8.2.tgz
cd mongodb-osx-x86_64-1.8.2
cd bin/
ls

Create the database directory and execute the server.

sudo mkdir -p /data/db
./mongod

npm

NPM stands for Node.js Package Management. Makes it easy to resolve and install any dependencies Node.js may require.

wget http://npmjs.org/install.sh
chmod +x install.sh
sudo ./install.sh
npm 

Run npm to install any dependcies and coffee-script. Coffe-script compiles abstract code into Javascript, worth a try.

sudo npm install
sudo npm install -g coffee-script
sudo npm list

redis

redis is a in-memory key-value data store.

wget http://redis.googlecode.com/files/redis-2.2.12.tar.gz
tar xzf redis-2.2.12.tar.gz
cd redis-2.2.12
make

When the binary is compiled start the server.

src/redis-server