Creating a personalized server for development

We know that most of the web servers for open source languages run on linux. So in order to get the feel of developing in server even in local machine is very important for a new developer. But installing linux server directly on personal machines may be difficult, since full stack developers need access to designing tools available on Windows. This post guides you to setup a personalized server.


  1. Download Virtual box (Open source) for your windows machine.
  2. Download ubuntu server (Note: Don’t use ubuntu desktop), because Ubuntu server will not have GUI and will give a good feel of using a server.

Installing Ubuntu Server on Virtual Box:

  • Create a new Virtual Machine, select Ubuntu from the dropdown.
  • Allocate atleast 30GB of disk space.
  • Allocate 1GB of RAM space
  • Start the Virtual Machine, and it asks for boot device, select the ISO
  • Select install ‘Ubuntu Server’
  • Then follow the instructions for selecting keyboard, encryption of drive etc.,
  • When it asks for installing other tools, select ‘DNS server’, ‘LAMP server'(if you want PHP), ‘Open SSH’ (Must select for doing an SSH), ‘Samba Server’ (Must select for mounting drive on windows machine).
  • Setup users, root password with the instructions on the screen.
  • Now your Ubuntu Server is ready

Mounting a drive from Ubuntu Server to Windows:

  • Login into your Ubuntu Server

$ sudo nano /etc/samba/smb.conf

  • Change the Workgroup to your workgroup as per your windows machine (To see workgroup in windows Goto Explorer -> right click and select properties -> There you can seee WORKGROUP). Put the same name here else you cannot see the server as part of your workgroup
  • Then save and exit file.
  • Now create a user for samba

smbpasswd -a mohithg

  • Give it a password.
  • Next create a directory if you want to share that particular directory alone
  • Again, go to the smb.conf file , and add below text in the Share Definitions (below Printers)

       comment = Shared
       browseable = yes
       path = /home/mohithg
       read only = no
       guest ok = yes
       writeable = yes

  • You can change the path to your home directory or you home directory
  • If you want a password protection for your shared drive then use guest ok = no
  • Restart your server

Mounting the Shared drive on Windows

Option 1:

  • You can goto run (Windows Key + r) and type \\HOSTNAME and see your shared server
  • The host name is the one that you gave when installing your ubuntu server

Option 2:

  • You can goto explorer and click on Network
  • There you can see your server with the hostname, double click on it to open and you can see your shared files.

SSH into Ubuntu Server

  • Download putty
  • Give the ip-address of your ubuntu server
  • Enter your username, password and connect
  • You should be able to access your server


By this you can keep all your development on server, and you will get a good feel of using server and developing things as you learn. Happy Coding!!!



Git Commands for branch removing, renaming

Remove a branch locally:

To remove a branch locally the command is:

$ git branch -D <branch-name>

Rename a branch:

Rename your local branch. If you are on the branch you want to rename:

     $ git branch -m <new-name>

Delete the old-name remote branch and push the new-name local branch:

     $ git push origin :old-name new-name

Reset the upstream branch for the new-name local branch  Switch to the branch and then:

     $ git push origin -u new-name.

*Refer my old post for switching between branches

Remove branches that are not in remote:

You might have some branches locally that other members of your team have remote it remote. To get rid of those branches run:

     $ git remote prune origin

Rebasing two branches Git

Rebasing is necessary in Git if your team is working on multiple branches. To merge code from remote branch to your working branch these commands are necessary:

First checkout to your remote branch and fetch all files

$ git checkout -b remote-branch

$ git fetch

Then give rebase from your working branch

$ git checkout working-branch

$ git rebase -i remote-branch

Then see the conflicts using

$ git status

Resolve all the conflicts then do

$ git add .

$ git rebase --continue


Next git commands

This article describes the next level of git commands with respect to my previous post on git.


You may need branches when you need to have different codebases for dev, stage, prod etc.,

$ git checkout -b "newbranch"

check branch you are in with

$ git branch

then start to add files

$ git add .

Check the status of files

$ git status

Then commit to git

$ git commit

$ git push origin <newbranch>


You need to set remote url for your git.

$git remote set-url origin <url>


If you feel not to enter your password each time you make a push you need to set SSH keys.

First, generate ssh keys in your machine

$ ssh-keygen -t rsa

Then check the keys

$ cat ~/.ssh/

Copy that output and move to Github profile settings and add SSH key in the SSH keys menu.

Then you can push changes without need to enter password each time.


What is REST API?

REST is REpresentational State Transfer. I consider it more useful than SOAP because SOAP uses only XML for transfer but REST uses both XML, JSON. (since I love JSON) and feel easy to handle JSON.

You should create an API for your application because you should build your application architecture such that only one part can access the databases (eg: Model) you should not allow view or controller to touch the DB (just saying for an example with MVC You can follow with any other custom architecture). So for Model to get data you need to build some API which gives data on request to it. (eg: you may want data in a table so you will write API to get data in that table and when your application will ask for data from this your api will provide the data for you).

Setting up ionic framework

Ionic is a framework to build hybrid mobile applications using HTML, CSS and Javascript especially AngularJS and we can use cordova for using native mobile capabilities in our app.

Setting up Ionic framework:

npm install cordova ionic -g

Creating a folder for ionic and scaffolding an app:

Move to your desired location in your computer and create a folder eg:ionic

move to that folder and

 ionic start projectnamehere sidemenu 

The sidemenu argument creates an app with sidemenu. There are several such styles for scaffolding an app.

Serving ionic app:

To serve the app

 ionic serve

Setting up json-server to serve json data for Angular app

The json-server is a simple server to serve json data for playing with Angular app in development. If you are learning AngularJS and want to play with json data you can use this json-server to serve static content for you!!

Installing json-server:

npm install json-server -g


Setting up a folder to serve:

Create a folder at any convenient place.

mkdir foldername

Move to that folder

cd foldername

Place your .json file in this folder eg: db.json To serve your content

$json-server --watch db.json

\{^_^}/ hi!

Loading db.json



Type s + enter at any time to create a snapshot of the database

Now open your favourite browser and navigate to the said links you can see your json being served!!

If you want to serve images or any other static content then you need to put those in public folder.