Step to install jenkins on AWS
How can you easly setup jenkins on AWS ec2 instance(Ubuntu)
Step 1
Install java
Update your system
sudo apt update
Install java
sudo apt install openjdk-11-jre
Validate Installation
java –version
It should look something like this
openjdk 11.0.17 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu222.04)
OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu222.04, mixed mode, sharing)
Step 2
Install Jenkins
Just copy these commands and paste them onto your terminal.
curl -fsSL https://pkg.jenkins.io/debian/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 binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null
Add Repository Key
You have to add Jenkins repository into Ubuntu server, use below command for that.
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -Add Package Repository
Use below command to add package repository
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Now, to update the server you have to use below command;
sudo apt update
Now, you can use below command to install Jenkins
sudo apt install jenkins -y
Once jenkins installation completed you have to start Jenkins service for that use below command
sudo systemctl start jenkins
sudo systemctl status jenkins
Unlock jenkins
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
And get the password.
Install jenkins using Docker
First of all stop all the running jenkins
Check the status of running jenkins
sudo systemctl status jenkins
Install docker first.
Command to install docker
sudo apt install docker.io Y
Command to install jenkins using docker
sudo docker pull jenkins/jenkins
sudo docker run -d -p 8080:8080 docker.io/jenkins/jenkins:latest
Now you can access jenkins with port 8080
Ip address of your instance:8080(http://54.178.81.5:8080/)
Now we have to unlock jenkins first
How to get the password
sudo docker exec -it <container_id> bash //come inside the container
cd /var/jenkins_home/secrets
cat initialAdminPassword
And get the password and copy paste into jenkins and install all the suggested password.
Top comments (0)