Installing Jenkins on Ubuntu
update your instance:
sudo apt-get update
install java: sudo apt install openjdk-11-jre
To check the version of java on your system, use the following command:
java -version
Step 1 — Installing Jenkins
curl -fsSL https://pkg.jenkins.io/debian-stable/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-stable binary/ | sudo tee
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update sudo apt-get install jenkins
Step 2 — Starting Jenkins
now that Jenkins is installed, start it by using systemctl:
sudo systemctl start jenkins.service
Since systemctl doesn’t display status output, we’ll use the status command to verify that Jenkins started successfully:
sudo systemctl status jenkins
Note:Open port 8080 in the inbound traffic rules as show below.
EC2 > Instances > Click on
In the bottom tabs -> Click on Security
Security groups
Add inbound traffic rules as shown in the image (you can just allow TCP 8080 as well, in my case, I allowed All traffic).
sudo cat /var/lib/jenkins/secrets/initialadminpassword
copy this password: 9f48d46e86a443d7b5171e45cef18f2d
and paste it here.