How to install Jenkins to Ubuntu | Jenkins 101

DevOps with Erdenay
3 min readJan 7, 2021

--

Hello! I am Erdenay Ateş.
What is Jenkins?
Jenkins is really powerful tool for CI/CD and its logo says us everything!

That gentleman standing like “I can automate everything, dont worry!” and he is really able to do that. You can give your code or your Github project URL after that he can test your code or integrate new features to your project. And it is Continuous Integration. Actually he can deploy your code also and it is Continuous Delivery. These features make Jenkins at top 5 in DevOps!

In this Medium posts serie, i will try to explain how Jenkins works with its basics. Firstly we will setup Jenkins to our Ubuntu or Docker container(an image) and at the next post we will test our very simple Bash script.

The components we need

We should install 3 components for our Jenkins mission.
-Jenkins is a web based application been developed by Java.
-Jenkins is using Maven for building the projects.
-Jenkins is using Git for version control.

How to install them?
If we ask to our machine “what is java version? or git and maven”. Result will be “command not found”

So we should install our needs.

apt update ; apt install openjdk-8-jdk
apt install git
apt install maven

After these installation steps, or components are ready to use. If we ask their versions we will have that result:

And its time setup Jenkins. In that post we are building something to Ubuntu distro, so we should use Debian packages for setting up.

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
/etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

After that 4 steps our Jenkins installion file is ready to setup. Now lets check Jenkins status.

sudo systemctl status jenkins

Seems like dead now.

sudo systemctl start jenkins
sudo systemctl enable jenkins
sudo systemctl status jenkins

In container view
In Ubuntu machine view

Looks fine now? Right! If we got to our localhost:8080 our Jenkins is waiting us.

localhost:8080

We should unlock our Jenkins with its password and it is avaliable at /var/lib/jenkins/secrets/initialAdminPassword and if you type cat command with that, you will see your password and paste it there.

cat /var/lib/jenkins/secrets/initialAdminPassword

And we should setup the suggested plugins, we will use them later.

Voilà! It is working now! And as you can see i already made some mistakes!

At next post we will create our automated first script!

--

--

DevOps with Erdenay
DevOps with Erdenay

No responses yet