There are two ways to install Jenkins on a server
To configure Jenkins as a Docker Container.
Step 1: Launch an EC2 Instance

Step 2: Configure Security Group to allow access (SSH 0n port 22 for myself, and port 8080 general public)

Step 3: SSH into Ec2instance ssh -i "Test-Key.pem" [[email protected]](<mailto:[email protected]>)

Step 4: Update and upgrade sudo apt update && sudo apt upgrade

Step 6: Install docker sudo apt install docker.io

Step 7: Install Jenkins container using the command below
sudo docker run -p 8080:8080 -p 50000:50000 -d \
-v jenkins_home:/var/jenkins_home jenkins\jenkins:lts
Explanation of code:
sudo - Root user access
Docker run - Starts the container
-p 8080:8080 - (for browser access to Jenkins Application) - exposes the Docker container on port 8080 and maps it to my host on port 8080
-p 5000:5000 - (for Jenkins Master and Worker node communication, so that Jenkins can be started as a cluster)
-d - Run the container in detached mode/the background, so that when i quit the terminal, the container still runs.
-v - Volume, for persisting/storing data
jenkins_home - Name of the volume/storage folder
:/var/jenkins_home - This is the location of the storage folder where the storage will be mounted
jenkins\jenkins:lts - Name of the official Image with the Tag(lates)
Wen done pulling the Jenkins image, run sudo docker ps to show the running images.

This image above confirms our Jenkins server is running. So when we copy the Ip address of the Ec2 instance and check it on the browser, alongside the port number that was configured, we can now see the Jenkins UI. http://54.173.244.209:8080

Step 8: Accessing the Login Credentials.
To access the login credentials, we will have to first enter the docker container to access the file. we run docker exec -t <container id> bash

Note, we are logged in as Jenkins user and not as root user. this adheres to the best practice to always run services as a dedicated user and not a root user.

Next is to setup first Jenkins user by filling out the user information.
