Thursday, December 11, 2014

Ubuntu 14.04 - Install MongoDB

In this tutorial, you will be introduce how to install MongoDB on Ubuntu Server 14.04

Step 1: make sure your server is up-to-date
1
2
apt-get update
apt-get dist-upgrade

Step 2: install MongoDB
1
apt-get install -y mongodb

After installing, MongoDB service automatically starts. You can check by typing:
1
ps aux | grep mongodb

And the screen will display:
1
mongodb    2163  0.8  1.1 382048 46256 ?        Ssl  15:36   0:03 /usr/bin/mongod --config /etc/mongodb.conf

More

1. Start MongoDB

Issue the following command to start mongodb:
1
sudo service mongodb start

2. Stop MongoDB

Issue the following command to stop mongodb:
1
sudo service mongodb stop

3. Restart MongoDB

Issue the following command to restart mongodb:
1
sudo service mongodb restart


Wednesday, December 10, 2014

Ubuntu Server 14.04 - Install Nodejs

In this tutorial, you will be introduced how to install Nodejs by using Distro-Stable Version or a PPA (personal package archive).

How To Install the Distro-Stable Version
First, you should refresh your local package index prior and then install from the repositories:
1
2
sudo apt-get update
sudo apt-get install nodejs

Then, you should install npm (Node Package Manager) because by default Ubuntu Server 14.04 does not include npm package in nodejs package
1
sudo apt-get install npm

How To Install Using a PPA from NodeSource
The versions of Node.js on NodeSource are more up-to-date than the official Ubuntu repositories.

First, install the PPA in order to get access to its contents:
1
curl -sL https://deb.nodesource.com/setup | sudo bash -

Then, install Node.js package:
1
sudo apt-get install nodejs

Note that when you install from NodeSource, the Node.js package also contains npm package, so you do not need to install npm. But to make sure all npm packages can run right, you should need to install build-essential packge:
1
sudo apt-get install build-essential

To verify Node.js installed successfully, you type nodejs and see the command line >

Tuesday, December 9, 2014

Ubuntu Server 14.04 - Enable SSH root access

Be default, Ubuntu does not allow to access ssh through root user. To do this, following steps:

Step 1: set password for root user. See details at Change root user password

Step 2: edit file "/etc/ssh/sshd_config"
1
vi /etc/ssh/sshd_config

Step 3: comment and add new line like this
1
2
#PermitRootLogin without-password
PermitRootLogin yes

Step 4: restart SSH
1
service ssh restart

Ubuntu Server 14.04 - Config static IP address

Ubuntu 14.04 no longer allows you to edit "/etc/resolv.conf directly". Instead, you have to modify "/etc/resolvconf/resolv.conf.d/" head or tail. But it will be easiest to set this along side your ethernet config, in my opinion.

You need to edit the file "/etc/network/interfaces":

1
sudo  vi /etc/network/interfaces

Then change to include the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
#iface lo inet interface
iface eth0 inet static
address 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255
dns-nameservers 8.8.8.8 8.8.4.4

Finally, restart your ethernet
1
ifdown eth0 && ifup eth0

Ubuntu Server 14.04 - Change password

To do it command line:

To change the root password:
1 sudo passwd

To change your user password:
1 passwd

To change other users password:
1 sudo passwd USERNAME