How to Install Latest Nodejs & Npm on Ubuntu 16.04 & 14.04

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Latest version node.js ppa is maintaining by its official website. We can add this PPA to Ubuntu 16.04 LTS (Trusty Tahr) and 14.04 LTS (Xenial Xerus) Systems and install node.js with few easy commands.

Install nodejs

Step 1: Add NodeJs PPA

First, you need to node.js PPA in our system provides by nodejs official website. We also need to install python-software-properties package if not installed already.

$ sudo apt-get install python-software-properties
$ curl -sL | sudo -E bash -

Step 2: Install Nodejs and NPM

After adding required PPA file lets install Node 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

Step 3: Check Node.js and NPM Version

After installing node.js verify and check the installed version. You can find more details about current version on node.js official website.

$ node -v 


Also, check the version of installed npm.

$ npm -v 


Step 4: Create Demo Web Server (Optional)

This is an optional step. If you want to test your node.js install. Let’s create a 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, "");
console.log('Server running at');

Now start the web server using below command.

$ node --debug http_server.js

debugger listening on port 5858
Server running at

The web server has been started on port 3001. Now access URL in browser. Now you will need to configure a front-end server for your app.


credit :


How To Install Apache MySQL PHP (LAMP Stack) on Ubuntu 16.04

LAMP (Linux, Apache, MySQL and PHP ) Stack is the most popular environment in PHP website development and hosting. Linux is the operating system, Apache is the popular web server developed by Apache Foundation. MySQL is relational database management system used for storing data and PHP is an development language.

This article will help you to Install Apache 2.4, MySQL 5.7 and PHP 7.0 . on Ubuntu 16.04 LTS Systems.

Step 1 – Install PHP

PHP 7 is the default available packages in Ubuntu 16.04 repositories. Simply use the following commands to update apt cache and install PHP packages on your system.

$ sudo apt update
$ sudo apt install -y php

Verify installed PHP version using following command.

rahul@tecadmin:~$ php -v

PHP 7.0.4-7ubuntu2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Step 2 – Install Apache2

After installing PHP on your system, let’s start installation of Apache2 in your system. Your also required to install libapache2-mod-php module to work PHP with Apache2.

$ sudo apt install apache2 libapache2-mod-php

Step 3 – Install MySQL

Finally install mysql-server packages for MySQL database. Also install php-mysql package to use MySQL support using php. Use following command to install it.

$ sudo apt install mysql-server php-mysql

Installer will prompt for root password, This password will work for your MySQL root user. After installing MySQL execute following command for initial settings of MySQL server. You will she that script will prompt about more settings than earlier mysql versions like password validation policy etc.

$ sudo mysql_secure_installation

Step 4 – Restart Apache2, MySQL Services

After installing all services on your system, start all required services.

$ sudo systemctl restart apache2.service
$ sudo systemctl restart mysql.service

Step 5 – Open Access in Firewall

If you are using iptables, Use following commands to open port 80 for public access of webserver.

Iptables Users:

$ sudo iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT

UFW Users:

$ sudo ufw allow 80/tcp

Step 6 – Test Setup

After completing all setup. Let’s create a info.php file website document root with following content.

Now access this file in web browser. You will see the screen like below with all details of PHP on server.


Congratulation’s! You have successfully configured web server on your ubuntu System.

credit :