Giter VIP home page Giter VIP logo

maven-build-website's Introduction

Maven, Tomcat & Nexus Repo installation on EC2 instance

Pre-requisites for both Maven & Tomcat Setup

  1. T2.Micro Amazon Linux 2023 EC2 instance with Java v17
    yum install java-17 -y 
  2. Use the command below to find your jdk installation path
    find /usr/lib/jvm/java-17 | head -n 3
  3. Edit the ~/.bash_profile script and add the following ENV - JAVA_HOME=/path_to_jdk_installation
  4. Check the class video for clarity

Pre-requisites for Nexus Repo

  1. T3.Medium Amazon Linux 2023 EC2 instance with Java v1.8*
    yum install java-1.8* -y
  2. Use the command below to find your jdk installation path
    find /usr/lib/jvm/java-1.8* | head -n 3 
  3. Edit the ~/.bash_profile script and add the following ENV - JAVA_HOME=/path_to_jdk_installation
  4. Check the class video for clarity

Install Nexus Repo

  1. Download Nexus Repo Installation from https://help.sonatype.com/repomanager3/product-information/download
    # Change directory to /opt
    cd /opt
    wget https://download.sonatype.com/nexus/3/nexus-3.57.0-01-unix.tar.gz
    tar -xvzf /opt/nexus-3.57.0-01-unix.tar.gz
  2. Add the Java ENV path to ~/.bash_profile
    vi ~/.bash_profile
    JAVA_HOME=/path_to_jdk_installation
    # Add BJava to PATH in the ~/.bash_profile
    PATH=$PATH:$HOME/bin:$JAVA_HOME
  3. Nexus is accessible on Port 8081, So configure your Security Group to allow connection on port 8081 to your nexus repo
  4. Watch the Class Video for full configuration details.

Install Apache Maven

  1. Download Maven packages from https://maven.apache.org/download.cgi
    # Change directory to /opt
    cd /opt
    wget https://dlcdn.apache.org/maven/maven-3/3.9.3/binaries/apache-maven-3.9.3-bin.tar.gz
    tar -xvzf /opt/apache-maven-3.9.3-bin.tar.gz
  2. Add the maven ENV path to ~/.bash_profile
    vi ~/.bash_profile
    M2_HOME=/opt/apache-maven-3.9.3
    M2=/opt/apache-maven-3.9.3/bin
    # Add Both Maven and Java to PATH in the ~/.bash_profile
    PATH=$PATH:$HOME/bin:$JAVA_HOME:$M2_HOME:$M2

Install Apache Tomcat

  1. Download tomcat packages from https://tomcat.apache.org/download-90.cgi

    # Change directory to /opt
    cd /opt
    wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.78/bin/apache-tomcat-9.0.78.tar.gz
    tar -xvzf /opt/apache-tomcat-9.0.78.tar.gz
  2. give executing permissions to startup.sh and shutdown.sh which are under bin.

    chmod +x /opt/apache-tomcat-9.0.78/bin/startup.sh
    chmod +x /opt/apache-tomcat-9.0.78/bin/shutdown.sh
  3. create link files for tomcat startup.sh and shutdown.sh

    ln -s /opt/apache-tomcat-9.0.78/bin/startup.sh /usr/local/bin/tomcatup
    ln -s /opt/apache-tomcat-9.0.78/bin/shutdown.sh /usr/local/bin/tomcatdown

Check point :

Using unique ports for each application is best practice in a production environment. But tomcat and Jenkins runs on port 8080. Hence, lets change tomcat port number to 8090. Change port number in conf/server.xml file under tomcat directory /opt/apache-tomcat-9.0.78

cd /opt/apache-tomcat-9.0.78/conf
vi server.xml
# update port number in the "connecter port" field in server.xml
# start the tomcat after configuration update
tomcatup

Check point :

access tomcat application from browser on port 8090

  • http://<Public_IP>:8090 make sure to open port 8090 in your security group/firewall
  1. Now Tomcat is accessible on port 8090. But tomcat application doesn't allow to login from browser. changing a default parameter in context.xml does address this issue
    #search for context.xml
    cd /
    find / -name context.xml
  2. The above command gives 4 webapp/..context.xml files. Comment out the valve section using () for the 4 files. Check class video for more info After that restart tomcat services to effect these changes
    tomcatdown
    tomcatup
  3. Update users information in the tomcat-users.xml file goto /opt/apache-tomcat-9.0.78/conf/tomcat-user.xml and add below users to the file
     <role rolename="manager-gui"/>
     <role rolename="manager-script"/>
     <role rolename="manager-jmx"/>
     <role rolename="manager-status"/>
     <user username="admin" password="admin" roles="manager-gui, manager-script, manager-jmx, manager-status"/>
     <user username="deployer" password="deployer" roles="manager-script"/>
     <user username="tomcat" password="s3cret" roles="manager-gui, admin-gui"/>
  4. Restart serivce and try to login to tomcat application from the browser by clicking on the Manager app. This time it should be Successful

maven-build-website's People

Contributors

seunayolu avatar chriscloudaz avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.