Skip to content

Instantly share code, notes, and snippets.

@hatappo
Last active August 29, 2015 13:56
Show Gist options
  • Save hatappo/9084652 to your computer and use it in GitHub Desktop.
Save hatappo/9084652 to your computer and use it in GitHub Desktop.
install Oracle JDK 7u51, Jetty on EC2
# @root
# ================================================ Oracle JDK 7u51
cd /usr/local/src
wget --no-cookies --header "Cookie: gpw_e24=xxx" http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.rpm -O jdk-7u51-linux-x64.rpm
rpm -ivh jdk-7u51-linux-x64.rpm
alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000
update-alternatives --config java
ln -s /usr/java/default/jre /usr/lib/jvm/jre
ln -s /usr/share/java /usr/lib/jvm-exports/jre
# ================================================ jetty 9.1.2.v20140210
JETTY_VERSION=9.1.2.v20140210
wget http://download.eclipse.org/jetty/$JETTY_VERSION/dist/jetty-distribution-$JETTY_VERSION.tar.gz
mkdir -p /usr/local/jetty
tar xfvz ./jetty-distribution-$JETTY_VERSION.tar.gz -C /usr/local/
cd /usr/local
ln -s ./jetty-distribution-$JETTY_VERSION jetty
groupadd jetty
useradd jetty -g jetty -s /bin/false
chown -R jetty.jetty /usr/local/jetty/ # trailing "/" is required.
# check to invoke
cd /usr/local/jetty
java -jar ./start.jar
cp ./bin/jetty.sh /etc/init.d/jetty
chmod +x /etc/init.d/jetty
vi /etc/init.d/jetty
# 以下を追記。port8080のままでいいなら、Homeのみ。
---
##################################################
# Jetty Args
##################################################
JETTY_ARGS=jetty.port=80
##################################################
# Jetty Home
##################################################
JETTY_HOME="/usr/local/jetty/"
---
# check to invoke with init script
/etc/init.d/jetty start
/etc/init.d/jetty status
ps aux | grep jetty
curl localhost # may return somethig like "Error 404 - Not Found"
# add service
chkconfig --list jetty
chkconfig --add /etc/init.d/jetty
chkconfig jetty on
chkconfig --list jetty
# deploy example
mkdir -p /usr/local/webapps/root
chown jetty.jetty /usr/local/webapps/root
unzip xxxx.war -C /usr/local/jetty/webapps/root/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment