How To Install Jenkins In Aws Instance
In this pace you volition deploy Jenkins on your EC2 instance by completing the post-obit tasks:
-
Connect to your Linux example
-
Download and install Jenkins
-
Configure Jenkins
Connect to your Linux instance
Afterward you launch your instance, you can connect to it and use it the way that you lot would apply your local automobile.
Before you connect to your example, get the public DNS name of the instance using the Amazon EC2 console. Select the instance and locate Public DNS.
If your instance doesn't have a public DNS proper noun, open the VPC console, select the VPC, and cheque the Summary tab. If either DNS resolution or DNS hostnames is no, click Edit and change the value to yes. |
Prerequisites
The tool that you use to connect to your Linux instance depends on the operating organisation running on your computer. If your estimator runs Windows, you volition connect using PuTTY. If your computer runs Linux or Mac OS X, you will connect using the SSH client. These tools require the use of your key pair. Be certain that you created your key pair every bit described in [Create a key pair using Amazon EC2].
Using PuTTY to connect to your instance
-
From the Outset carte, choose All Programs > PuTTY > PuTTY.
-
In the Category pane, select Session, and complete the following fields:
-
In Host Name, enter ec2-user@public_dns_name.
-
Ensure that Port is 22.
-
-
In the Category pane, expand Connection, aggrandize SSH, and then select Auth. Complete the following:
-
Click Browse.
-
Select the .ppk file that you generated for your key pair, as described in [Create a key pair using Amazon EC2] and then click Open.
-
Click Open to start the PuTTY session.
-
Using SSH to connect to your instance
-
Use the ssh command to connect to the instance. You will specify the private key (.pem) file and ec2-user@public_dns_name.
$ ssh -i /path/my-key-pair.pem ec2-user@ec2-198-51- 100-ane.compute-1.amazonaws.com
You volition run into a response like the following:
The authenticity of host 'ec2-198-51-100-1.compute1.amazonaws.com (10.254.142.33)' cant be established. RSA key fingerprint is 1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2nd:7d:b8:ca:9f:f5:f1:6f. Are you sure yous want to go along connecting (yep/no)?
-
Enter yeah.
Yous volition come across a response like the following:
Warning: Permanently added 'ec2-198-51-100-i.compute1.amazonaws.com' (RSA) to the list of known hosts.
Download and install Jenkins
To download and install Jenkins:
-
To ensure that your software packages are upward to engagement on your example, use the following command to perform a quick software update:
[ec2-user ~]$ sudo yum update –y
-
Add the Jenkins repo using the following command:
[ec2-user ~]$ sudo wget -O /etc/yum.repos.d/jenkins.repo \ https://pkg.jenkins.io/redhat-stable/jenkins.repo
-
Import a key file from Jenkins-CI to enable installation from the parcel:
[ec2-user ~]$ sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
[ec2-user ~]$ sudo yum upgrade
-
Install Coffee:
[ec2-user ~]$ sudo amazon-linux-extras install java-openjdk11 -y
-
Install Jenkins:
[ec2-user ~]$ sudo yum install jenkins -y
-
Enable the Jenkins service to get-go at boot:
[ec2-user ~]$ sudo systemctl enable jenkins
-
Start Jenkins as a service:
[ec2-user ~]$ sudo systemctl start jenkins
Yous can cheque the status of the Jenkins service using the command:
[ec2-user ~]$ sudo systemctl status jenkins
Configure Jenkins
Jenkins is now installed and running on your EC2 instance. To configure Jenkins:
-
Connect to http://<your_server_public_DNS>:8080 from your favorite browser. You will be able to admission Jenkins through its management interface:
-
As prompted, enter the countersign found in /var/lib/jenkins/secrets/initialAdminPassword.
Use the post-obit command to display this password:
[ec2-user ~]$ sudo true cat /var/lib/jenkins/secrets/initialAdminPassword
-
The Jenkins installation script directs you to the Customize Jenkins page. Click Install suggested plugins.
-
Once the installation is complete, Create First Admin User, click Salvage and Continue.
-
On the left-hand side, click Manage Jenkins, and and then click Manage Plugins.
-
Click on the Bachelor tab, and and so enter Amazon EC2 plugin at the top right.
-
Select the checkbox next to Amazon EC2 plugin, and and then click Install without restart.
-
Once the installation is done, click Back to Dashboard.
-
Click on Configure a cloud.
-
Click Add a new cloud, and select Amazon EC2. A collection of new fields appears.
-
Make full out all the fields. (Note: You will have to Add together Credentials of the kind AWS Credentials.)
Y'all are now ready to use EC2 instances every bit Jenkins agents.
Source: https://www.jenkins.io/doc/tutorials/tutorial-for-installing-jenkins-on-AWS/
Posted by: hamilscolon.blogspot.com
0 Response to "How To Install Jenkins In Aws Instance"
Post a Comment