Wednesday, July 1, 2020

Install Jenkins on Amazon Linux



Step 1 – Install Java on Amazon Linux

Run below commands to install Java 11 on Amazon Linux as java is mandatory to install jenkins
sudo amazon-linux-extras install java-openjdk11

Step 2 – Check Active Java Version

[root@ip-172-31-60-200 ~]# java -version
openjdk version "11.0.7" 2020-04-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)
If it not showing java Version 11 please point to java 11

Step 3 – Switch Java Version if it not pointing to java Version 11.

alternatives --config java
[root@ip-172-31-60-200 ~]# alternatives --config java
There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.amzn2.0.1.x86_64/jre/bin/java)
 + 2           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.7.10-4.amzn2.0.1.x86_64/bin/java)

Enter to keep the current selection[+], or type selection number: 2







Step 4 Installing Jenkins

                1.Download Jenkins repo
                wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
                2.Add Key
                rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
                3.Install Jenkins
                yum -y install jenkins
                4. Start Jenkins
                systemctl start jenkins
                5. Enable Jenkins Service
                systemctl enable jenkins



Step 5 Lanch  Jenkins Console

Please collect public ip from AWS console and the default port for Jenkins is 8080


First time we need to unlock Jeniks.






After Providing password you will get below the page to configure plugins and select install Suggested plugins.












You are done with installation now you can create Jenkin Jobs ….

Please download PDF.



Enjoy happy learning
bonams