Server Ubuntu – IV – MEAN

Introduction to MEAN

meanjs
meanjs

MEAN similar to LAMP, it is a server that uses the following technologies, MongoDB (non-relational database), Express (nodejs framework), Angularjs (the part framework client) and Nodejs (the server-side javascript programming). But what is all this? simplifying we will say that all the programming language is JavaScript and now to explain it.

AngularJS

AngularJS
AngularJS

It on the client-side, i.e., the computer that connects to a server, all of us are customers when we enter an address from Google, to the same Drouiz, there are several standards that are browsers understand. The first, the famous HTML skeleton of a website, the minimum necessary to make it work, then are the CSS, styles, skin and muscles, which gives color and beauty, and finally javascript, the brain, the programming. Formerly browsers to have certain dynamism in the client-side using Java or Flash plugins technologies practically obsolete except for some applications. Today all browsers understand javascript.

JavaScript starts to pick up popularity, in my opinion is a language complex and simple at the same time, really is the abstract I’ve ever met, but that’s its charm, course begins to create community and libraries that are helping to improve the code and finally begin to emerge the frameworks are born. While PHP framework is running on the server, with AngularJS run it on the client it is a page that makes small requests by clicking on it, load times are smaller and more interactive. But this is only an introduction is something client not server which is what we are preparing.

NodeJS

NodeJS
NodeJS

If in the standard client-side JavaScript is on the side of the server already exist and there are lot of languages PHP, Python, Java and Windows ASP. would not be wonderful to use the same language? It is the idea of NodeJS programmer do not change to work in the frontend or the backend. So simple, NodeJS is that same adapted JavaScript to do what in the past was PHP.

Express

Express
Express

It is a framework of NodeJS, light and simple, its operation is basically load a web of Angular and Exchange data, rather than fully load a page by clicking on a link, the philosophy of MEAN is work with Json (basically objects in text format). A example simple, imagine that have a web Angular with its HTML and their styles and has an option of language, which click, instead of PHP send again all the page, Express sends a Json with them changes that must perform, them images are the same and the time of load best would not is a great technology?

MongoDB

mongoDB
mongoDB

As if we have JavaScript on the client and the server because not in the database? and that is MongoDB. A non relational database, which basically stores objects in JavaScript. Non-relational because objects can be different, while MariaDB or MySQL are similar to a sheet of calculation Excel, data in rows and columns all the same, MongoDB stores data as objects that need not be related among them, these data are important in the Internet today, for example in Big Data where sometimes the data arrive in different ways.

Installing MEAN

MEAN
MEAN

Installing MongoDB

First we must add an additional repository with MongoDB packages updated to date, but before we need the key to Mongo for the list of keys to trusted. (Remember this is for Ubuntu Server 14, for other versions click here)

sudo apt-key adv--keyserver hkp://keyserver.ubuntu.com:80--recv 7F0CEB10

Now we create a list using the following command (Ubuntu 14)

echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

We update

sudo apt-get update

Install the latest stable version of MongoDB

sudo apt-get install - and mongodb-org

We finally started the MongoDB

sudo service mongod start

Installation of NodeJS

We started by installing a library of Ubuntu that allows us to create packages.

1
sudo apt-get install build-essential libssl-dev git
  • build-essential and libssl-dev serves to compile packages, that will do compile the nodejs.
  • git to download repositories from github

We load the nvm installation script from Github, to subsequently install node.

1
curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh

Insert the following command to reload file in the terminal.

1
source ~/.profile

We have installed nvm that is a Manager for nodeJS versions, later comment that he is a manager of versions, with the first thing is to check the versions we have on nodeJS

1
NVM ls-remote

Will be shown a list

Then select which want the last one to date, in our case

1
NVM
1
install v5.1.0

Once installed, run the following two commands,

1
2
node-v
NPM - v

The first indicates the version of node and the second of npm.

Express

Finally, we will install Express, simply with a command

sudo npm install-gexpress

And we will have our server MEAN ready

In case of fail we can use:

sudo apt-get install node-express

Testing MEAN

Already only test and check if it works we, nodeJS works differently than Apache, it is not subject to teach operation but if you make something simple work.

MORE INFO

Previous IndexFollowing

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.