Skip to content

Instantly share code, notes, and snippets.

@arahansa
Created August 21, 2016 07:44
Show Gist options
  • Save arahansa/015857aaffe82ae830f87a57eff4adac to your computer and use it in GitHub Desktop.
Save arahansa/015857aaffe82ae830f87a57eff4adac to your computer and use it in GitHub Desktop.
ec2에 자바+톰캣 설치
# 아마존 자바8 설치. 아마존 리눅스
# http://blog.de-gouveia.eu/2014/05/21/java-8-jdk-linux-installation-in-ec2-linux-instance/
# http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/
# tomcat8http://tecadmin.net/install-tomcat-8-on-centos-rhel-and-ubuntu/
# http://tecadmin.net/install-tomcat-8-on-centos-rhel-and-ubuntu/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz"
tar xzf jdk-8u91-linux-x64.tar.gz
sudo alternatives --install /usr/bin/java java /home/ec2-user/jdk1.8.0_91/bin/java 2
sudo alternatives --config java
sudo alternatives --install /usr/bin/jar jar /home/ec2-user/jdk1.8.0_91/bin/jar 2
sudo alternatives --install /usr/bin/javac javac /home/ec2-user/jdk1.8.0_91/bin/javac 2
sudo alternatives --set jar /home/ec2-user/jdk1.8.0_91/bin/jar
sudo alternatives --set javac /home/ec2-user/jdk1.8.0_91/bin/javac
export JAVA_HOME=/home/ec2-user/jdk1.8.0_91
export JRE_HOME=/home/ec2-user/jdk1.8.0_91/jre
export PATH=$PATH:/home/ec2-user/jdk1.8.0_91/bin:/home/ec2-user/jdk1.8.0_91/jre/bin
#톰캣
wget http://www.us.apache.org/dist/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz
tar xzf apache-tomcat-8.0.36.tar.gz
echo "export CATALINA_HOME="/home/ec2-user/apache-tomcat-8.0.36"" >> ~/.bashrc
source ~/.bashrc
# tomcat-users.xml
# <role rolename="manager-script"/>
# <role rolename="manager-gui"/>
# <role rolename="manager-jmx"/>
# <role rolename="manager-status"/>
# <user username="admin" password="비번" roles="manager-gui,manager-status"/>
iptables -t nat -A OUTPUT -d 아이피 -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A OUTPUT -d 아이피 -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -d 아이피 -p tcp --dport 80 -j REDIRECT --to-ports 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment