Some notes:
1. If multiple java version are installed and default version isn't 1.7, use following command to manually switch to 1.7.
$ sudo update-alternatives --config java
2. When running start-dfs.sh, lots of exception like: Could not resolve hostname *: Name or service not known.
After add following to /usr/local/hadoop/etc/hadoop/hadoop-env.sh, problem solved. Solution is found from here.
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
3. DataNode is not started.
I encountered this because I formatted namenode twice before I started the service. After I delete the current folder under the namenode and datanode, and again format the namenode, all services are started successfully.