HBase权威指南环境配置

系统采用ubuntu-14.04,64bit

1、安装git

sudo apt-get install git

出现下面错误:
Err http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main git-man all 1:1.9.1-1ubuntu0.1
404 Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com/ubuntu/ trusty-security/main git-man all 1:1.9.1-1ubuntu0.1
404 Not Found [IP: 91.189.91.14 80]
Err http://security.ubuntu.com/ubuntu/ trusty-security/main git i386 1:1.9.1-1ubuntu0.1
404 Not Found [IP: 91.189.91.14 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/git/git-man_1.9.1-1ubuntu0.1_all.deb 404 Not Found [IP: 91.189.91.14 80]

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/git/git_1.9.1-1ubuntu0.1_i386.deb 404 Not Found [IP: 91.189.91.14 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

参考:

Installing Latest version of git in ubuntu(http://*.com/questions/19109542/installing-latest- version-of-git-in-ubuntu)中给出的PPA源。

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

wu@ubuntu:~/opt/tmp$ git --version
git version 2.7.3

2、安装maven

wu@ubuntu:~/opt$ tar -xzvf apache-maven-3.0.4-bin.tar.gz

设置环境变量

wu@ubuntu:~/opt$ sudo gedit /etc/profile

在文件末尾追加:

# set maven environment
export M2_HOME=/home/wu/opt/apache-maven-3.0.4
export PATH=M2HOME/bin:

PATH

是环境变量生效:
wu@ubuntu:~/opt$ source /etc/profile

验证证maven是否安装成功:

wu@ubuntu:~/opt$ mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 00:44:56-0800)
Maven home: /home/wu/opt/apache-maven-3.0.4
Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
Java home: /home/wu/jdk1.6.0_24/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-32-generic", arch: "i386", family: "unix"

3、按照下面顺序开始编译项目:

wu@ubuntu:/tmp$ git clone git://github.com/larsgeorge/hbase-book.git

Cloning into 'hbase-book'...
remote: Counting objects: 3148, done.
remote: Total 3148 (delta 0), reused 0 (delta 0), pack-reused 3148
Receiving objects: 100% (3148/3148), 1.60 MiB | 66.00 KiB/s, done.
Resolving deltas: 100% (1412/1412), done.
Checking connectivity... done.

wu@ubuntu:/tmpcdhbase−book/wu@ubuntu:/tmp/hbase−book

mvn package -DskipTests=true

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] HBase Book
[INFO] HBase Book Common Code
[INFO] HBase Book Chapter 3
[INFO] HBase Book Chapter 4
[INFO] HBase Book Chapter 5
[INFO] HBase Book Chapter 6
[INFO] HBase Book Chapter 7
[INFO] HBase Book Chapter 8
[INFO] HBase Book Chapter 9
[INFO] HBase Book Chapter 11
[INFO] HBase URL Shortener
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building HBase Book 2.0
[INFO] ------------------------------------------------------------------------
……

[INFO] Reactor Summary:
[INFO]
[INFO] HBase Book ........................................ SUCCESS [0.002s]
[INFO] HBase Book Common Code ............................ SUCCESS [4.846s]
[INFO] HBase Book Chapter 3 .............................. SUCCESS [1.592s]
[INFO] HBase Book Chapter 4 .............................. SUCCESS [2.331s]
[INFO] HBase Book Chapter 5 .............................. SUCCESS [1.119s]
[INFO] HBase Book Chapter 6 .............................. SUCCESS [8.721s]
[INFO] HBase Book Chapter 7 .............................. SUCCESS [1.620s]
[INFO] HBase Book Chapter 8 .............................. SUCCESS [1.172s]
[INFO] HBase Book Chapter 9 .............................. SUCCESS [0.528s]
[INFO] HBase Book Chapter 11 ............................. SUCCESS [0.575s]
[INFO] HBase URL Shortener ............................... SUCCESS [19.475s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 42.526s
[INFO] Finished at: Wed Mar 16 20:15:39 PDT 2016
[INFO] Final Memory: 37M/168M
[INFO] ------------------------------------------------------------------------

如果你在虚拟机中运行,中途出错,可能是jdk的版本问题,可以将jdk1.6换为jdk1.7

或者是网络问题,多运行几次就OK

wu@ubuntu:~/opt/tmp/hbase-book$ ls -l ch04/target/
total 188
drwxrwxr-x 5 wu wu 4096 Mar 16 20:15 classes
drwxrwxr-x 3 wu wu 4096 Mar 16 20:15 generated-sources
-rw-rw-r-- 1 wu wu 168340 Mar 16 20:15 hbase-book-ch04-2.0.jar
drwxrwxr-x 2 wu wu 4096 Mar 16 20:15 maven-archiver
drwxrwxr-x 3 wu wu 4096 Mar 16 20:15 maven-status
drwxrwxr-x 2 wu wu 4096 Mar 16 20:15 surefire

上一篇:0❤️Jenkins从零到壹❤️ :安装-windows 使用jenkins.msi安装(JAVA 小虚竹)


下一篇:《JavaScript高效图形编程(修订版)》——第6章 HTML5画布 6.1 画布的支持