Guide to Install Docker and Jenkins On AWS EC2 instance

Guide to Install Docker and Jenkins On AWS EC2 instance

Installing Docker:

Step 1: Update your packages.

sudo apt-get update

Step 2: Install Docker.

sudo apt-get install docker.io

Check if it is installed successfully.

docker --version

Installing Jenkins:

Java is necessary for installing Jenkins.

Step 1: Install Java jdk 11

sudo apt-get install openjdk-11-jre

Check if installed successfully.

java --version

Step 2: Use the following commands in sequence to get the installation package from the Jenkins repository.

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io.key | sudo tee \   /usr/share/keyrings/jenkins-keyring.asc > /dev/null

echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \   https://pkg.jenkins.io/debian binary/ | sudo tee \   /etc/apt/sources.list.d/jenkins.list > /dev/null

Step 3: Update your packages.

sudo apt-get update

Step 4: Install Jenkins.

sudo apt-get install jenkins

Step 5: Enable Jenkins to automatically start on system startup.

sudo systemctl enable jenkins

Step 6: Start Jenkins service.

sudo systemctl start jenkins

Step 7: Check if Jenkins is running.

sudo systemctl status jenkins

Step 8: Open port 8080 in AWS console(EC2/Security Groups/Inbound rules). 8080 is the default port for Jenkins.

Step 9: Open a new tab in a browser and open http://(your instance ip address):8080 and press Enter. Getting started Jenkins screen should appear after this.

Step 10: Use cat command to copy password from /var/lib/jenkins/secrets/initialAdminPassword .After this Sign up and open a account.

Thanks for your time. If you have any feedback feel free to leave a comment below. If you would like to connect with me, do checkout my LinkedIn and Twitter.

- Nishant Sharma