hbase 安装期间 sudo apt-get 崩溃

hbase 安装期间 sudo apt-get 崩溃

我在安装 hbase 时遇到了问题,最后遇到了一个有问题的“sudo apt-get”。它告诉我 JAVA_HOME 未设置,但实际上已经设置了。

jalal@mona:~$ sudo apt-get -f install 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
hadoop-hbase
The following NEW packages will be installed:
hadoop-hbase
0 upgraded, 1 newly installed, 0 to remove and 18 not upgraded.
4 not fully installed or removed.
Need to get 0 B/30.6 MB of archives.
After this operation, 34.7 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Selecting previously unselected package hadoop-hbase.
(Reading database ... 264105 files and directories currently installed.)
Unpacking hadoop-hbase (from .../hadoop-hbase_0.90.6+84.89-1~maverick-    cdh3_all.deb) ...
Processing triggers for man-db ...
Setting up hadoop-hbase (0.90.6+84.89-1~maverick-cdh3) ...
Setting up hadoop-hbase-master (0.90.6+84.89-1~maverick-cdh3) ...
+======================================================================+
|      Error: JAVA_HOME is not set and Java could not be found         |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site        |
|       > http://java.sun.com/javase/downloads/ <                      |
|                                                                      |
| HBase requires Java 1.6 or later.                                    |
| NOTE: This script will find Sun Java whether you install using the   |
|       binary or the RPM based installer.                             |
+======================================================================+
invoke-rc.d: initscript hadoop-hbase-master, action "start" failed.
dpkg: error processing hadoop-hbase-master (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up hadoop-hbase-regionserver (0.90.6+84.89-1~maverick-cdh3) ...
+======================================================================+
|      Error: JAVA_HOME is not set and Java could not be found         |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site        |
|       > http://java.sun.com/javase/downloads/ <                      |
|                                                                      |
| HBase requires Java 1.6 or later.                                    |
| NOTE: This script will find Sun Java whether you install using the   |
|       binary or the RPM based installer.                             |
+======================================================================+
invoke-rc.d: initscript hadoop-hbase-regionserver, action "start" failed.
dpkg: error processing hadoop-hbase-regionserver (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up hadoop-hbase-rest (0.90.6+84.89-1~maverick-cdh3) ...
+======================================================================+
|      Error: JAVA_HOME is not set and Java could not be found         |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site        |
|       > http://java.sun.com/javase/downloads/ <                      |
|                                                                      |
| HBase requires Java 1.6 or later.                                    |
| NOTE: This script will find Sun Java whether you install using the   |
|       binary or the RPM based installer.                             |
+======================================================================+
invoke-rc.d: initscript hadoop-hbase-rest, action "start" failed.
dpkg: error processing hadoop-hbase-rest (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up hadoop-hbase-thrift (0.90.6+84.89-1~maverick-cdh3) ...
+======================================================================+
|      Error: JAVA_HOME is not set and Java could not be found         |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site        |
|       > http://java.sun.com/javase/downloads/ <                      |
|                                                                      |
| HBase requires Java 1.6 or later.                                    |
| NOTE: This script will find Sun Java whether you install using the   |
|       binary or the RPM based installer.                             |
+======================================================================+
invoke-rc.d: initscript hadoop-hbase-thrift, action "start" failed.
dpkg: error processing hadoop-hbase-thrift (--configure):
subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
hadoop-hbase-master
hadoop-hbase-regionserver
hadoop-hbase-rest
hadoop-hbase-thrift
E: Sub-process /usr/bin/dpkg returned an error code (1)

根据

echo $(readlink -f /usr/bin/java | sed "s:bin/java::")

我的 JAVA_HOME 是

/usr/lib/jvm/java-6-openjdk-amd64/jre/

以下是它的回应:

jalal@mona:~$ echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk-amd64/jre/

sudo apt-get install请让我知道我首先该如何修复我的问题,然后如何使用安装 hbase sudo apt-get install

通过添加 /usr/lib/jvm/java-6-openjdk-amd64/jre \ 使用sudo nano /usr/lib/hbase/bin/hbase-config.sh

for candidate in \  
   /usr/lib/jvm/java-6-sun \  
   /usr/lib/jvm/java-1.6.0-sun-1.6.0.*/jre \  
   /usr/lib/jvm/java-1.6.0-sun-1.6.0.* \  
   /usr/lib/j2sdk1.6-sun \  
   /usr/java/jdk1.6* \  
   /usr/java/jre1.6* \  
   /Library/Java/Home ; do  
if [ -e $candidate/bin/java ]; then  
    export JAVA_HOME=$candidate  
    break  
 fi  
done  

我不再接收JAVA_HOME not found错误。

但是现在我遇到了这个错误sudo apt-get install -f

pam_mount(spawn.c:128): error setting uid to 0  

有什么办法可以解决我的问题sudo apt-get install吗?

答案1

当您使用sudo命令时,它的行为与您执行的操作相同su。不同之处在于sudo它只执行一个给定的命令,然后立即退出。但更改用户的所有后果都存在。这意味着,如果您没有为root用户设置环境变量,它们将为空。您可以运行以下命令检查:

user@host:~$ su
Password:
root@host:/home/user$ echo $JAVA_HOME

root@host:/home/user$

root您可以像设置 一样设置 的变量。但更方便的方式是在文件user中设置它们/etc/environment

$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/usr/lib/jvm/default-java"
_JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true"

相关内容