Help us understand the problem. What is going on with this article?

GCE上のCentOSインスタンスにOracleのjdkをインストールするまで。

More than 3 years have passed since last update.

GoogleComputeEngineに作成したCentOSのインスタンスにOracleのjdkをインストールするのに一苦労したのでそのメモ。

実行環境

  • GoogleComputeEngineに作成したインスタンス
    • イメージはcentos-6-v20141205
  • jdkの最新版はjdk1.8.0_25(2014/12/18現在)

rpmファイルをダウンロードする

rpmのダウンロードURLはweb上のAcceptにチェック入れないとwgetできないので、このページを参考に以下のオプションつけて実行

wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-i586.rpm

rpm install -> 失敗

そのままrpm installしようとしても失敗…

$ sudo rpm -ivh jdk-8u25-linux-i586.rpm 
Preparing...                ########################################### [100%]
   1:jdk1.8.0_25            ########################################### [100%]
Unpacking JAR files...
        rt.jar...
/var/tmp/rpm-tmp.dagDzw: /usr/java/jdk1.8.0_25/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: No such file
 or directory
Error: unpack could not create JAR file:
        /usr/java/jdk1.8.0_25/jre/lib/rt.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
        jsse.jar...
/var/tmp/rpm-tmp.dagDzw: /usr/java/jdk1.8.0_25/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: No such file
 or directory
Error: unpack could not create JAR file:
        /usr/java/jdk1.8.0_25/jre/lib/jsse.jar
(以下略)

必要パッケージのインストールからのjdk再インストール

ここを参考にld-linux.so.2をインストール

sudo yum install ld-linux.so.2

アンインストールしてもう一回実行、が失敗…w

$ sudo rpm -e jdk1.8.0_25
$ sudo rpm -ivh jdk-8u25-linux-i586.rpm 
Preparing...                ########################################### [100%]
   1:jdk1.8.0_25            ########################################### [100%]
Unpacking JAR files...
        rt.jar...
/usr/java/jdk1.8.0_25/bin/unpack200: error while loading shared libraries: libgcc_s.so.1: cannot open shared object
 file: No such file or directory
Error: unpack could not create JAR file:
        /usr/java/jdk1.8.0_25/jre/lib/rt.jar
(以下略)

libgcc_s.so.1も必要なのか?、ってことでインストールしてjdk再インストール

sudo yum install libgcc_s.so.1
$ sudo rpm -e jdk1.8.0_25
$ sudo rpm -ivh jdk-8u25-linux-i586.rpm 
Preparing...                ########################################### [100%]
   1:jdk1.8.0_25            ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        jfxrt.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode, sharing)

やっとインストール完了しました。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away