I have virtual machine in AWS EC2,
Jenkins default port number 8080, So, need to Add 8080 port in AWS EC2 security group.
Install Java:
Update the system package
sudo apt update
Install OpenJDK 17
sudo apt install openjdk-17-jre
Check java version
java -version
Update the system package
sudo apt update
Add the Jenkins repository
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
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
Install the Jenkins
sudo apt-get install jenkins
Check Jenkins status
sudo systemctl status jenkins
Now, Jenkins is running,
Now, copy the Jenkins virtual machine public ip address,
Enter the public ip address with 8080 port in browser,
A page opens prompting to Unlock Jenkins
http://<ip address>:8080
open the terminal and running the following command, will get get the jenkins password
cat /var/lib/jenkins/secrets/initialAdminPassword
Install suggested plugins or Select plugins to install
Create admin user name & password
Enter instance public ip with port and Click save and Finish
Now, Successfully installed Jenkins on the Ubuntu 22.04 virtual machine