Friday, January 16, 2015

Ubuntu Server 14.04 - Install HBase 0.98.9

Following these steps to install HBase

A. Prerequisites:
- Installed Hadoop 2.x (if not, see this link: Install single node Hadoop 2.4.0)
- Installed JDK 1.7.x (if not see this link: Install JDK 1.7.x)

B. Steps:
1. Download HBase (version HBase v0.98.9)
1
root@ubuntu:~# wget http://mirrors.viethosting.vn/apache/hbase/hbase-0.98.9/hbase-0.98.9-hadoop2-bin.tar.gz

2. Unzip this downloaded package
1
root@ubuntu:~# tar zxvf hbase-0.98.9-hadoop2-bin.tar.gz

3. Rename and move to this folder
1
2
root@ubuntu:~# mv /root/hbase-0.98.9-hadoop2 /root/hbase
root@ubuntu:~# mv /root/hbase /usr/local/

4. Change owner for hduser account
1
root@ubuntu:~# chown -R hduser:hadoop /usr/local/hbase 

5. Config hbase-site.xml file
1
hduser@ubuntu:~$ vi /usr/local/hbase/conf/hbase-site.xml
Add these configuration and then save
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
<configuration>
   <property>
      <name>hbase.rootdir</name>
      <value>file:///usr/local/hbase/hbase-data</value>
   </property>
   <property>
      <name>hbase.zookeeper.property.dataDir</name>
      <value>/usr/local/hbase/zookeeper</value>
   </property>
   <property>
      <name>dfs.replication</name>
      <value>1</value>
   </property>
   <property>
      <name>hbase.zookeeper.property.clientPort</name>
      <value>2222</value>
   </property>
   <property>
      <name>hbase.zookeeper.quorum</name>
      <value>localhost</value>
   </property>
</configuration>

6. Uncomment this configuration in hbase-env-sh to allow HBase manage it's own instance of Zookeeper
1
hduser@ubuntu:~$ vi /usr/local/hbase/conf/hbase-env.sh
1
export HBASE_MANAGES_ZK=true

7. Update ~/.profile
1
hduser@ubuntu:~$ vi ~/.profile
1
2
3
4
# Add to the end of the file
export HBASE_HOME=/usr/local/hbase
export JAVA_HOME=/usr/local/java/jkd1.7.0_71
export PATH="$JAVA_HOME/bin:$HBASE_HOME/bin:/usr/local/bin:/usr/local/sbin:$PATH"
Update enviroment
1
hduser@ubuntu:~$ source ~/.profile

8. Start HBase
1
2
hduser@ubuntu:~$ start-hbase.sh
starting master, logging to /usr/local/hbase/logs/hbase-hduser-master-ubuntu.out
Importance: We must start Hadoop first

9. Check if it's running
1
2
3
4
hduser@ubuntu:~$ ps -ef|grep hbase
hduser     4766      1  0 10:33 pts/0    00:00:00 bash /usr/local/hbase/bin/hbase-daemon.sh --config /usr/local/hbase/conf internal_start master
hduser     4780   4766 10 10:33 pts/0    00:00:11 /usr/local/java/jdk1.7.0_71/bin/java -Dproc_master -XX:OnOutOfMemoryError=kill -9 %p -Xmx1000m -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/usr/local/hbase/logs -Dhbase.log.file=hbase-hduser-master-ubuntu.log -Dhbase.home.dir=/usr/local/hbase -Dhbase.id.str=hduser -Dhbase.root.logger=INFO,RFA -Djava.library.path=/usr/local/hadoop/lib/native -Dhbase.security.logger=INFO,RFAS org.apache.hadoop.hbase.master.HMaster start
hduser     5025   4297  0 10:34 pts/0    00:00:00 grep --color=auto hbase

10. Now, we can go to HBase shell to work
1
2
3
4
5
6
7
hduser@ubuntu:~$ hbase shell
2015-01-16 10:36:07,958 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.98.9-hadoop2, r96878ece501b0643e879254645d7f3a40eaf101f, Mon Dec 15 23:00:20 PST 2014

hbase(main):001:0>
Or we can use HBase web-based at: http://localhost:60010

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

Tuesday, July 15, 2014

Ubuntu Server 14.04 - MySQL 5.5 installation and configuration

A. Installation:
1. Install MySQL
1
root@ubuntu:~# apt-get install mysql-server
 By default MySQL 5.5 will be installed.


2. Install MySQL Connector JAR file
1
root@ubuntu:~# apt-get install mysql-connector-java*

B. Configuration:
1. Set password for root user:
1
root@ubuntu:~# mysqladmin -u root -p'<your_password_here>' password $mysqlpassword

2. Remove unneccessary information from log and STDOUT
1
root@ubuntu:~# mysqladmin -u root 2>&1 >/dev/null

3.Start / Stop / Restart MySQL
1
2
3
root@ubuntu:~# service mysql start
root@ubuntu:~# service mysql stop
root@ubuntu:~# service mysql restart