# Installing Jenkins on Ubuntu 22.04

I have virtual machine in AWS EC2,

Jenkins default port number 8080, So, need to Add 8080 port in AWS EC2 security group.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722067762763/03f3fa3a-42ad-4cdd-a219-84d852f13640.png align="center")

### Install Java:

Update the system package

```plaintext
sudo apt update
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722066715356/9b9d1942-2dcd-42e1-a6e7-db68489d4fae.png align="center")

Install OpenJDK 17

```plaintext
sudo apt install openjdk-17-jre
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722067121248/60642972-1b66-4319-b906-12ef576cb9fb.png align="center")

Check java version

```plaintext
java -version
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722067161586/f252b7ce-b153-4754-a7ff-4e12b56fab29.png align="center")

Update the system package

```plaintext
sudo apt update
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722067024241/979b4df7-8ae9-468f-8442-1fbd8a1ff64d.png align="center")

Add the Jenkins repository

```plaintext
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
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722066800258/ea322a09-2f8b-4c06-88c3-197dca924f03.png align="center")

```plaintext
sudo apt-get update
```

Install the Jenkins

```plaintext
sudo apt-get install jenkins
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722066957836/52631e75-41f7-464e-a0dc-814c5df9445f.png align="center")

Check Jenkins status

```plaintext
sudo systemctl status jenkins
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722067462161/e72affb4-1fcb-4233-9957-148f4035de8b.png align="center")

Now, Jenkins is running,

Now, copy the Jenkins virtual machine public ip address,

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722067837707/e8f6866b-c9df-4e47-a5d4-34adc704c8da.png align="center")

Enter the public ip address with 8080 port in browser,

A page opens prompting to **Unlock Jenkins**

```plaintext
http://<ip address>:8080
```

open the terminal and running the following command, will get get the jenkins password

```plaintext
cat /var/lib/jenkins/secrets/initialAdminPassword
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722068186374/fd185bab-acfb-4626-a7a1-eb40cce97b9e.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722068243403/ede49767-ed3b-4151-9543-88682033b7f0.png align="left")

**Install suggested plugins** or **Select plugins to install**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722068333495/135ea50a-8e8a-4a4c-ad34-0d73c8b1636b.png align="center")

Create admin user name & password

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722068494692/7f12b877-9320-44e3-ac53-680e05b80344.png align="left")

Enter instance public ip with port and Click save and Finish

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722068526353/050605e0-8be4-48e2-b833-0cb67792d652.png align="left")

Now, Successfully installed Jenkins on the Ubuntu 22.04 virtual machine

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722068581846/367dfd1b-387a-43c9-bce5-0ed688a3d0c5.png align="center")
