LoginSignup
2
2

More than 5 years have passed since last update.

UbuntuサーバへのOracle JDK導入

Last updated at Posted at 2014-04-15

初めに

AWS公式AMIで起動したUbuntuサーバに、OS標準のOpenJDKではなく、Oracle JDKを導入する場合のメモ。

インスタンス起動

  • OS:Ubuntu 12.04.04 LTS
  • AMI:ubuntu-precise-12.04-amd64-server-20140408 (ami-87c7b986)

OS設定

パッチ適用

sudo apt-get update
sudo apt-get upgrade

NTP設定

時刻同期先はインターネットマルチフィード (MFEED)。

sudo apt-get install ntp -y

sudo cp /etc/ntp.conf /etc/ntp.conf.0

cat /etc/ntp.conf.0 \
  | sed 's/server 0.ubuntu.pool.ntp.org/server ntp1.jst.mfeed.ad.jp/g' \
  | sed 's/server 1.ubuntu.pool.ntp.org/server ntp2.jst.mfeed.ad.jp/g' \
  | sed 's/server 2.ubuntu.pool.ntp.org/server ntp3.jst.mfeed.ad.jp/g' \
  | sed 's/server 3.ubuntu.pool.ntp.org/# server 3.ubuntu.pool.ntp.org/g' \
  | sed 's/server ntp.ubuntu.com/# server ntp.ubuntu.com/g' \
  | sudo tee /etc/ntp.conf.new

diff  /etc/ntp.conf.0  /etc/ntp.conf.new
sudo cp -f /etc/ntp.conf.new /etc/ntp.conf
sudo rm -f /etc/ntp.conf.new
sudo /etc/init.d/ntp restart

稼働状態確認

ntpq -p

IPv6無効化

副作用回避の為、v6アドレスは無効化する。

sudo cp /etc/sysctl.conf /etc/sysctl.conf.0
sudo cp /etc/sysctl.conf.0 /etc/sysctl.conf.new

echo '#
#IPv6 disable
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
' | sudo tee -a /etc/sysctl.conf.new

diff /etc/sysctl.conf /etc/sysctl.conf.new
sudo mv /etc/sysctl.conf.new /etc/sysctl.conf

OS再起動

sudo shutdown -r now

JDK導入

WebUpd8のレポジトリを利用

“WebUpd8” team
https://launchpad.net/~webupd8team/+archive/java

sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update

JDKインストール、デフォルト設定反映

sudo apt-get install oracle-java7-installer -y
sudo apt-get install oracle-java7-set-default

自動更新対象からOracle JDKを除外

echo oracle-java7-installer hold | sudo dpkg --set-selections
echo oracle-java7-set-default hold | sudo dpkg --set-selections

JAVA_HOME

JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2