As part of our Maker 2014 project we decided to utilise an AWS server Martin had signed up to. While we will probably end up using a local server on the day we thought it was a good opportunity to give AWS a test run. As well as giving us a way to share an environment while working as a distributed team, the process of setting up the AWS will server to Document the setup we require for our project. The Aim would be to later create a script that does all the installs and setups for us.
Originally posted on jonnie.io
Note: at the time of writing, this is a work in progress and I hope to keep it updated
So what do we need to install & setup?
Before we start
Lets make sure everything is update on our system using apt-get
:
|
|
Node.js Setup
What is Node.js? It is a Server-side implementation of the Javascript platform which allows repaid development of applications.This is particularly true if you are using complete Javascript stack such as MEAN(MongoDB, Express.js,Angular.js & Node.js) as development can be more consistent and be designed within the same system. This make rapid prototyping and proof of concept that much quicker.
From my research online I have found that it is suggested building Node.js from source as packages in the Advanced Packaging Tool (AptGet) do not work always or are outdated at times on Ubuntu. So the first thing we need to do is install the some dependiences required for building Node.js
- build-essential which is used to build Debian packages
- lamp-server which installs Apache, MySQL & PHP for linux
|
|
Next we need to get the node packages to build, I went with v0.10.22 as I knew it was a stable release but if you wish to go for a newer version check out the Node.js dist site for the verion number of your choice
|
|
Next we need to mov the the node directory, run the configuration script, build it and then install it
|
|
The Configuration script just sets up what ever enviroment variables required and performs checks required to build Node for our platform
The make
utility is to determine automatically which pieces of Node.js needs to be recompiled, and issues the commands to recompile them.
Node should be all set Now so lets test by checking the version
|
|
Mongodb Setup
MongoDB is an open-source document database, and the leading NoSQL database. Among its features it includes JSON-style documents with dynamic schemas which offer simplicity and power. This is especially useful with node since we are already working with Javascript, and in a prototyping and rapid development environment it means we don’t have to get hung up on our models and can change them on the fly.
We will use .deb
packages to install MongoDB. While Ubuntu includes its own MongoDB packages, the official MongoDB packages are generally more up-to-date.
So the first thing we need to do is add the MongoDB public GPG Key
|
|
Create the /etc/apt/sources.list.d/mongodb.list list file using the following command:
|
|
Now we need to reload local package database
|
|
Install mongoDB
|
|
Create /data/db which is where our schemas will be stored (this may require sudo)
|
|
Make sure you change the premissions of this folder so that you do not require sudo, I did this by giving my username and a specific group access
|
|
Finally you can start running MongoDB with the command mongod
Or sudo /etc/init.d/mongod start
.
Again I recommend changing the permissions so that sudo is not required.
Coming soon…..
I will follow thing up with a tutorial on creating a minimal starting point for a Node Restful service which we will eventually use to communicate with our arduino, intel galileo and Raspberry Pi (I Will also follow up on getting a similar setup installed on a Pi)