Wednesday 4 February 2015

How To Install Node.js and NPM on an Ubuntu 14.04 server


Step 1: Add PPA in System

First add node.js ppa in our system using following set of command. We also need to install python-software-properties package if not installed already.
$ sudo apt-get install python-software-properties
$ sudo apt-add-repository ppa:chris-lea/node.js
$ sudo apt-get update
without PPA in Terminal
sudo apt-get install nodejs
Step 2: Install Node.js and NPM
After adding required PPA file, lets install Nodejs package. NPM will also be installed with node.js. This command will also install many other dependent packages on your system.
$  sudo apt-get install nodejs
you will need to install the build-essentials package for NPM
$ sudo apt-get install build-essential
after do that install with below command
$  sudo apt-get install npm

Step 3: Check Node.js and NPM Version

$ node -v
$ npm  -v

Step 4: Create Demo Web Server (Optional)

This is an optional step. If you want to test your node.js install. Lets create an web server with “Hello World!” text. Create a file http_server.js
$ vim http_server.js

and add following content

var http = require('http');
http.createServer(function (req, res) {
 res.writeHead(200, {'Content-Type': 'text/plain'});
 res.end('Hello World\n');
}).listen(3001, "127.0.0.1");
console.log('Server running at http://127.0.0.1:3001/');
Now start the web server using below command.

$ node --debug http_server.js

debugger listening on port 5858
Server running at http://127.0.0.1:3001/

How To Install Redis Server 2.8.17 On Ubuntu 14.04 with Lampp ( Xampp )


Install Redis-server


$ sudo add-apt-repository ppa:chris-lea/redis-server

$ sudo apt-get update

$ sudo apt-get install redis-server



Install Redis  PHP Driver to Lampp

Note that if you install XAMPP using the new .run installer file (versions newer than 1.8.3) then you will get the option during setup to install the development files as well as the core files. Remember to select both.

1 Please download lattest xampp for ubuntu and install with following command:

cd Download ( where xampp download location)
sudo chmod +x xampp-linux-1.8.3-4-installer.run
sudo ./xampp-linux-1.8.3-4-installer.run
 

 2. Run the pecl installer
1
sudo /opt/lampp/bin/pecl install redis-2.2.5

Note : If You getting below error : “ ERROR: `phpize' failed”

sudo apt-get install php5-dev

Now again run this command :

sudo /opt/lampp/bin/pecl install redis-2.2.5

Note : again any error same like

the error message you got:
configure: error: sasl.h not found!
should be solveable by:
sudo apt-get install libsasl2-dev
3. Finally add the following to the php.ini file (located in /opt/lampp/etc folder)
1
extension=redis.so
4. restart xampp server

1
sudo /opt/lampp/lampp start
That’s it!