Created
December 27, 2019 02:33
-
-
Save circa10a/bfc8b404cdc37e53a1f57bab9261a05e to your computer and use it in GitHub Desktop.
ec2 image build step to install tomcat 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Tomcat 9" | |
description: "Install tomcat 9 from tar via apache US mirror" | |
schemaVersion: 1.0 | |
phases: | |
- name: build | |
steps: | |
- name: install | |
action: ExecuteBash | |
inputs: | |
commands: | |
- | | |
TOMCAT_VERSION="9.0.30" | |
JAVA_VERSION="1.8.0" | |
INSTALL_DIR="/tomcat" | |
USER="tomcat" | |
USERID="1001" | |
GROUPID="1001" | |
# Update sources & packages | |
sudo yum update -y && \ | |
sudo yum upgrade -y | |
# Install JRE | |
sudo yum install -y "java-${JAVA_VERSION}-openjdk-headless.x86_64" | |
# Add non-root user | |
sudo groupadd --gid "$GROUPID" "$USER" && \ | |
sudo adduser \ | |
--comment "" \ | |
--home "$INSTALL_DIR" \ | |
--gid "$GROUPID" \ | |
--no-create-home \ | |
--uid "$USERID" \ | |
"$USER" | |
# Download tomcat | |
sudo wget -qO- "https://www-us.apache.org/dist/tomcat/tomcat-9/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz" | sudo tar xvz -C / | |
# Change Permissions | |
sudo chown -R "$USERID":"$GROUPID" "/apache-tomcat-${TOMCAT_VERSION}" | |
sudo ln -sf "/apache-tomcat-${TOMCAT_VERSION}" "$INSTALL_DIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment