Small DevOps Project in AWS instance, install Java, Maven, and Jenkins configuration

 Step 1: Launch an AWS EC2 Instance with Ubuntu



  • Log in to the AWS Console.
  • Navigate to the EC2 dashboard.
  • Launch a new instance, choosing an Ubuntu AMI.
  • Configure the instance type, storage, and security groups.
  • Review and launch the instance, creating a new key pair or using an existing one to access the instance securely.


Step 2: Connect to Your AWS Instance Use SSH to connect to your AWS instance using the private key:

ssh -i "your-key.pem" ubuntu@your-instance-ip

Step 3: Install Java on Ubuntu

  1. Update the package manager:
sudo apt update
  1. Install Java (OpenJDK 11):
sudo apt install openjdk-11-jdk -y
  1. Verify the Java installation:
java -version

Step 4: Install Maven on Ubuntu The process for installing Maven on Ubuntu remains mostly the same as in the previous guide:

  1. Download the Apache Maven binary package:
wget https://apache.mirror.digitalpacific.com.au/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz
  1. Extract the downloaded package:
tar -zxvf apache-maven-3.8.4-bin.tar.gz
  1. Move Maven to a system directory:
sudo mv apache-maven-3.8.4 /usr/local/
  1. Add Maven to the system path:
echo 'export M2_HOME=/usr/local/apache-maven-3.8.4' | sudo tee -a /etc/profile.d/maven.sh
echo 'export M2=$M2_HOME/bin' | sudo tee -a /etc/profile.d/maven.sh
echo 'export PATH=$M2:$PATH' | sudo tee -a /etc/profile.d/maven.sh
  1. Activate the changes:
sudo chmod +x /etc/profile.d/maven.sh
source /etc/profile.d/maven.sh
  1. Verify the Maven installation:
mvn -version

Step 5: Install Jenkins on Ubuntu The process for installing Jenkins on Ubuntu is slightly different:

  1. Add the Jenkins repository and import its GPG key:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
  1. Update the package manager:
sudo apt update
  1. Install Jenkins:
sudo apt install jenkins -y
  1. Start and enable the Jenkins service:
sudo systemctl start jenkins
sudo systemctl enable jenkins
  1. Open your AWS security group to allow traffic on port 8080 (Jenkins UI).

Step 6: Configure Jenkins The configuration of Jenkins remains the same as in the previous guide. Follow steps 5 and 6 from the original instructions to configure Jenkins.

Comments