Hey,
It’s Sarvar Nadaf again, a senior developer at Luxoft. I worked on several technologies like Cloud Ops (Azure and AWS), Data Ops, Serverless Analytics, and Dev Ops for various clients across the globe.
In this article, we will examine the step-by-step instructions for installing Jenkins on Ubuntu 18.0.2. Today, I’m writing about installing Jenkins on AWS Ubuntu 18.0.2 and will see how to install Maven and git on Ubuntu 18.0.2. Let’s get started right now.
Prerequisites
- You Should have an AWS account.
- Create Amazon EC2 key pair.
- Create a Security Group or Usage default one.
Lunch Instance
Choose the AWS EC2 Instance Service and start with the Lunch Instance Option.
Select the Ubuntu AIM, as shown in the screenshot above, and the default settings will work. Just two things need to be added: first, choose an existing security group if you’ve already created one; otherwise, you can continue with the default selections; and second, choose a security key in a PEM file.
Once the EC2 instance has been fully installed. Explore our access to the EC2 instance.
Ways to Connect EC2 Instance
Here, I’ll go over the simplest methods for connecting an EC2 instance. let’s see…….
1. Connect through Web Console (Simplest way)
This option has not been supported by AWS until now. but in the coming days, we will be able to access the Ubuntu instance through this option.
2. Connect through CLI (Need PEM file Handy)
This is the second technique and is frequently used in actual production environments. You have any SSH client software from a third party, such as mobaxterm, putty, or a Linux terminal. For you to access the EC2 instance, you needed a PEM file. The steps are displayed below. Simply follow those instructions to access EC2 instances.
Installing Jenkins on Ubuntu 18.0.2
We are precisely where our discussion began here. The installation of Jenkins is about to begin. I’ll simply give you a quick overview of Jenkins right now. Jenkins is well-known for its DevOps CI-CD technology. Continuous Integration and Continued Delivery are referred to as CICD. The cornerstone of DevOps technology is Jenkins. Using Ubuntu 18.0.2, let’s examine how to configure Jenkins on Amazon EC2 Instant.
- Use the following command to become a root. so no need for an extra sudo command.
[ec2-user@ip ~]$ sudo su -
2. Currently, we are using the command below to update the server.
[root@ip ~]$ sudo apt update
3. We are using the command below to install Git, Maven, and Java JDK. We are installing all three tool simultaneously with a single command.
[root@ip ~]$ sudo apt-get install default-jdk maven git -y
4. Using wget, we are currently adding the Jenkins key and adding those jenkins key to the key.
[root@ip ~]$ wget -q -o https://pkg.jenkins.io/jenkins.io.key | sudo apt-key add -
5. Jenkins binary checking here
[root@ip ~]$ echo deb http://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
6. We’re updating the server once again to get leteast binaries.
[root@ip ~]$ sudo apt update
7. With the command listed below, we will now install Jenkins.
[root@ip ~]$ sudo apt install jenkins -y
Installing Jenkins
8. We are now checking the Maven version with the command below.
[root@ip ~]$ mvn --version
9. We are now checking the Java version with the command below.
[root@ip ~]$ java -version
10. We are now checking the Git version with the command below.
[root@ip ~]$ git --version
Let’s Access Jenkins Dashboard:
Now, in order to access the Jenkins user interface, you must know the public IP address of the EC2 instance where Jenkins is installed. To obtain the public IP of the EC2 instance, use the command listed below.
[root ~]$ host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}'
Once you have the public IP, copy the public IP address and enter it in the search bar with port 8080. My public IP address is 3.239.211.209 therefore when you search with that address and press Enter, Jenkins UI will appear, as shown in the screenshot below. If you can’t see Jenkins’ UI, please verify that the 8080 port is open in your security group.
Jenkins UI
Jenkins requires a password for login. As seen in the screenshot above, the initial admin password is often saved in /var/lib/jenkins/secrets/initialAdminPassword.
1. Use the following command to display this password:
[root ~]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
2. Continue with the default option Install suggested plugins.
3. Fill below details to Create First Admin User. After entering your data, click Save and Continue.
4. Configure Jenkins URL:
5. Here is the Jenkins Dashboard:
Congratulations! You’ve configured and installed Jenkins on the Ubuntu 18.0.2 AMI successfully.
— — — — — — — —
Here is the End!
I hope you like my article. I’m going to share my knowledge with you in order to make it easier for you to grasp AWS DevOps. I’ll be publishing more articles like this soon.
happy studying!