This tutorial walks you through the process of deploying a Jenkins application.
- You will launch an EC2 instance (centOS), install and configure Jenkins.
- Jenkins to automatically spin up Jenkins build slave instances if build abilities need to be augmented on the instance.
First, launch an ec2 instance to install and run jenkins. Steps involved are:
- launch an ec2 instance
- Add secutiry group
- ssh into the instance: select initiated instance, proceed to connect and follow the instructions. Make sure you are in the same folder as your downloaded .pem key.
chmod 400 jenkins-ec2.pem //if you named the instance same ssh -i "jenkins-ec2.pem" email@example.com //please check your details
Here, we will connect to the instance and run the jenkins after all necessary installation.
- connect to your instance
- download and install jenkins
- configure jenkins
After connecting to your ec2 instance via ssh, jenkins need to be download and installed.
sudo yum update -y //update system sudo yum install java-1.8.0-openjdk-devel //install jdk curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo //get GPG key sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key //add repo to system sudo yum install jenkins //install jenkins // start the service sudo systemctl start jenkins //check service status systemctl status jenkins.service
On checking jenkins service status, an output like this is expected.
Voila! Jenkins is installed and running at port 8080 on your instance.
But remember, there is no access to port 8080 to outside world. Security groups are used for the purpose of protecting our running instances from outside attack. Let's go to attached security group and edit inbound rules.
Open a browser window and access your jenkins instance running on your_ec2_public_ip:8080
access your initial administator password for jenkins using (ec2 terminal).
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- Select install selected plugins and wait for it. Its almost done. Create a user if needed other than admin. Jenkins ready screen will appear. We are all set to automate our CI process.
Go to manage jenkins and toggle to install plugins.
Jenkins is up and running on AWS.
"Please note for security reasons, never expose your public IP. Always have it running behind a reverse proxy."
In next article, we will create a Jenkins project and integrate it with github. That will be the first step to create a Continuous Integration pipeline.
P.S. "Above written are my views. I am always learning and exploring new things. Please comment and criticize wherever possible. Stay Happy."